mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge branch 'recipes/fokus' of https://github.com/h-holm/calibre
This commit is contained in:
commit
76b7e79186
@ -53,6 +53,7 @@ class Fokus(BasicNewsRecipe):
|
||||
figure_tag = a_tag.find('figure')
|
||||
img_tag = figure_tag.find('img')
|
||||
|
||||
try:
|
||||
# The `srcset` attribute contains a comma-separated list of URLs and their resolutions.
|
||||
cover_urls = img_tag['srcset'].split(', ')
|
||||
cover_urls = [src.split(' ') for src in cover_urls]
|
||||
@ -65,6 +66,8 @@ class Fokus(BasicNewsRecipe):
|
||||
# The first item of the sorted list is now the URL of the highest-resolution image.
|
||||
self.cover_url = cover_urls[0][0]
|
||||
self.log(f"Identified cover URL: '{self.cover_url}'")
|
||||
except (KeyError, ValueError) as exc:
|
||||
self.log.error(f'Failed to extract cover URL! Has the website format changed?\n{exc}')
|
||||
|
||||
return
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user