Conversion Error - Fetch news from Pocket
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
calibre |
Won't Fix
|
Undecided
|
darkom |
Bug Description
Problem description: Failed to Fetch new from Pocket. Tried restarting Calibre, re-adding the Pocket recipe as Custom-no effect.
INPUT
"""
Pocket Calibre Recipe v1.4
"""
from calibre import strftime
from calibre.
from string import Template
import json
import operator
import re
import tempfile
import urllib
import urllib2
__license__ = 'GPL v3'
__copyright__ = '''
2010, Darko Miletic <darko.miletic at gmail.com>
2011, Przemyslaw Kryger <pkryger at gmail.com>
2012-2013, tBunnyMan <Wag That Tail At Me dot com>
'''
class Pocket(
title = 'Pocket'
__author__ = 'Darko Miletic, Przemyslaw Kryger, Keith Callenberg, tBunnyMan'
description = '''Personalized news feeds. Go to getpocket.com to setup up
publisher = 'getpocket.com'
category = 'news, custom'
# Settings people change
oldest_article = 7.0
max_
minimum_
mark_
sort_method = 'oldest' # MUST be either 'oldest' or 'newest'
# To filter by tag this needs to be a single tag in quotes; IE 'calibre'
only_pull_tag = None
# You don't want to change anything under
no_stylesheets = True
use_
needs_
articles_
apikey = '19eg0e47pbT32z
index_url = u'https:/
read_api_url = index_url + u'/v3/get'
modify_api_url = index_url + u'/v3/send'
legacy_
articles = []
def get_browser(self, *args, **kwargs):
"""
We need to pretend to be a recent version of safari for the mac to
prevent User-Agent checks Pocket api requires username and password so
fail loudly if it's missing from the config.
"""
br = BasicNewsRecipe
if self.username is not None and self.password is not None:
else:
return br
def get_auth_uri(self):
"""Quick function to return the authentication part of the url"""
uri = ""
uri = u'{0}&apikey=
if self.username is None or self.password is None:
else:
uri = u'{0}&username=
uri = u'{0}&password=
return uri
def get_pull_
uri = ""
uri = u'{0}&state=
uri = u'{0}&contentTy
uri = u'{0}&sort=
uri = u'{0}&count=
if self.only_pull_tag is not None:
uri = u'{0}&tag=
return uri
def parse_index(self):
pocket_feed = []
fetch_url = u"{0}?{
)
try:
request = urllib2.
except urllib2.HTTPError as e:
return []
except urllib2.URLError as e:
return []
if len(pocket_feed) < self.minimum_
for pocket_article in pocket_
})
return [("My Pocket Articles for {0}".format(
def get_textview(self, url):
"""
Since Pocket's v3 API they removed access to textview. They also
redesigned their page to make it much harder to scrape their textview.
We need to pull the article, retrieve the formcheck id, then use it
to querty for the json version
This function will break when pocket hates us
"""
ajax_url = self.index_url + u'/a/x/
soup = self.index_
fc_tag = soup.find('script', text=re.
fc_id = re.search(
article_id = url.split("/")[-1]
data = urllib.
try:
except urllib2.HTTPError as e:
raise e
return json.load(
def get_obfuscated_
"""
Our get_textview returns parsed json so prettify it to something well
parsed by calibre.
"""
article = self.get_
template = Template(
with tempfile.
tmpbody = article['article']
for img in article['images']:
))
return tf.name
def mark_as_read(self, mark_list):
for article_id in mark_list:
})
)
try:
request = urllib2.
except urllib2.HTTPError as e:
return []
except urllib2.URLError as e:
return []
def cleanup(self):
if self.mark_
else:
pass
def default_cover(self, cover_file):
"""
Create a generic cover for recipes that don't have a cover
This override adds time to the cover
"""
try:
from calibre.ebooks import calibre_cover
title = self.title if isinstance(
date = strftime(
time = strftime('[%I:%M %p]')
except:
return False
return True
def user_error(self, error_message):
if hasattr(self, 'abort_
else:
raise RuntimeError(
# vim:ft=python tabstop=8 expandtab shiftwidth=4 softtabstop=4
OUTPUT
calibre, version 2.49.0 (win32, isfrozen: True)
Conversion Error: Failed: Fetch news from Pocket
Fetch news from Pocket
Resolved conversion options
calibre version: 2.49.0
{'asciiize': False,
'author_sort': None,
'authors': None,
'base_font_size': 0,
'book_producer': None,
'change_
'chapter': None,
'chapter_mark': 'pagebreak',
'comments': None,
'cover': None,
'debug_pipeline': None,
'dehyphenate': True,
'delete_
'disable_
'dont_
'dont_
'duplicate_
'embed_all_fonts': False,
'embed_
'enable_
'epub_flatten': False,
'epub_inline_toc': False,
'epub_toc_at_end': False,
'expand_css': False,
'extra_css': None,
'extract_to': None,
'filter_css': None,
'fix_indents': True,
'flow_size': 260,
'font_
'format_
'html_
'input_encoding': None,
'input_profile': <calibre.
'insert_
'insert_
'insert_metadata': False,
'isbn': None,
'italicize_
'keep_ligatures': False,
'language': None,
'level1_toc': None,
'level2_toc': None,
'level3_toc': None,
'line_height': 0,
'linearize_
'lrf': False,
'margin_bottom': 5.0,
'margin_left': 5.0,
'margin_right': 5.0,
'margin_top': 5.0,
'markup_
'max_toc_links': 50,
'minimum_
'no_chapters_
'no_default_
'no_inline_
'no_svg_cover': False,
'output_profile': <calibre.
'page_
'prefer_
'preserve_
'pretty_print': True,
'pubdate': None,
'publisher': None,
'rating': None,
'read_
'remove_
'remove_
'remove_
'remove_
'renumber_
'replace_
'search_replace': None,
'series': None,
'series_index': None,
'smarten_
'sr1_replace': '',
'sr1_search': '',
'sr2_replace': '',
'sr2_search': '',
'sr3_replace': '',
'sr3_search': '',
'start_
'subset_
'tags': None,
'test': False,
'timestamp': None,
'title': None,
'title_sort': None,
'toc_filter': None,
'toc_threshold': 6,
'toc_title': None,
'unsmarten_
'unwrap_lines': True,
'use_auto_toc': False,
'verbose': 2}
InputFormatPlugin: Recipe Input running
Using custom recipe
Python function terminated unexpectedly
<urlopen error [SSL: CERTIFICATE_
Traceback (most recent call last):
File "site.py", line 132, in main
File "site.py", line 109, in run_entry_point
File "site-packages\
File "site-packages\
File "site-packages\
File "site-packages\
File "site-packages\
File "site-packages\
File "<string>", line 65, in get_browser
File "site-packages\
File "site-packages\
File "site-packages\
File "site-packages\
File "site-packages\
File "site-packages\
File "site-packages\
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_
Changed in calibre: | |
status: | Triaged → Won't Fix |
Changing the component for this bug.
assignee darko-miletic
status triaged