Skip to content

Instantly share code, notes, and snippets.

@segphault
Created January 16, 2009 20:28
Show Gist options
  • Save segphault/48102 to your computer and use it in GitHub Desktop.
Save segphault/48102 to your computer and use it in GitHub Desktop.
Week in review generator
#!/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("&lt;p&gt;(.+?)&lt;/p&gt;")
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