How to retrieve data from Google Reader?

969 views Asked by At

Problem: I want to download rss feed data from Google Reader. From direct feed I could download around 20 entries, but from Google Reader I could get 5000 last posts.

My solution (that does not work):

1.) Authenticate (using this post: Google Reader API Unread Count)

2.) http://www.google.com/reader/atom/feed/FEED_URL?r=n&n=NUMBER_OF_ITEMS this address should return X last posts. Specific url for NY Times feed and for last 100 posts: http://www.google.com/reader/atom/feed/http://feeds.nytimes.com/nyt/rss/HomePage?r=n&n=100

3.) use python and feedparser to get the content

import feedparser

url = "http://www.google.com/reader/atom/feed/http://feeds.nytimes.com/nyt/rss/HomePage?r=n&n=100"

d = feedparser.parse(url)

print d["feed"]["title"] # to get the title of the feed

My error message after running this code:

Traceback (most recent call last):

File "---", line 40, in print d["feed"]["title"]

File "C:\Python27\lib\site-packages\feedparser.py", line 346, in __ getitem__ return dict.__ getitem__(self, key)

KeyError: 'title'

Could I use feedparser to parse the content? Or the only way is to use regular expressions?

1

There are 1 answers

0
Robert Peters On

Look like you have to pagination. Look at the documentation for "count" and "continuation"

http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI