mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
NatGeo
This commit is contained in:
parent
6d1846abe7
commit
5b624b2051
@ -122,9 +122,11 @@ class NatGeo(BasicNewsRecipe):
|
|||||||
remove_attributes = ['style']
|
remove_attributes = ['style']
|
||||||
remove_javascript = False
|
remove_javascript = False
|
||||||
masthead_url = 'https://i.natgeofe.com/n/e76f5368-6797-4794-b7f6-8d757c79ea5c/ng-logo-2fl.png?w=600&h=600'
|
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 = '''
|
extra_css = '''
|
||||||
.sub { color:#404040; }
|
.sub, blockquote { color:#404040; }
|
||||||
.byline, i { font-style:italic; color:#202020; }
|
.byline, i { font-style:italic; color:#202020; }
|
||||||
.cap {text-align:center; font-size:small; }
|
.cap {text-align:center; font-size:small; }
|
||||||
.cred {text-align:center; font-size:small; color:#404040; }
|
.cred {text-align:center; font-size:small; color:#404040; }
|
||||||
|
@ -124,9 +124,10 @@ class NatGeo(BasicNewsRecipe):
|
|||||||
remove_attributes = ['style']
|
remove_attributes = ['style']
|
||||||
remove_javascript = False
|
remove_javascript = False
|
||||||
masthead_url = 'https://i.natgeofe.com/n/e76f5368-6797-4794-b7f6-8d757c79ea5c/ng-logo-2fl.png?w=600&h=600'
|
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 = '''
|
extra_css = '''
|
||||||
.sub { color:#404040; }
|
.sub, blockquote { color:#404040; }
|
||||||
.byline, i { font-style:italic; color:#202020; }
|
.byline, i { font-style:italic; color:#202020; }
|
||||||
.cap {text-align:center; font-size:small; }
|
.cap {text-align:center; font-size:small; }
|
||||||
.cred {text-align:center; font-size:small; color:#404040; }
|
.cred {text-align:center; font-size:small; color:#404040; }
|
||||||
|
@ -10,6 +10,9 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
from calibre import prepare_string_for_xml as escape
|
from calibre import prepare_string_for_xml as escape
|
||||||
from calibre.utils.iso8601 import parse_iso8601
|
from calibre.utils.iso8601 import parse_iso8601
|
||||||
|
|
||||||
|
edition = date.today().strftime('%B-%Y')
|
||||||
|
|
||||||
|
# edition = 'March-2023'
|
||||||
|
|
||||||
def classes(classes):
|
def classes(classes):
|
||||||
q = frozenset(classes.split(' '))
|
q = frozenset(classes.split(' '))
|
||||||
@ -124,9 +127,10 @@ class NatGeo(BasicNewsRecipe):
|
|||||||
remove_javascript = False
|
remove_javascript = False
|
||||||
masthead_url = 'https://i.natgeofe.com/n/e76f5368-6797-4794-b7f6-8d757c79ea5c/ng-logo-2fl.png?w=600&h=600'
|
masthead_url = 'https://i.natgeofe.com/n/e76f5368-6797-4794-b7f6-8d757c79ea5c/ng-logo-2fl.png?w=600&h=600'
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
|
resolve_internal_links = True
|
||||||
|
|
||||||
extra_css = '''
|
extra_css = '''
|
||||||
.sub { color:#404040; }
|
.sub, blockquote { color:#404040; }
|
||||||
.byline, i { font-style:italic; color:#202020; }
|
.byline, i { font-style:italic; color:#202020; }
|
||||||
.cap {text-align:center; font-size:small; }
|
.cap {text-align:center; font-size:small; }
|
||||||
.cred {text-align:center; font-size:small; color:#404040; }
|
.cred {text-align:center; font-size:small; color:#404040; }
|
||||||
@ -134,9 +138,9 @@ class NatGeo(BasicNewsRecipe):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def parse_index(self):
|
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.log('Downloading ', url)
|
||||||
self.timefmt = ' [' + date.today().strftime('%B %Y') + ']'
|
self.timefmt = ' [' + edition + ']'
|
||||||
soup = self.index_to_soup(url)
|
soup = self.index_to_soup(url)
|
||||||
png = re.findall('https://i\.natgeofe\.com\S+?national-geographic-magazine-\S+?\.jpg', soup.decode('utf-8'))
|
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'
|
self.cover_url = png[0] + '?w=1000&h=1000'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user