Flickr doesn’t provide feeds for private groups. It doesn’t provide feeds for comments on photos in a group, either. It is reasonable to want such feeds, so here’s a script that generates them on your HTTP server.
Make sure you have Python 2.4 installed.
Make sure you have Pygenx installed where Python 2.4 can find it.
Make sure you have Beej’s Python Flickr API installed where Python 2.4 can find it. (My copy of Beej’s Python Flickr API has this patch applied.)
Download the script. It is licensed under the MIT/expat license.
Get a Flickr API key for a desktop application and the associated shared secret.
Make a directory for the output of the script. This directory should be served out by your HTTP server. E.g. /path/to/www/root/directory/. Also make subdirectories /path/to/www/root/directory/feed/ and /path/to/www/root/directory/comments/feed/.
Make a file at /path/to/www/root/directory/updated.txt and write a single ASCII zero (“0”) as the contents of the file. (The script doesn’t make this file for you to prevent accidental writing in directories that haven’t been prepared this way. And because I am lazy.)
Limit HTTP access to the directory using HTTP Basic authentication to keep your group private.
Configure your HTTP server to serve .xhtml files as
application/xhtml+xml
and .atom files as
application/atom+xml
.
Add index.xhtml and index.atom as directory index file names.
Edit the #!
line of the script to point to your
Python 2.4 interpreter.
Edit the configuration variables.
groupId
is the NSID of the group.
groupUrlName
is the name of the group shown in
the Flickr group URL, i.e. groupUrlName part in
http://flickr.com/groups/groupUrlName/.
rootUrl
is the root of the URL hierarchy for
the stuff generated by the script. E.g.
"http://example.com/directory/".
rootDir
is the directory you created in step #6
above: e.g. "/path/to/www/root/directory/".
fetchCount
is the number of latest photos to
show. The technical maximum is 500 and the API TOS maximum is 30.
flickrAPIKey
is your Flickr API key.
flickrSecret
is the shared secret associated
with your API key.
Give the execute permission to the script.
Run the script from the command line.
Assuming that you are running the API library with my patch, copy the authorization URL to your browser, grant access and then press return on the command line to let the script continue. The authentication token will be saved.
Add the script to your .crontab so that the script is run periodically.
Add files /path/to/www/root/directory/style.css and /path/to/www/root/directory/comments/style.css so that the XHTML views appear to your liking. (Mine look like this: style.css for the pool view and style.css for the comments view.)
Announce the URLs (see below) and the access credentials in the Flickr group description.
Assuming that your rootUrl
is
“http://example.com/directory/”, the URLs are:
http://example.com/directory/ – an XHTML view of the latest photos including titles and comment counts
http://example.com/directory/feed/ – an Atom feed of the latest photos
http://example.com/directory/comments/ – an XHTML view of the comments on the latest photos
http://example.com/directory/comments/feed/ – an Atom of the comments on the latest photos
Some feed readers have issues with the feeds. Not my bug. The feeds are generated according to the RFC and have been checked with Feed Validator. Makers of broken feed readers should fix their products.
IE doesn’t grok application/xhtml+xml. Not my bug. Known workarounds are installing MathPlayer or upgrading to Firefox or Opera.
The comments are the comments on the latest photos—not the latest comments. New comments on old photos don’t show up. This is to avoid the run time and number of API requests growing as the group pool gets larger.
Using this script with public groups may violate the Flickr API TOS by replicating Flickr-provided functionality. Don’t blame me if Flickr thinks that you are replicating “the essential user experience of Flickr.com”.