mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Update foreign_policy.recipe
This commit is contained in:
parent
d166674234
commit
006c372278
@ -47,8 +47,20 @@ class ForeignPolicy(BasicNewsRecipe):
|
|||||||
]
|
]
|
||||||
remove_tags_after = [classes('post-content-main')]
|
remove_tags_after = [classes('post-content-main')]
|
||||||
|
|
||||||
|
recipe_specific_options = {
|
||||||
|
'issue': {
|
||||||
|
'short': 'Enter the Issue Number you want to download ',
|
||||||
|
'long': 'For example, 411131563'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
soup = self.index_to_soup('https://foreignpolicy.com/the-magazine')
|
issue_url = 'https://foreignpolicy.com/the-magazine'
|
||||||
|
d = self.recipe_specific_options.get('issue')
|
||||||
|
if d and isinstance(d, str):
|
||||||
|
issue_url = issue_url + '/?issue_id=' + d
|
||||||
|
|
||||||
|
soup = self.index_to_soup(issue_url)
|
||||||
img = soup.find('img', attrs={'src': lambda x: x and '-cover' in x})
|
img = soup.find('img', attrs={'src': lambda x: x and '-cover' in x})
|
||||||
if img:
|
if img:
|
||||||
self.cover_url = img['src'].split('?')[0] + '?w=800?quality=90'
|
self.cover_url = img['src'].split('?')[0] + '?w=800?quality=90'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user