dive into mark

You are here: dive into markArchivesAugust 2002Feeding Zeldman

Tuesday, August 6, 2002

Feeding Zeldman

#!/usr/bin/python
import urllib, re, cgi

_pattern = re.compile(r’<p id=.*?>(.*?)\n<a href=”/daily/(.*?)” title=”Permanent link.”>:::</a></p>’, re.DOTALL)
data = urllib.urlopen(’http://www.zeldman.com/’).read()
print “”"Content-type: text/xml

<rss version=”0.92″>
<channel>
<title>Zeldman.com: Daily Report</title>
<link>http://www.zeldman.com/</link>
<description>Part of a complete Zeldman.com breakfast</description>”"”
for description, link in _pattern.findall(data):
    print “<item>”
    print “<description>%s</description>” % cgi.escape(description)
    print “<link>http://www.zeldman.com/daily/%s</link>” % link
    print “</item>”
print “</channel></rss>”

Filed under , , ,

Respond privately

I am no longer accepting public comments on this post, but you can use this form to contact me privately. (Your message will not be published.)



Recent Stuff For You, Special Price Stay Here
  • Greasemonkey Hacks
Good Stuff Buy The Cow Go Away
Dive Into Python
Powered by Google Drink The Milk Don't Steal

 

posts / comments
© 2001-8 Mark Pilgrim