THIS WEBSITE IS DEPRECATED.
My new website: makomi.net.

homeprojectsITBASH-scripting › download Flickr album

Download Flickr Album


Description
This script allows you to automatically download all images from a Flickr album without using the API. It is easy to extend the script to download all sorts of (multipage) Flickr listings, like e.g. search results and groups.

I wanted a little challenge, so instead of using Flickr's API, this script parses the site's HTML code. If you want to use the API instead and bypass problems resulting from changing HTML code, I suggest you have a look at the flickcurl C library.


Program Structure
It follows an easy step-by-step process:
  1. create all album page links
  2. create all default picture links
  3. convert all default picture links to point to the large pics
  4. convert all links to direct links
  5. download all files


Call
The script expects the following arguments: ./download_flickr.sh <url> <number of pages>

Example Output

$ ./download_flickr.sh https://secure.flickr.com/photos/user/sets/12345678901234567 4
Creating links to 4 overview pages
....
Creating links to pages containing the pictures/videos
....
Found 261 pages

Changing links to point to largest pictures
................................................................................
................................................................................
................................................................................
.....................
Creating direct links to the pictures
................................................................................
................................................................................
................................................................................
.....................
Downloading pictures
................................................................................
................................................................................
................................................................................
....................

260 picture links were processed.


Shortcommings of the code, making it "quick and dirty"
I hardcoded some assumptions about the sites' HTML structure in this script which very well may change over time. To make continous updates of this script unnecessary, one could make the script recognize the respective structures automatically. However, I don't want to invest this extra amount of time at this point, because I think that changes will happen very seldom. Nevertheless, I marked the respective pieces of code with a TODO flag.

Download





Keywords

BASH script; Linux; Flickr; album download.