NatGeo update

This commit is contained in:
unkn0w7n 2023-11-02 13:05:57 +05:30
parent 9b97543bef
commit 71c4c2af20
3 changed files with 9 additions and 2 deletions

View File

@ -41,6 +41,7 @@ def parse_lead_image(media):
yield '<div class="cap">' + media['caption'] + '</div>' yield '<div class="cap">' + media['caption'] + '</div>'
if 'credit' in media: if 'credit' in media:
yield '<div class="cred">' + media['credit'] + '</div>' yield '<div class="cred">' + media['credit'] + '</div>'
yield '</p>'
def parse_body(item): def parse_body(item):
@ -124,6 +125,7 @@ class NatGeo(BasicNewsRecipe):
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 resolve_internal_links = True
ignore_duplicate_articles = {'url'}
extra_css = ''' extra_css = '''
.sub, blockquote { color:#404040; } .sub, blockquote { color:#404040; }
@ -171,5 +173,6 @@ class NatGeo(BasicNewsRecipe):
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img', src=True): for img in soup.findAll('img', src=True):
img['src'] = img['src'] + '?w=700&h=700' # for high res images use '?w=2000&h=2000'
img['src'] = img['src'] + '?w=1000&h=1000'
return soup return soup

View File

@ -40,6 +40,7 @@ def parse_lead_image(media):
yield '<div class="cap">' + media['caption'] + '</div>' yield '<div class="cap">' + media['caption'] + '</div>'
if 'credit' in media: if 'credit' in media:
yield '<div class="cred">' + media['credit'] + '</div>' yield '<div class="cred">' + media['credit'] + '</div>'
yield '</p>'
def parse_body(item): def parse_body(item):
@ -156,5 +157,6 @@ class NatGeo(BasicNewsRecipe):
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img', src=True): for img in soup.findAll('img', src=True):
# for high res images use '?w=2000&h=2000'
img['src'] = img['src'] + '?w=1000&h=1000' img['src'] = img['src'] + '?w=1000&h=1000'
return soup return soup

View File

@ -45,6 +45,7 @@ def parse_lead_image(media):
yield '<div class="cap">' + media['caption'] + '</div>' yield '<div class="cap">' + media['caption'] + '</div>'
if 'credit' in media: if 'credit' in media:
yield '<div class="cred">' + media['credit'] + '</div>' yield '<div class="cred">' + media['credit'] + '</div>'
yield '</p>'
def parse_body(item): def parse_body(item):
@ -175,5 +176,6 @@ class NatGeo(BasicNewsRecipe):
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img', src=True): for img in soup.findAll('img', src=True):
img['src'] = img['src'] + '?w=1000&h=1000' # for high res images use '?w=2000&h=2000'
img['src'] = img['src'] + '?w=1200&h=1200'
return soup return soup