Fix Nature cover resolution

This commit is contained in:
ping 2023-01-23 20:18:00 +08:00
parent d17c1c6ce8
commit d6e1365432
No known key found for this signature in database
GPG Key ID: 6CCF56BCEDD24084

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python
import re
from collections import defaultdict
from calibre.web.feeds.news import BasicNewsRecipe, classes
@ -55,7 +55,7 @@ class Nature(BasicNewsRecipe):
'img', attrs={'data-test': check_words('issue-cover-image')}
)['src']
try:
self.cover_url = self.cover_url.replace("w200", "w500") # enlarge cover size resolution
self.cover_url = re.sub(r"\bw\d+\b", "w1000", self.cover_url) # enlarge cover size resolution
except:
"""
failed, img src might have changed, use default width 200