Created
August 10, 2011 08:49
-
-
Save kyleterry/1136398 to your computer and use it in GitHub Desktop.
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
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