From 5b624b2051a997f1f9327b01d9e38dce82dae175 Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Mon, 9 Oct 2023 22:37:12 +0530 Subject: [PATCH] NatGeo --- recipes/natgeo.recipe | 4 +++- recipes/natgeohis.recipe | 3 ++- recipes/natgeomag.recipe | 10 +++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/recipes/natgeo.recipe b/recipes/natgeo.recipe index 91201f5c33..fa512763d2 100644 --- a/recipes/natgeo.recipe +++ b/recipes/natgeo.recipe @@ -122,9 +122,11 @@ class NatGeo(BasicNewsRecipe): remove_attributes = ['style'] remove_javascript = False masthead_url = 'https://i.natgeofe.com/n/e76f5368-6797-4794-b7f6-8d757c79ea5c/ng-logo-2fl.png?w=600&h=600' + remove_empty_feeds = True + resolve_internal_links = True extra_css = ''' - .sub { color:#404040; } + .sub, blockquote { color:#404040; } .byline, i { font-style:italic; color:#202020; } .cap {text-align:center; font-size:small; } .cred {text-align:center; font-size:small; color:#404040; } diff --git a/recipes/natgeohis.recipe b/recipes/natgeohis.recipe index c4310c872c..33104376c3 100644 --- a/recipes/natgeohis.recipe +++ b/recipes/natgeohis.recipe @@ -124,9 +124,10 @@ class NatGeo(BasicNewsRecipe): remove_attributes = ['style'] remove_javascript = False masthead_url = 'https://i.natgeofe.com/n/e76f5368-6797-4794-b7f6-8d757c79ea5c/ng-logo-2fl.png?w=600&h=600' + resolve_internal_links = True extra_css = ''' - .sub { color:#404040; } + .sub, blockquote { color:#404040; } .byline, i { font-style:italic; color:#202020; } .cap {text-align:center; font-size:small; } .cred {text-align:center; font-size:small; color:#404040; } diff --git a/recipes/natgeomag.recipe b/recipes/natgeomag.recipe index e5fd4ec031..039360f9c4 100644 --- a/recipes/natgeomag.recipe +++ b/recipes/natgeomag.recipe @@ -10,6 +10,9 @@ from calibre.web.feeds.news import BasicNewsRecipe from calibre import prepare_string_for_xml as escape from calibre.utils.iso8601 import parse_iso8601 +edition = date.today().strftime('%B-%Y') + +# edition = 'March-2023' def classes(classes): q = frozenset(classes.split(' ')) @@ -124,9 +127,10 @@ class NatGeo(BasicNewsRecipe): remove_javascript = False masthead_url = 'https://i.natgeofe.com/n/e76f5368-6797-4794-b7f6-8d757c79ea5c/ng-logo-2fl.png?w=600&h=600' remove_empty_feeds = True + resolve_internal_links = True extra_css = ''' - .sub { color:#404040; } + .sub, blockquote { color:#404040; } .byline, i { font-style:italic; color:#202020; } .cap {text-align:center; font-size:small; } .cred {text-align:center; font-size:small; color:#404040; } @@ -134,9 +138,9 @@ class NatGeo(BasicNewsRecipe): ''' def parse_index(self): - url = 'https://www.nationalgeographic.com/magazine/issue/' + date.today().strftime('%B-%Y'). lower() + url = 'https://www.nationalgeographic.com/magazine/issue/' + edition.lower() self.log('Downloading ', url) - self.timefmt = ' [' + date.today().strftime('%B %Y') + ']' + self.timefmt = ' [' + edition + ']' soup = self.index_to_soup(url) png = re.findall('https://i\.natgeofe\.com\S+?national-geographic-magazine-\S+?\.jpg', soup.decode('utf-8')) self.cover_url = png[0] + '?w=1000&h=1000'