lordsocke Posted October 27, 2015 Posted October 27, 2015 Hi guys ive got a problem.I got a programm which is downloading a source code from an webpage and is saving it to an .txt file.After that it is filtering the .txt file for my specific url´s by StringInStr. then I get my urls in the final txt file but it gives me out the links like that <p>https...</p> </div>how can I delete the rest expeted the links?here is the code it selfe:Local $aArray = FileReadToArray($sFile1) For $element in $aArray If StringInStr($element, "https://...") Then FileWriteLine($sFile2, $element) Next
JohnOne Posted October 27, 2015 Posted October 27, 2015 Search "StringRegExp urls" AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
lordsocke Posted October 27, 2015 Author Posted October 27, 2015 yes I tried it but im making something wrong do you got an example?
JohnOne Posted October 27, 2015 Posted October 27, 2015 Show what you made wrong. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
lordsocke Posted October 27, 2015 Author Posted October 27, 2015 (edited) #Include <Array.au3> $text = FileRead("Links.txt") $aRes = StringRegExp($text, '(?:http|rtmp)s?[^"\r\n]+', 3) _ArrayDisplay($aRes) FileWrite("Slotomania Links",$aRes)is giving me out nothingif im going to leave out the file write part im getting all the links displayed but at the end there is still the </p> </div> so that the link looks like that:https:....gifts&hc_location=ufi</p> </div> Edited October 27, 2015 by lordsocke
kcvinu Posted October 27, 2015 Posted October 27, 2015 Post the text in your file. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
lordsocke Posted October 27, 2015 Author Posted October 27, 2015 Post the text in your file. what do you mean
kcvinu Posted October 27, 2015 Posted October 27, 2015 You have a file with some text. And you want to strip some urls from that text. So i just want to see that text so that i can see if i can help you. Is that clear ? Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
nitekram Posted October 27, 2015 Posted October 27, 2015 #Include <Array.au3> $text = FileRead("Links.txt") $aRes = StringRegExp($text, '(?:http|rtmp)s?[^"\r\n]+', 3) _ArrayDisplay($aRes) FileWrite("Slotomania Links",$aRes)is giving me out nothingif im going to leave out the file write part im getting all the links displayed but at the end there is still the </p> </div> so that the link looks like that:https:....gifts&hc_location=ufi</p> </div>You could just run a stringreplace, look for the stuff you want to remove and remove it with '' or "" 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
mikell Posted October 27, 2015 Posted October 27, 2015 #Include <Array.au3> $text = BinaryToString(InetRead("https://www.autoitscript.com/site/")) $aRes = StringRegExp($text, '(?:http|rtmp)s?[^"\r\n]+', 3) _ArrayDisplay($aRes) FileWrite("Links.txt", _ArrayToString($aRes, @crlf))
lordsocke Posted November 4, 2015 Author Posted November 4, 2015 #Include <Array.au3> $text = BinaryToString(InetRead("https://www.autoitscript.com/site/")) $aRes = StringRegExp($text, '(?:http|rtmp)s?[^"\r\n]+', 3) _ArrayDisplay($aRes) FileWrite("Links.txt", _ArrayToString($aRes, @crlf))it is just adding a -1 at the end of the textfile
mikell Posted November 4, 2015 Posted November 4, 2015 Obviously it was a sample code intended to work with autoitscript.com
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now