diff --git a/recipes/economist.recipe b/recipes/economist.recipe index bcf6c216d4..eed28c2ab4 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -200,31 +200,9 @@ class Economist(BasicNewsRecipe): 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') - def get_browser(self): - br = BasicNewsRecipe.get_browser(self) - # Add a cookie indicating we have accepted Economist's cookie - # 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) + 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 def preprocess_raw_html(self, raw, url): diff --git a/recipes/economist_espresso.recipe b/recipes/economist_espresso.recipe index 0a9907efe9..5a5ac101d2 100644 --- a/recipes/economist_espresso.recipe +++ b/recipes/economist_espresso.recipe @@ -63,3 +63,8 @@ class Espresso(BasicNewsRecipe): nt = new_tag(soup, 'hr') hr.append(nt) 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 diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe index bcf6c216d4..eed28c2ab4 100644 --- a/recipes/economist_free.recipe +++ b/recipes/economist_free.recipe @@ -200,31 +200,9 @@ class Economist(BasicNewsRecipe): 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') - def get_browser(self): - br = BasicNewsRecipe.get_browser(self) - # Add a cookie indicating we have accepted Economist's cookie - # 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) + 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 def preprocess_raw_html(self, raw, url): diff --git a/recipes/economist_world_ahead.recipe b/recipes/economist_world_ahead.recipe index 46e712bc8b..68299f16ac 100644 --- a/recipes/economist_world_ahead.recipe +++ b/recipes/economist_world_ahead.recipe @@ -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') - def get_browser(self): - br = BasicNewsRecipe.get_browser(self) - # Add a cookie indicating we have accepted Economist's cookie - # 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) + 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 def preprocess_raw_html(self, raw, url): @@ -253,6 +231,7 @@ class Economist(BasicNewsRecipe): x.set('style', 'text-align:center; font-size:small;') for x in root.xpath('//cite'): x.tag = 'blockquote' + x.set('style', 'color:#404040;') raw = etree.tostring(root, encoding='unicode') return raw