Hi, I've been using a modified version of google reader uber recipe for quite some time.
It was designed to get specifically last 50 starred items from my reader list.
Today when I downloaded the recipe, the file appeared to be empty. The file was generated properly, but with no contents, besides this message:
Quote:
Failed feed: starred
TypeError('expected string or buffer',)
|
Here is the recipe code I was using:
Code:
import urllib, re, mechanize
from calibre.web.feeds.recipes import BasicNewsRecipe
from calibre import __appname__
class GoogleReader(BasicNewsRecipe):
title = 'Google Starred'
description = 'This recipe downloads feeds you have tagged from your Google Reader account.'
needs_subscription = True
__author__ = 'davec'
base_url = 'http://www.google.com/reader/atom/'
oldest_article = 365
max_articles_per_feed = 50
get_options = '?n=50'
preferred_feeds = ('starred', )
use_embedded_content = True
extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} @font-face {font-family: "monospace1";src:url(res:///opt/sony/ebook/FONT/tt0419m_.ttf)} @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} body{text-align: left; font-family: "serif1"} .article_date{font-family: "monospace1"}'
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
if self.username is not None and self.password is not None:
request = urllib.urlencode([('Email', self.username), ('Passwd', self.password),
('service', 'reader'), ('accountType', 'HOSTED_OR_GOOGLE'), ('source', __appname__)])
response = br.open('https://www.google.com/accounts/ClientLogin', request)
auth = re.search('Auth=(\S*)', response.read()).group(1)
print 'Auth is: ', auth
cookies = mechanize.CookieJar()
br = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
br.addheaders = [('Authorization', 'GoogleLogin auth='+auth)]
return br
def get_feeds(self):
feeds = []
soup = self.index_to_soup('http://www.google.com/reader/api/0/tag/list')
for id in soup.findAll(True, attrs={'name':['id']}):
url = id.contents[0]
feed_name = re.search('/([^/]*)$', url).group(1)
if not self.preferred_feeds or feed_name in self.preferred_feeds:
feeds.append((feed_name,
self.base_url + urllib.quote(url.encode('utf-8')) + self.get_options))
return feeds
I accessed google reader API - list of feeds is still there, unchanged, therefore have no idea what may be the problem...