Skip to content

Instantly share code, notes, and snippets.

@kyleterry
Created August 10, 2011 08:49
Show Gist options
  • Save kyleterry/1136398 to your computer and use it in GitHub Desktop.
Save kyleterry/1136398 to your computer and use it in GitHub Desktop.
import time
import redis
import feedparser
channels = ('hackpark', 'infoforcefeed',)
def main():
r = redis.Redis()
feed_items = feedparser.parse("http://xkcd.com/atom.xml")
while True:
for item in feed_items['entries']:
if item.id != r.get('last_xkcd_feed'):
r.set('last_xkcd_feed', item.id)
for channel in channels:
r.publish('#%s_out' % channel,
'New XKCD! :D-/< %s: %s' % (item.title, item.link))
break
time.sleep(60*60)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment