diff --git a/recipes/economist.recipe b/recipes/economist.recipe index cf47a8fda1..2941338f4f 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -15,8 +15,6 @@ from calibre.web.feeds.news import BasicNewsRecipe from html5_parser import parse from lxml import etree -# For past editions, set date to, for example, '2020-11-28'. -edition_date = None use_archive = True @@ -71,7 +69,7 @@ if use_archive: except Exception: date = data['datePublished'] dt = datetime.fromisoformat(date[:-1]) + timedelta(seconds=time.timezone) - dt = dt.strftime('%b %d, %Y, %I:%M %p') + dt = dt.strftime('%b %d, %Y %I:%M %p') if data['dateline'] is None: E(article, 'p', dt, style='color: gray; font-size:small;') else: @@ -199,6 +197,13 @@ class Economist(BasicNewsRecipe): # downloaded with connection reset by peer (104) errors. delay = 1 + recipe_specific_options = { + 'date': { + 'short': 'The date of the edition to download (YYYY-MM-DD format)', + 'long': 'For example, 2024-07-19\nThis seems to work only for a couple of past editions.' + } + } + needs_subscription = False def get_browser(self, *args, **kwargs): @@ -231,6 +236,7 @@ class Economist(BasicNewsRecipe): if use_archive: def parse_index(self): + edition_date = self.recipe_specific_options.get('date') # return self.economist_test_article() # url = 'https://www.economist.com/weeklyedition/archive' query = { @@ -326,6 +332,7 @@ class Economist(BasicNewsRecipe): self.log.warn('Kindle Output profile being used, reducing image quality to keep file size below amazon email threshold') def parse_index(self): + edition_date = self.recipe_specific_options.get('date') # return self.economist_test_article() if edition_date: url = 'https://www.economist.com/weeklyedition/' + edition_date