This commit is contained in:
Kovid Goyal 2023-11-02 13:09:46 +05:30
commit 110e5db70c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
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>'
if 'credit' in media:
yield '<div class="cred">' + media['credit'] + '</div>'
yield '</p>'
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'
remove_empty_feeds = True
resolve_internal_links = True
ignore_duplicate_articles = {'url'}
extra_css = '''
.sub, blockquote { color:#404040; }
@ -171,5 +173,6 @@ class NatGeo(BasicNewsRecipe):
def preprocess_html(self, soup):
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

View File

@ -40,6 +40,7 @@ def parse_lead_image(media):
yield '<div class="cap">' + media['caption'] + '</div>'
if 'credit' in media:
yield '<div class="cred">' + media['credit'] + '</div>'
yield '</p>'
def parse_body(item):
@ -156,5 +157,6 @@ class NatGeo(BasicNewsRecipe):
def preprocess_html(self, soup):
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'
return soup

View File

@ -45,6 +45,7 @@ def parse_lead_image(media):
yield '<div class="cap">' + media['caption'] + '</div>'
if 'credit' in media:
yield '<div class="cred">' + media['credit'] + '</div>'
yield '</p>'
def parse_body(item):
@ -175,5 +176,6 @@ class NatGeo(BasicNewsRecipe):
def preprocess_html(self, soup):
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