Created
January 16, 2009 20:28
-
-
Save segphault/48102 to your computer and use it in GitHub Desktop.
Week in review generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib2, re | |
from BeautifulSoup import BeautifulStoneSoup | |
ARTICLE_URLS = """ | |
<PUT URLS HERE, ONE PER LINE> | |
""".strip().split("\n") | |
xml = BeautifulStoneSoup(urllib2.urlopen("http://feeds.arstechnica.com/arstechnica/journals/openended")) | |
t = re.compile("<p>(.+?)</p>") | |
for article in ARTICLE_URLS: | |
for item in xml.findAll("item"): | |
if article == item.guid.string.strip(): | |
print '<p><a href="%s"><b>%s</b></a>: %s</p>' % ( | |
article, item.title.string, t.match(item.description.string).groups(0)[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment