When i’m viewing single image in Flickr, how i can get url of image? Some times these images are protected and its hard to find url from source code, AppleScript could get it easily. I just dont know how to do it using grep.
And if this image is available in bigger version (page has “All sizes” button and “See different sizes” link), then how i can get url of biggest image, not page where image is but url of image itself.
I forgot where I found this script, though I know it was on the board here somewhere…This will download a list of images from a webpage using the source code of the page.
--choose folder if you want to download the images
set f to choose folder
set u_path to quoted form of POSIX path of f
tell application "Safari"
set num_images to ¬
(do JavaScript "document.images.length" in document 1) as integer
end tell
if num_images is 0 then return
set thelist to {}
repeat with i from 1 to num_images
tell application "Safari"
set image_url to ¬
(do JavaScript "document.images[" & (i - 1) & "].src" in document 1)
end tell
set user_tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"/"}
set file_name to last text item of image_url
set end of thelist to image_url
set AppleScript's text item delimiters to user_tid
repeat with image_url in thelist
set user_tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"/"}
set file_name to last text item of image_url
--heres the downloading part using curl
do shell script ¬
"/usr/bin/curl " & image_url & " -o " & u_path & file_name
end repeat
end repeat