Skip to content

Instantly share code, notes, and snippets.

@liruqi
Created June 29, 2011 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liruqi/1053983 to your computer and use it in GitHub Desktop.
Save liruqi/1053983 to your computer and use it in GitHub Desktop.
检查韩寒博客,如果有同月同日发博文,则会发送一个桌面提醒~
# author: liruqi@gmail.com (http://liruqi.wordpress.com/)
# require feedparser: http://www.feedparser.org/
#
import time
import os
import feedparser
f = feedparser.parse("http://blog.sina.com.cn/rss/1191258123.xml")
for e in f.entries:
now = time.localtime()
if e.updated_parsed.tm_mon == now.tm_mon:
print e.links[0]["href"]
print e.updated
if e.updated_parsed.tm_mday == now.tm_mday:
notify = 'notify-send -t 2000 -i ~/Desktop/logo-mongodb.png "%s" "%s"'%(e.links[0]["href"], e.links[0]["href"])
os.system(notify)
print e.links[0]["href"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment