This commit is contained in:
unkn0w7n 2023-10-09 22:37:12 +05:30
parent 6d1846abe7
commit 5b624b2051
3 changed files with 12 additions and 5 deletions

View File

@ -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; }

View File

@ -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; }

View File

@ -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'