Created
March 21, 2012 18:47
-
-
Save yanyaoer/2151112 to your computer and use it in GitHub Desktop.
get latest 5 post form feedburner(python-china.org)
This file contains hidden or 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/python | |
# -*- coding: utf-8 -*- | |
import os | |
import requests | |
from BeautifulSoup import BeautifulSoup as Soup | |
limit = 5 # max = 20 | |
feed_url = 'http://feeds.feedburner.com/python-china?format=xml' | |
req = requests.get(feed_url).text | |
s = Soup(req) | |
msgs = '\n\n- '.join([ t.contents[0] for t in s.findAll('title',{'type':'html'})[0:limit]]).encode('utf8') | |
cmd = 'growlnotify -t python-china newsfeed -m "===\n\n- %s\n\n" --image .py-cn/python.svg' % msgs | |
os.system(cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment