Sign in to follow this  
Followers 0
jonson1986

Save Same Pattern URLs from Source Code

3 posts in this topic

Hello,

I'm having a condition to copy all urls, having same ending and starting pattern, from source code of a specific website, that's why I write autoit codes but it  only copy very first matched url and exist.

Could you please help me how can I save all the available URLs matching with my pattern given in codes;

 

Here are codes

#RequireAdmin
#include <Excel.au3>
#include <IE.au3>
#include <String.au3>
#include <Array.au3>
Local $oExcel = _Excel_Open()
Local $oWorkbook1 = _Excel_BookOpen($oExcel, @ScriptDir & "\Urls.xlsx", True)
ProcessClose ( "iexplore.exe")
$file = fileopen(@scriptdir & "\source.txt", 10)
$IE = _IECreate(_Excel_RangeRead ($oWorkbook1, Default, "A1"), 0, 0 )
$source = _IEDocReadHTML($IE)
FileWrite($file, $source)
$target_source2 = _StringBetween($source, 'http://example.com/posts/', '/"')
If Not @error Then
FileWrite (@scriptdir & "\links.txt", 'http://example.com/posts/' & $target_source2[0] & @crlf)
EndIf

Thanks

Share this post


Link to post
Share on other sites



Thanks AutoBert,

It's working fine

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • TheSaint
      By TheSaint
      Some of you might find this little program I whipped up yesterday, to be useful. I had a need and it was filled.
      It is pretty basic and I admit was pretty much slapped together speedily and then fine tuned some time later, and could certainly do with more improving, if you care to do so.
      Thanks to Jefrey for his 'parse.au3' for the PHP elements. Source found here. I also used my Dropbox code, found here.

      Gutenberg Project page I used for the screenshot - http://www.gutenberg.org/ebooks/1965
      One of their links looks like - http://www.gutenberg.org/ebooks/1965.epub.images?session_id=5932cd1d25afee6150a958323abd8a32d68249a7
      V1.3
      Basically, the Download Dropbox program aims to simplify and speed up downloading of files, with Batch and easy sub-folder creation.
      Everything in the program is done by either Drag & Drop or clicking a button. Window floats on top of others, naturally.
      1. Drag a folder to the Destination input field to set the destination path.
      2. Highlight some text, then drag that text to the drop zone (top edit field), to create the first sub-folder (if you want one). Click the SUB FOLDER button to assign it.
      3. Do the same for the next sub-folder (if you want one or instead of the other sub folder). Click the TITLE button to assign it.
      4. Select and drag a link (URL) to the drop zone. Click the ADD button to have it added to the Download list (last field).
      5. Repeat for more files, that you wish to send to the same destination.
      6. Click the DOWNLOAD button to have them start downloading.
      If size of each download can be determined, you will see the Progress bar working.
      All the buttons & List have a CTRL key feature, some also have a SHIFT key one. See the Program Information dialog for details.
      Drop zone and other inputs, can also be typed or pasted into.
      Some settings are saved to INI file and recalled on subsequent executions or the click of a button with CTRL held down.
      NOTE - I particularly like the Text Drag ability, as that simplifies things when doing lots of sub-folders. No browsing required.
      ADVICE - Clicking an entry in the list field, will momentarily display its full link text in the drop zone. Entries on the List are not sorted, so they appear in the order added. Obviously I wanted the program to take up as least desktop space as feasible, so that means truncated list entries etc.
      WARNING - Before doing a bunch of links from a site, where the links are not straight forward, do a test run of one. Especially as there is currently no STOP button.
      Downloads Dropbox v1.2.zip  (includes au3 & exe) See above for required 'parse.au3' file.
      Downloads Dropbox v1.3.zip
      IMPROVEMENTS & LIMITATIONS
      I have tailored certain elements for Gutenberg Project downloads and another site or two, so things will not work out-of-the-box for all possible download sites. That means you will have to tweak the code for some sites. Straight forward download links (no tricky php) seem to work fine. In particular, while what you might want to get downloads fine, it may be missing the file extension and not have the desired name.
      Sometimes, if you drag & drop an image onto the drop zone, the image will display there, and you cannot grab its URL. In those cases, I just right click the original image, grab its URL and paste that into the drop zone. You can clear the displayed image (and any other entry in the drop zone) by holding down CTRL while clicking the DOWNLOAD button.
      At this stage, you can only batch download files that you want, to the same destination. I am considering adding a multiple destination ability.
      Need to add a STOP button.
      P.S. This is my first second full program with the latest AutoIt.
    • Rickname
      By Rickname
      Let me explain better.And Im 100% sure many have this problem and would be awesome if there would be a fix for this . So :

      In the SciTE script editor, if I load a big project, I want my source code to be clean, good ordered and concise. Because I have many functions, I often tight or expand them via that left little '+' or '-' cube button of the function. But after I close the SciTE window, ofc my sourcecode gets saved but not and the functions state ! Everytime I start the project , I start with all the functions expanded, despite if they were tightened or expanded .

      What could I do to SciTE to save my code state too ?