I recently introduced a new feature: Recommended Reading. My goal for this feature was to be able to take a list of my favorite blog posts from Google Reader and automatically post them to my blog with a python script. The way I eventually implemented this was by ripping the Atom feed from my Google Reader Shared Items Page, take each item in it and format it as a <ul>, and then post it to my blog using XMLRPC/metaWebLog. Here’s the script, commented for your reading pleasure.
# Import a bunch of things we'll need.
# feedparser is from http://www.feedparser.org/
import feedparser
import time
import xmlrpclib
from xml.dom import minidom
from pprint import pprint
# Defines how to post to the blog.
def blogPost( server, username, password, date, title, content ):
datastruct = {'pubDate': date, 'description':content, 'title':title}
returncode = server.metaWeblog.newPost('1',username,password,datastruct,1)
print returncode
# Initialize some details.
# You would need to put your real blog url, username, and password here, though.
servname = xmlrpclib.Server("http://iansinke.wordpress.com/xmlrpc.php")
username = 'xxxxx'
password = 'xxxxx'
# Check to make sure it's working.
pprint(servname.system.listMethods())
# Set up the post data.
Title = "Recommended Reading"
Date = ""
Content = ""
# Parse the feed.
# You would need to replace the URL with your google reader account's \
# shared page URL, or some other RSS or Atom feed.
f = feedparser.parse("http://www.google.com/reader/public/atom/user/15838963114361614548/state/com.google/broadcast")
ontent = Content + '<p>(Every Friday, I post my favorite blog posts of the week under the title "Recommended Reading".)</p>'
Content = Content + '<ul>'
for item in f.entries:
Content = Content + '<li><a href="' + item.link + '">' + item.title + '</a></li>'
Content = Content + '</ul>'
Content = Content + '<p> </p>'
# Post to the blog.
blogPost(servname, username, password, Date, Title, Content)
This took me about two hours to figure out and implement. Feel free to use it however you want.

