A time waster/distraction

Jamon Camisso jamon.camisso-H217xnMUJC0sA/PxXw9srA at public.gmane.org
Tue Jun 23 22:05:35 UTC 2009


Tyler Aviss wrote:
> Hmm. Translating an RSS feed to a picture-puller shouldn't be too
> hard. Easier (and more polite) than a screen-scraper too. Thanks :-)

Here:

#!/usr/bin/python

import urllib2
import xml.dom.minidom as DOM

i = []
can = 'http://feeds.feedburner.com/ICanHasCheezburger'
has = urllib2.urlopen(can).readlines()
cheez = DOM.parseString(''.join(has))

ichcb_url = 'http://icanhascheezburger.files.wordpress.com'

for burger in cheez.getElementsByTagName('media:content'):
         burger = burger.attributes.get('url').value
         if burger.startswith(ichcb_url):
                 i.append(burger)

for ICanHasCheezburger in i:
         print ICanHasCheezburger
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list