extract links from craigslist rdf feeds with python
note the use of urlfetch — i’m using this in an app engine application.
from BeautifulSoup import BeautifulSoup
class RDF(dict):
def __init__(self, url):
try:
self['contents'] = BeautifulSoup(urlfetch.fetch(url).contents)
except:
self['contents'] = ''
def links(self):
[ item['rdf:about'] for item in self['contents'].findAll('item') ]
if __name__ == '__main__'
from __main__ import RDF
url = 'http://sfbay.craigslist.org/search/apa/sfc?format=rss&bedrooms=2&s=0&maxAsk=3000'
print RDF(url).links
About this entry
You’re currently reading “extract links from craigslist rdf feeds with python,” an entry on e-huned.com
- Published:
- 07.02.08 / 8pm
- Category:
- personal
No comments
Jump to comment form | comments rss [?] | trackback uri [?]