Various minor recipe updates

This commit is contained in:
Kovid Goyal 2022-07-03 14:14:19 +05:30
parent 7f6f66007a
commit 1d40ba6436
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 10 additions and 7 deletions

View File

@ -38,8 +38,8 @@ class ForeignPolicy(BasicNewsRecipe):
def parse_index(self):
soup = self.index_to_soup('https://foreignpolicy.com/the-magazine')
img = soup.find('img', src=True, attrs={'alt': lambda x: x and '-cover' in x})
self.cover_url = img['src']
img = soup.find('img', attrs={'data-lazy-src': lambda x: x and '-cover' in x})
self.cover_url = img['data-lazy-src']
current_section = None
amap = OrderedDict()
for x in soup.findAll(name=('h2', 'h3')):

View File

@ -141,6 +141,8 @@ class ForeignAffairsRecipe(BasicNewsRecipe):
conversion_options = {'comments': description, 'tags': category, 'language': 'en',
'publisher': publisher}
ignore_duplicate_articles = {'title', 'url'}
remove_empty_feeds = True
def parse_index(self):
soup = self.index_to_soup(self.INDEX)

View File

@ -58,9 +58,7 @@ class Nautilus(BasicNewsRecipe):
soup = self.index_to_soup('https://www.presspassnow.com/nautilus/issues/')
div = soup.find('div', **classes('image-fade_in_back'))
if div:
self.cover_url = div.find('img',
attrs={'srcset': True
})['srcset'].split(',')[-1].split()[0]
self.cover_url = div.find('img', src=True)['src']
return getattr(self, 'cover_url', self.cover_url)
def preprocess_html(self, soup):

View File

@ -39,6 +39,9 @@ class SwarajyaMag(BasicNewsRecipe):
if url.startswith('/'):
url = 'https://swarajyamag.com' + url
title = self.tag_to_string(a)
self.log(title, ' at ', url)
ans.append({'title': title, 'url': url})
d = a.find_previous_sibling('a', **classes('_2nEd_'))
if d:
desc = 'By ' + self.tag_to_string(d).strip()
self.log(title, ' at ', url, '\n', desc)
ans.append({'title': title, 'url': url, 'description': desc})
return [('Articles', ans)]