diff --git a/recipes/economist.recipe b/recipes/economist.recipe index 5f0c7ff957..8541c489b3 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -4,6 +4,7 @@ import json import re import time +from uuid import uuid4 from collections import defaultdict from datetime import datetime, timedelta from urllib.parse import quote, urlencode @@ -254,10 +255,9 @@ class Economist(BasicNewsRecipe): ) br = BasicNewsRecipe.get_browser(self, *args, **kwargs) else: - # Needed to bypass cloudflare - kwargs['user_agent'] = 'common_words/based' + kwargs['user_agent'] = 'TheEconomist-Lamarr-android' br = BasicNewsRecipe.get_browser(self, *args, **kwargs) - br.addheaders += [('Accept-Language', 'en-GB,en-US;q=0.9,en;q=0.8')] + br.addheaders += [('x-request-id', str(uuid4()))] return br def publication_date(self): @@ -525,7 +525,9 @@ class Economist(BasicNewsRecipe): feeds = [] - for part in safe_dict(data, "props", "pageProps", "content", "sections"): + for part in safe_dict( + data, "props", "pageProps", "content", "headerSections" + ) + safe_dict(data, "props", "pageProps", "content", "sections"): section = safe_dict(part, "name") or '' if not section: continue diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe index 5f0c7ff957..8541c489b3 100644 --- a/recipes/economist_free.recipe +++ b/recipes/economist_free.recipe @@ -4,6 +4,7 @@ import json import re import time +from uuid import uuid4 from collections import defaultdict from datetime import datetime, timedelta from urllib.parse import quote, urlencode @@ -254,10 +255,9 @@ class Economist(BasicNewsRecipe): ) br = BasicNewsRecipe.get_browser(self, *args, **kwargs) else: - # Needed to bypass cloudflare - kwargs['user_agent'] = 'common_words/based' + kwargs['user_agent'] = 'TheEconomist-Lamarr-android' br = BasicNewsRecipe.get_browser(self, *args, **kwargs) - br.addheaders += [('Accept-Language', 'en-GB,en-US;q=0.9,en;q=0.8')] + br.addheaders += [('x-request-id', str(uuid4()))] return br def publication_date(self): @@ -525,7 +525,9 @@ class Economist(BasicNewsRecipe): feeds = [] - for part in safe_dict(data, "props", "pageProps", "content", "sections"): + for part in safe_dict( + data, "props", "pageProps", "content", "headerSections" + ) + safe_dict(data, "props", "pageProps", "content", "sections"): section = safe_dict(part, "name") or '' if not section: continue diff --git a/recipes/economist_news.recipe b/recipes/economist_news.recipe index dd163dba4f..4fe15ac7f9 100644 --- a/recipes/economist_news.recipe +++ b/recipes/economist_news.recipe @@ -3,6 +3,7 @@ import json import time +from uuid import uuid4 from datetime import datetime, timedelta from urllib.parse import quote, urlencode @@ -191,10 +192,9 @@ class EconomistNews(BasicNewsRecipe): self.oldest_article = float(d) def get_browser(self, *args, **kwargs): - # Needed to bypass cloudflare - kwargs['user_agent'] = 'common_words/based' + kwargs['user_agent'] = 'TheEconomist-Lamarr-android' br = BasicNewsRecipe.get_browser(self, *args, **kwargs) - br.addheaders += [('Accept-Language', 'en-GB,en-US;q=0.9,en;q=0.8')] + br.addheaders += [('x-request-id', str(uuid4()))] return br def economist_return_index(self, ans): diff --git a/recipes/korben.recipe b/recipes/korben.recipe index 6afe94a8db..30a8b12cca 100644 --- a/recipes/korben.recipe +++ b/recipes/korben.recipe @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +#!/usr/bin/env python from calibre.web.feeds.news import BasicNewsRecipe @@ -7,6 +7,7 @@ class BasicUserRecipe1318619728(BasicNewsRecipe): oldest_article = 7 max_articles_per_feed = 100 auto_cleanup = True + language = 'fr' feeds = [(u'Korben', u'http://feeds2.feedburner.com/KorbensBlog-UpgradeYourMind')] diff --git a/recipes/ugeskriftet.recipe b/recipes/ugeskriftet.recipe index 20c0ddf269..e539c959f7 100644 --- a/recipes/ugeskriftet.recipe +++ b/recipes/ugeskriftet.recipe @@ -7,7 +7,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class Ugeskriftet(BasicNewsRecipe): title = 'Ugeskriftet' description = 'Ugeskriftet for læger' - language = 'dan' + language = 'da' __author__ = 'https://github.com/morusn' oldest_article = 7 publication_type = 'magazine'