This commit is contained in:
Kovid Goyal 2024-08-12 10:05:43 +05:30
commit c376d2e25d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 38 additions and 8 deletions

View File

@ -48,6 +48,7 @@ class IndianExpress(BasicNewsRecipe):
def parse_index(self):
section_list = [
('Daily Briefing', 'https://indianexpress.com/section/live-news/'),
('Front Page', 'https://indianexpress.com/print/front-page/'),
('India', 'https://indianexpress.com/section/india/'),
# ('Express Network', 'https://indianexpress.com/print/express-network/'),

View File

@ -163,6 +163,14 @@ class NatGeo(BasicNewsRecipe):
resolve_internal_links = True
ignore_duplicate_articles = {'url'}
recipe_specific_options = {
'res': {
'short': 'For hi-res images, select a resolution from the\nfollowing options: 800, 1000, 1200 or 1500',
'long': 'This is useful for non e-ink devices, and for a lower file size\nthan the default, use 400 or 300.',
'default': '600'
}
}
extra_css = '''
blockquote { color:#404040; }
.byline, i { font-style:italic; color:#202020; }
@ -223,8 +231,11 @@ class NatGeo(BasicNewsRecipe):
for h2 in soup.findAll('h2'):
h2.name = 'h4'
for img in soup.findAll('img', src=True):
# for high res images use '?w=2000&h=2000'
img['src'] = img['src'] + '?w=600&h=600'
res = '?w=600'
w = self.recipe_specific_options.get('res')
if w and isinstance(w, str):
res = '?w=' + w
img['src'] = img['src'] + res
return soup
def populate_article_metadata(self, article, soup, first):

View File

@ -163,6 +163,14 @@ class NatGeo(BasicNewsRecipe):
masthead_url = 'https://i.natgeofe.com/n/e76f5368-6797-4794-b7f6-8d757c79ea5c/ng-logo-2fl.png?w=600&h=600'
resolve_internal_links = True
recipe_specific_options = {
'res': {
'short': 'For hi-res images, select a resolution from the\nfollowing options: 800, 1000, 1200 or 1500',
'long': 'This is useful for non e-ink devices, and for a lower file size\nthan the default, use 400 or 300.',
'default': '600'
}
}
extra_css = '''
blockquote { color:#404040; }
.byline, i { font-style:italic; color:#202020; }
@ -198,8 +206,11 @@ class NatGeo(BasicNewsRecipe):
for h2 in soup.findAll('h2'):
h2.name = 'h4'
for img in soup.findAll('img', src=True):
# for high res images use '?w=2000&h=2000'
img['src'] = img['src'] + '?w=600&h=600'
res = '?w=600'
w = self.recipe_specific_options.get('res')
if w and isinstance(w, str):
res = '?w=' + w
img['src'] = img['src'] + res
return soup
def populate_article_metadata(self, article, soup, first):

View File

@ -176,6 +176,11 @@ class NatGeo(BasicNewsRecipe):
'date': {
'short': 'The date of the edition to download (Month-YYYY format)',
'long': 'For example, March-2023'
},
'res': {
'short': 'For hi-res images, select a resolution from the\nfollowing options: 800, 1000, 1200 or 1500',
'long': 'This is useful for non e-ink devices, and for a lower file size\nthan the default, use 400 or 300.',
'default': '600'
}
}
@ -231,8 +236,11 @@ class NatGeo(BasicNewsRecipe):
for h2 in soup.findAll('h2'):
h2.name = 'h4'
for img in soup.findAll('img', src=True):
# for high res images use '?w=2000&h=2000'
img['src'] = img['src'] + '?w=600&h=600'
res = '?w=600'
w = self.recipe_specific_options.get('res')
if w and isinstance(w, str):
res = '?w=' + w
img['src'] = img['src'] + res
return soup
def populate_article_metadata(self, article, soup, first):

View File

@ -70,8 +70,7 @@ class outlook(BasicNewsRecipe):
self.description = self.tag_to_string(summ)
tme = soup.find(attrs={'class':'arr__timeago'})
if tme:
self.timefmt = ' [' + self.tag_to_string(tme).strip() + ']'
self.timefmt = ' [' + self.tag_to_string(tme).split('-')[-1].strip() + ']'
ans = []