AutoHotkey Community

It is currently May 26th, 2012, 4:44 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: September 16th, 2007, 11:51 pm 
Offline

Joined: September 16th, 2007, 10:57 pm
Posts: 1
PhotoPhorcer
This is a script I made to assist me in downloading entire PhotoBucket albums at once, without having to right-click->save on all the images. However, you can use it to batch download a large list of images from almost anywhere.

Instructions

Recommended Tools: Link Extractor

To start with I will explain how to use the batch downloader. You need to obtain a .txt file that has a direct link to an image on each line. There are several ways to do this, but this is the way I have done it.

Quote:
1. Open up Link Extractor (see above)

2. Where it says "Enter Url:", type in the link to page you want to grab the images off of

If you're downloading images from a photobucket account, go to the photobucket account's "View All" page (ex: a10.photobucket.com/albums/a101/username/?start=all) and paste that page link in the field.

3. After doing this, click the "Get" button and wait for the page source to come up.

4. Check the radio bullet that says "Full Link" under the "Link Type" label

5. Click the "Search File" button and wait for it to enumerate the links from the page

6. Click the "Save" button under the enumerated links, and save the links as a text-file (list.txt is what the script comes preset for)

7. Now, before we use the script, we must prune the link list for things we don't need (non-images, repeating links, etc)

8. Open up the text file of links you saved in Notepad

9. Use your logic here and remove lines that do not have a path to an image in them

10. If you notice any odd text after all of your links (after saving a link list I got from a photobucket page, I noticed lots of """s appearing after my links) use the Edit->Replace... feature of Notepad.

10a. When replacing, enter the odd text (" in my case) in the "Find What" field, and leave the "Replace With" field empty. Then click "Replace All"

Also, for photobucket gallery downloading people here, I noticed that all the links in the file were repeated twice (and three times on a previous occasion). These duplicate links can be left in the file as long as they all are repeated twice. In this case, you can edit my script where it says "lin += 1" under the F6 hot-key block to "lin += 2" replacing 2 with however many duplicates there are for each link.

11. Continue rechecking your link list making sure you have removed all non-image links and also, for photobucket people here, removing the semi-duplicate links which point to the photobucket viewer page for the image (all links that contain: ?action=view&current=image.jpg). Also remove any links that point to other images or files (unless that is what you are downloading) other than .jpg, because the script is currently written to save files downloaded with the extension of (.jpg).


After following those steps you should have a nice and neat image list that contains direct links to images...one on each line. Now, place your list.txt file (or whatever you named it) into a new folder, or wherever you want the images to be downloaded, and also place my script in .ahk form inside of it. Open up my script in Notepad for editing, and read the instructions contained in it to replace everything you need to. Then run the script, and press F6. If you have done everything correctly, you should notice images popping up in the folder the script and link list is in. If not, go back and repeat my instructions.

For the F7 Hot-key....
You need a .txt file (also named list.txt) that contains one word or guessed image name on each line (without the .jpg file extension).

Example list.txt File:
Quote:
john
john2
john3
DSC02254
DSC02255
DSC02256
DSC02257
me
you
meandyou


The script will take the root photobucket account path you supplied it (the variable "base" in the F7 hot-key block) and add the text from the current line (with an added .jpg) after it. It will then download it, and check if it's the "file not found" page of photobucket. If it's not, it will keep it saved as the line number in the text file, then image.jpg in the folder that the script is in. Otherwise, the file not found page will be deleted and the script will move on.

Well, enough instructions, here's the script:
Code:
;PhotoPhorcer by Rowo
;Batch download a list of images that are presented in a text file (one direct link to an image on each line)
;Use a list of words to guess the names of images in a private photobucket account (to be used for your own accounts only)
;F6: Batch download a list of images
;F7: Guess images in a photobucket account (will delete non-images that are downloaded)
;This script was made originally for .jpg images, but can be used for other file formats by replacing .jpg with the proper extension
;MAKE SURE TO REPLACE VARIABLE VALUES WHEN NECESSARY, READ THROUGH THE COMMENTS

;--------------------------------------------------------------

F6::
{
MsgBox Starting...(F6 Pressed)
lin = 1      ;File Line #
txt = list.txt   ;Replace with name of list file
num = 10   ;Replace with # of images in list
nam = img.jpg   ;Replace with desired filename for images (Ex: 1img.jpg, 2img.jpg, 3img.jpg)

Loop %num%
{
FileReadLine, file, %txt%, %lin%
UrlDownloadToFile, %file%, %lin%%nam%
lin += 1
}
return
}

;--------------------------------------------------------------




;--------------------------------------------------------------

F7::
{
MsgBox Starting...(F7 Pressed)
lin = 1      ;File Line #
txt = list.txt   ;Replace with dictionary text file
num = 1000   ;Replace with # of lines in dictionary
base = http://a10.photobucket.com/albums/a101/username/ ;Replace with path to photobucket account

Loop %num%
{
FileReadLine, file, %txt%, %lin%

UrlDownloadToFile, %base%%file%.jpg, %file%image.jpg
FileGetSize, size, %file%image.jpg

if size = 18158 ;18158 bytes = "image not found" photobucket page
{
FileDelete, %file%image.jpg
}

Sleep, 50 ;Remove this line or add a semi-colon [;] to the beginning of it to maximize speed but cause the script to work harder
lin += 1
}
return
}

;--------------------------------------------------------------


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 1st, 2009, 10:49 pm 
Offline

Joined: April 1st, 2009, 10:47 pm
Posts: 1
Thanks for saving me some time!

now if only there was a link extractor that was free...


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Rajat, Yahoo [Bot] and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group