It uses matlab to search a particular url for photo links (actually it looks for the thumbnail links and modifies the string to give you the full res photo link), then uses a system command call to wget to download the photos All in 8 lines of code!
Ok to start you need the full url for your album. The '?start=all' bit at the end is important because this will show you all the thumbnails on a single page. Then simply use regexp to find the instances of thumbnail urls. Then loop through each link, strip the unimportant bits out, remove the 'th_' from the string which indicates the thumbnail version of the photo you want, and call wget to download the photo. Easy-peasy!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = urlread('http://s1270.photobucket.com/albums/SERVERNAME/YOURUSERNAME/YOURALBUMNAME/?start=all'); | |
indices = regexp(s,'pbthumburl='); | |
for k=1:length(indices) | |
tmp=strtrim(s(indices(k):indices(k)+100)); | |
tmp=tmp(regexp(tmp,'"','once')+1:end); | |
tmp=tmp(1:regexp(tmp,'"','once')-1); | |
system(['wget ',tmp(1:regexp(tmp,'th_')-1),tmp(regexp(tmp,'th_')+3:end)]); | |
end |
No comments:
Post a Comment