Skip to content

Instantly share code, notes, and snippets.

@yanyaoer
Created March 21, 2012 18:47
Show Gist options
  • Save yanyaoer/2151112 to your computer and use it in GitHub Desktop.
Save yanyaoer/2151112 to your computer and use it in GitHub Desktop.
get latest 5 post form feedburner(python-china.org)
#! /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