|
![]() |
|
Thread Tools | Search this Thread |
![]() |
#76 | |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: May 2011
Device: Kindle 3
|
![]() Quote:
I get a 401 error for the second last line. The article.id doesn't seem to fit and I couldn't figure out how to get the right id of the articles. article.id is in the form of {'original-id': u'http://www.blogurl.com/?p=38615', 'gr:original-id': u'http://www.blogurl.com/?p=38615'}. Does this work or is the problem somewhere else? PHP Code:
|
|
![]() |
![]() |
![]() |
#77 |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: May 2011
Device: Nook
|
Possible solution to 401 / Optimization
I was getting the 401 error and I think the possible cause is the fact that the "get_browser" function is running for each request and everytime authenticating on Google. Too many authentications = 401. I got the recipe working with the function get_browser "always returning the same browser".
Something like this: Code:
mybr = None def get_browser(self): br = BasicNewsRecipe.get_browser(self) if self.mybr is not None: return self.mybr 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) cookies = mechanize.CookieJar() br = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies)) br.addheaders = [('Authorization', 'GoogleLogin auth='+auth)] self.mybr = br return br |
![]() |
![]() |
Advert | |
|
![]() |
#78 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: May 2011
Device: Kindle 3
|
@loureiro Problem is the same with the adaption in the get_browser method.
Now I am always getting an Error Code 400, no matter what version of the get_browser method I am using: PHP Code:
Shouldn't have the id argument have a format like tag:google.com,2005:reader/item/041fa4grw5de72c9 when marking the article read? I can't find any id like this. |
![]() |
![]() |
![]() |
#79 | |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: May 2011
Device: Nook
|
Quote:
Code:
def article_downloaded(self, request, result): br = self.browser req = self.build_request(self.mark_as_read_url) if not result[2]: # Mark article as downloaded. article = request.article fields = urllib.urlencode([("i", article.id), ("a", "user/-/state/com.google/read"), ("ac", "edit-tags"), ("T", self.token)]) br.open(self.mark_as_read_url, fields) return BasicNewsRecipe.article_downloaded(self, request, result) Code:
def article_downloaded(self, request, result): br = mybr # <---- req = self.build_request(self.mark_as_read_url) if not result[2]: # Mark article as downloaded. article = request.article fields = urllib.urlencode([("i", article.id), ("a", "user/-/state/com.google/read"), ("ac", "edit-tags"), ("T", self.token)]) br.open(self.mark_as_read_url, fields) return BasicNewsRecipe.article_downloaded(self, request, result) |
|
![]() |
![]() |
![]() |
#80 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: May 2011
Device: Kindle 3
|
|
![]() |
![]() |
Advert | |
|
![]() |
#81 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15
Karma: 910
Join Date: Jun 2011
Device: kindle
|
Both greader builtins didnt work for me, the articles were not downloaded, but just the summary.
I tried to load the feed directly by creating a new recipe but it didn't work at all - the result was empty. I'm not sure how to debug/log in the recipes so couldn't figure out what's wrong to my great frustration. |
![]() |
![]() |
![]() |
#82 | |
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Dec 2010
Device: Kindle 3 wifi+3G
|
Hi
I've just found your recipe and I'm going to give it a try. But have you thought about mergeing with this: Quote:
|
|
![]() |
![]() |
![]() |
#83 |
Junior Member
![]() Posts: 1
Karma: 10
Join Date: Jun 2011
Device: kindle
|
![]()
Hi guys,
I am trying to adapt the recipe to get mobi from 'starred notes' but couple days of fighting and still no luck :/ Can you help me? my adapted recipe looks like this (take a look at last line): Code:
import urllib, re, mechanize
from calibre.web.feeds.recipes import BasicNewsRecipe
from calibre import __appname__
class GoogleReaderUber(BasicNewsRecipe):
title = 'Google Reader - Read It Later'
description = '...'
needs_subscription = True
__author__ = 'davec, rollercoaster, Starson17'
oldest_article = 365
max_articles_per_feed = 100
use_embedded_content = True
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)
cookies = mechanize.CookieJar()
br = mechanize.build_opener(mechanize.HTTPCookieProcessor(cookies))
br.addheaders = [('Authorization', 'GoogleLogin auth='+auth)]
return br
feeds = [(u'ReadItLater', u'http://www.google.com/reader/atom/user/-/state/com.google/starred?n=100')]
My idea is to have all interesting articles in one mobi book. Google reader provides great feature named 'Note in Reader »' which enable quick store found text in reader. thanks for your help |
![]() |
![]() |
![]() |
Tags |
google reader, google reader uber, hack, recpie |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Google Reader recipe not working :( | techie_007 | Calibre | 1 | 01-26-2010 09:58 PM |
Tagging and deleting for Google Reader Recipe | jomaweb | Calibre | 14 | 01-26-2010 11:31 AM |
Recipe Google Reader vs Google Reader Uber | DoctorOhh | Calibre | 0 | 01-26-2010 04:37 AM |
Google Uber Recipe takes so much time | jomaweb | Calibre | 1 | 01-26-2010 03:21 AM |
Read O'Reilly Hacks Series books using Google hack | Brian | Lounge | 12 | 02-19-2009 03:17 PM |