You are here

flickr metadata backup

Backup your public Flickr photo metadata to MongoDB using backupPublicPhotoMetadataByDateAndUser

Submitted by Roland on Mon, 2012-02-27 01:19

If you know how to run MongoDB and ruby on your computer or your server, then backupPublicPhotoMetadataByDateAndUser.rb is a simple Ruby script to backup your Flickr metadata for yours (or anybody else's) Flickr public photos for a given time period. Simple (it doesn't replicate flickr's richness nearly as comprehensively as Aaron's parallel flickr) but effective because then you can with very very simple programming use the MongoDB query language to do useful Flickr queries such as:

1. give me all the photos in gastown

2. give me the square 75x75url of all photos in Vancouver tagged "yellow"

3. give me all the photos geo-tagged in the city of Vancouver taken in 2011 during the morning rush hour (e.g. if you wanted to do Eric Fisher-like  maps)

HOW TO RUN IT:

  1. Start up MongoDB and create some indexes: /Applications/mongodb-osx-x86_64-2.0.2/bin/mongo
    1. > db.photos.ensureIndex({id:1});
      > db.photos.ensureIndex({datetaken:1});
      > db.photos.ensureIndex({dateupload:1});
      > db.photos.ensureIndex({lastupdate:1});
  2. Set Environment variables to point to your MongoDB and your flickr api key and the userid e.g.
    1. export MONGO_PORT=27017
    2. export MONGO_HOST=127.0.0.1
    3. export FLICKR_DB=rtflickr # your flickr database name in Mongo DB
    4. export FLICKR_USER=yourfunnyFlickruserIdendinging@01
    5. create a flickr.conf file like this:
      1. Roland-Tanglaos-MacBook-Pro-2:mongoflickrbackup rolandtanglao$ cat flickr.conf
        api_key = a3b9eeatbeefdecafbad
  3. specify time and date to backup e.g. to backup your 2009 public photos:
    1. ./backupPublicPhotoMetadataByDateAndUser.rb 2009 1 1 2009 12 31  >backup.2009.stdout.txt 2>backup.2009.stderr.txt
Subscribe to RSS - flickr metadata backup