mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix google reader recipes
This commit is contained in:
parent
c56a4a5aaf
commit
9a4b661ac6
@ -4,29 +4,27 @@ from calibre import __appname__
|
|||||||
|
|
||||||
class GoogleReader(BasicNewsRecipe):
|
class GoogleReader(BasicNewsRecipe):
|
||||||
title = 'Google Reader'
|
title = 'Google Reader'
|
||||||
description = 'This recipe downloads feeds you have tagged from your Google Reader account.'
|
description = 'This recipe fetches from your Google Reader account unread Starred items and unread Feeds you have placed in a folder via the manage subscriptions feature.'
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
__author__ = 'davec'
|
__author__ = 'davec, rollercoaster, Starson17'
|
||||||
base_url = 'http://www.google.com/reader/atom/'
|
base_url = 'http://www.google.com/reader/atom/'
|
||||||
max_articles_per_feed = 50
|
oldest_article = 365
|
||||||
|
max_articles_per_feed = 250
|
||||||
get_options = '?n=%d&xt=user/-/state/com.google/read' % max_articles_per_feed
|
get_options = '?n=%d&xt=user/-/state/com.google/read' % max_articles_per_feed
|
||||||
use_embedded_content = True
|
use_embedded_content = True
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
br = BasicNewsRecipe.get_browser()
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
|
|
||||||
if self.username is not None and self.password is not None:
|
if self.username is not None and self.password is not None:
|
||||||
request = urllib.urlencode([('Email', self.username), ('Passwd', self.password),
|
request = urllib.urlencode([('Email', self.username), ('Passwd', self.password),
|
||||||
('service', 'reader'), ('source', __appname__)])
|
('service', 'reader'), ('accountType', 'HOSTED_OR_GOOGLE'), ('source', __appname__)])
|
||||||
response = br.open('https://www.google.com/accounts/ClientLogin', request)
|
response = br.open('https://www.google.com/accounts/ClientLogin', request)
|
||||||
sid = re.search('SID=(\S*)', response.read()).group(1)
|
auth = re.search('Auth=(\S*)', response.read()).group(1)
|
||||||
|
|
||||||
cookies = mechanize.CookieJar()
|
cookies = mechanize.CookieJar()
|
||||||
br = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
|
br = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
|
||||||
cookies.set_cookie(mechanize.Cookie(None, 'SID', sid, None, False, '.google.com', True, True, '/', True, False, None, True, '', '', None))
|
br.addheaders = [('Authorization', 'GoogleLogin auth='+auth)]
|
||||||
return br
|
return br
|
||||||
|
|
||||||
|
|
||||||
def get_feeds(self):
|
def get_feeds(self):
|
||||||
feeds = []
|
feeds = []
|
||||||
soup = self.index_to_soup('http://www.google.com/reader/api/0/tag/list')
|
soup = self.index_to_soup('http://www.google.com/reader/api/0/tag/list')
|
||||||
|
@ -3,10 +3,10 @@ from calibre.web.feeds.recipes import BasicNewsRecipe
|
|||||||
from calibre import __appname__
|
from calibre import __appname__
|
||||||
|
|
||||||
class GoogleReaderUber(BasicNewsRecipe):
|
class GoogleReaderUber(BasicNewsRecipe):
|
||||||
title = 'Google Reader Uber'
|
title = 'Google Reader uber'
|
||||||
description = 'This recipe downloads all unread feedsfrom your Google Reader account.'
|
description = 'Fetches all feeds from your Google Reader account including the uncategorized items.'
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
__author__ = 'rollercoaster, davec'
|
__author__ = 'davec, rollercoaster, Starson17'
|
||||||
base_url = 'http://www.google.com/reader/atom/'
|
base_url = 'http://www.google.com/reader/atom/'
|
||||||
oldest_article = 365
|
oldest_article = 365
|
||||||
max_articles_per_feed = 250
|
max_articles_per_feed = 250
|
||||||
@ -14,20 +14,17 @@ class GoogleReaderUber(BasicNewsRecipe):
|
|||||||
use_embedded_content = True
|
use_embedded_content = True
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
br = BasicNewsRecipe.get_browser()
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
|
|
||||||
if self.username is not None and self.password is not None:
|
if self.username is not None and self.password is not None:
|
||||||
request = urllib.urlencode([('Email', self.username), ('Passwd', self.password),
|
request = urllib.urlencode([('Email', self.username), ('Passwd', self.password),
|
||||||
('service', 'reader'), ('source', __appname__)])
|
('service', 'reader'), ('accountType', 'HOSTED_OR_GOOGLE'), ('source', __appname__)])
|
||||||
response = br.open('https://www.google.com/accounts/ClientLogin', request)
|
response = br.open('https://www.google.com/accounts/ClientLogin', request)
|
||||||
sid = re.search('SID=(\S*)', response.read()).group(1)
|
auth = re.search('Auth=(\S*)', response.read()).group(1)
|
||||||
|
|
||||||
cookies = mechanize.CookieJar()
|
cookies = mechanize.CookieJar()
|
||||||
br = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
|
br = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
|
||||||
cookies.set_cookie(mechanize.Cookie(None, 'SID', sid, None, False, '.google.com', True, True, '/', True, False, None, True, '', '', None))
|
br.addheaders = [('Authorization', 'GoogleLogin auth='+auth)]
|
||||||
return br
|
return br
|
||||||
|
|
||||||
|
|
||||||
def get_feeds(self):
|
def get_feeds(self):
|
||||||
feeds = []
|
feeds = []
|
||||||
soup = self.index_to_soup('http://www.google.com/reader/api/0/tag/list')
|
soup = self.index_to_soup('http://www.google.com/reader/api/0/tag/list')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user