From d6e1365432375a977e349d9fbb66ae87c2406e6f Mon Sep 17 00:00:00 2001 From: ping Date: Mon, 23 Jan 2023 20:18:00 +0800 Subject: [PATCH] Fix Nature cover resolution --- recipes/nature.recipe | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/nature.recipe b/recipes/nature.recipe index 91eaa74328..60ff8864a7 100644 --- a/recipes/nature.recipe +++ b/recipes/nature.recipe @@ -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