Lu cat !

Romain Francoise: Working around link tracking

Readers of this blog have probably noticed by now my links posts; they are generated automatically from my Shared Items in Google Reader by a Python script which parses the Atom feed of my items and posts them to Blogger using the GData API. This works fine, but one of the annoying side effects is that the links in the blog post are not necessarily the real permalinks to the original articles since they are taken verbatim from the feeds, and many of them use services such as FeedBurner to do link tracking via an HTTP redirection.

Fortunately, resolving such redirections in Python is trivial:

>>> from urllib2 import urlopen
>>> u = 'http://feeds.feedburner.com/~r/boingboing/iBag/~3/162307349/new-york-jedis-meet.html'
>>> urlopen(u).geturl()
'http://www.boingboing.net/2007/09/27/new-york-jedis-meet.html'
>>>
Much better. (via luKas’ shared items in Google Reader)

30 September 2007