I thought this might be helpful for people who want to download flickr images using api and can save them some time:
- Get an authentication key from flickr: http://www.flickr.com/services/api/misc.api_keys.html
- Install flickrapi: http://pypi.python.org/pypi/flickrapi
- The easiest way to do this is using pip:
- sudo port install py32-pip(mac only, sudo apt-get install pip for linux?)
- pip-3.2 install flickrapi ( depending on your pip version change the command.
- Run the attached python script with three command line arguments:
- Search query to retrieve photos of
- Number of photos
- Output directory to save to ( The sub-directory structure is similar to flickr's internal directory structure, You can modify the FlickrPhoto class to modify this behavior).
- This script uses the tag based search query. The code also has a way to use the search query instead of tag based query(commented out). All special arguments explained in the link for more information: http://www.flickr.com/services/api/flickr.photos.search.html
I copied/modified this code from a friend who in turn copied/modified it from an existing api tutorial. You do not have to cite either of us! :-)
NOTE: THIS CODE WILL NOT WORK UNTIL YOU FILL THE TWO KEYS INSIDE THE CODE. (LINE 47 and 48)
No comments:
Post a Comment