mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'master' of https://github.com/unkn0w7n/calibre
This commit is contained in:
commit
d19a40178b
@ -200,31 +200,9 @@ class Economist(BasicNewsRecipe):
|
|||||||
self.web2disk_options.compress_news_images_auto_size = 5
|
self.web2disk_options.compress_news_images_auto_size = 5
|
||||||
self.log.warn('Kindle Output profile being used, reducing image quality to keep file size below amazon email threshold')
|
self.log.warn('Kindle Output profile being used, reducing image quality to keep file size below amazon email threshold')
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self, *args, **kwargs):
|
||||||
br = BasicNewsRecipe.get_browser(self)
|
kwargs['user_agent'] = 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
|
||||||
# Add a cookie indicating we have accepted Economist's cookie
|
br = BasicNewsRecipe.get_browser(self, *args, **kwargs)
|
||||||
# policy (needed when running from some European countries)
|
|
||||||
ck = Cookie(
|
|
||||||
version=0,
|
|
||||||
name='notice_preferences',
|
|
||||||
value='2:',
|
|
||||||
port=None,
|
|
||||||
port_specified=False,
|
|
||||||
domain='.economist.com',
|
|
||||||
domain_specified=False,
|
|
||||||
domain_initial_dot=True,
|
|
||||||
path='/',
|
|
||||||
path_specified=False,
|
|
||||||
secure=False,
|
|
||||||
expires=None,
|
|
||||||
discard=False,
|
|
||||||
comment=None,
|
|
||||||
comment_url=None,
|
|
||||||
rest={'HttpOnly': None},
|
|
||||||
rfc2109=False
|
|
||||||
)
|
|
||||||
br.cookiejar.set_cookie(ck)
|
|
||||||
br.set_handle_gzip(True)
|
|
||||||
return br
|
return br
|
||||||
|
|
||||||
def preprocess_raw_html(self, raw, url):
|
def preprocess_raw_html(self, raw, url):
|
||||||
|
@ -63,3 +63,8 @@ class Espresso(BasicNewsRecipe):
|
|||||||
nt = new_tag(soup, 'hr')
|
nt = new_tag(soup, 'hr')
|
||||||
hr.append(nt)
|
hr.append(nt)
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
def get_browser(self, *args, **kwargs):
|
||||||
|
kwargs['user_agent'] = 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
|
||||||
|
br = BasicNewsRecipe.get_browser(self, *args, **kwargs)
|
||||||
|
return br
|
||||||
|
@ -200,31 +200,9 @@ class Economist(BasicNewsRecipe):
|
|||||||
self.web2disk_options.compress_news_images_auto_size = 5
|
self.web2disk_options.compress_news_images_auto_size = 5
|
||||||
self.log.warn('Kindle Output profile being used, reducing image quality to keep file size below amazon email threshold')
|
self.log.warn('Kindle Output profile being used, reducing image quality to keep file size below amazon email threshold')
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self, *args, **kwargs):
|
||||||
br = BasicNewsRecipe.get_browser(self)
|
kwargs['user_agent'] = 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
|
||||||
# Add a cookie indicating we have accepted Economist's cookie
|
br = BasicNewsRecipe.get_browser(self, *args, **kwargs)
|
||||||
# policy (needed when running from some European countries)
|
|
||||||
ck = Cookie(
|
|
||||||
version=0,
|
|
||||||
name='notice_preferences',
|
|
||||||
value='2:',
|
|
||||||
port=None,
|
|
||||||
port_specified=False,
|
|
||||||
domain='.economist.com',
|
|
||||||
domain_specified=False,
|
|
||||||
domain_initial_dot=True,
|
|
||||||
path='/',
|
|
||||||
path_specified=False,
|
|
||||||
secure=False,
|
|
||||||
expires=None,
|
|
||||||
discard=False,
|
|
||||||
comment=None,
|
|
||||||
comment_url=None,
|
|
||||||
rest={'HttpOnly': None},
|
|
||||||
rfc2109=False
|
|
||||||
)
|
|
||||||
br.cookiejar.set_cookie(ck)
|
|
||||||
br.set_handle_gzip(True)
|
|
||||||
return br
|
return br
|
||||||
|
|
||||||
def preprocess_raw_html(self, raw, url):
|
def preprocess_raw_html(self, raw, url):
|
||||||
|
@ -196,31 +196,9 @@ class Economist(BasicNewsRecipe):
|
|||||||
self.log.warn('Kindle Output profile being used, reducing image quality to keep file size below amazon email threshold')
|
self.log.warn('Kindle Output profile being used, reducing image quality to keep file size below amazon email threshold')
|
||||||
|
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self, *args, **kwargs):
|
||||||
br = BasicNewsRecipe.get_browser(self)
|
kwargs['user_agent'] = 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
|
||||||
# Add a cookie indicating we have accepted Economist's cookie
|
br = BasicNewsRecipe.get_browser(self, *args, **kwargs)
|
||||||
# policy (needed when running from some European countries)
|
|
||||||
ck = Cookie(
|
|
||||||
version=0,
|
|
||||||
name='notice_preferences',
|
|
||||||
value='2:',
|
|
||||||
port=None,
|
|
||||||
port_specified=False,
|
|
||||||
domain='.economist.com',
|
|
||||||
domain_specified=False,
|
|
||||||
domain_initial_dot=True,
|
|
||||||
path='/',
|
|
||||||
path_specified=False,
|
|
||||||
secure=False,
|
|
||||||
expires=None,
|
|
||||||
discard=False,
|
|
||||||
comment=None,
|
|
||||||
comment_url=None,
|
|
||||||
rest={'HttpOnly': None},
|
|
||||||
rfc2109=False
|
|
||||||
)
|
|
||||||
br.cookiejar.set_cookie(ck)
|
|
||||||
br.set_handle_gzip(True)
|
|
||||||
return br
|
return br
|
||||||
|
|
||||||
def preprocess_raw_html(self, raw, url):
|
def preprocess_raw_html(self, raw, url):
|
||||||
@ -253,6 +231,7 @@ class Economist(BasicNewsRecipe):
|
|||||||
x.set('style', 'text-align:center; font-size:small;')
|
x.set('style', 'text-align:center; font-size:small;')
|
||||||
for x in root.xpath('//cite'):
|
for x in root.xpath('//cite'):
|
||||||
x.tag = 'blockquote'
|
x.tag = 'blockquote'
|
||||||
|
x.set('style', 'color:#404040;')
|
||||||
raw = etree.tostring(root, encoding='unicode')
|
raw = etree.tostring(root, encoding='unicode')
|
||||||
return raw
|
return raw
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user