From 11672c4a717c5b73112bde6bb84b3546c7b52507 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 15 Jan 2023 11:45:54 +0530 Subject: [PATCH] Reduce image size in bloomberg recipes --- recipes/bloomberg-business-week.recipe | 2 ++ recipes/bloomberg.recipe | 2 ++ 2 files changed, 4 insertions(+) diff --git a/recipes/bloomberg-business-week.recipe b/recipes/bloomberg-business-week.recipe index 4374c75969..763cc0185a 100644 --- a/recipes/bloomberg-business-week.recipe +++ b/recipes/bloomberg-business-week.recipe @@ -124,4 +124,6 @@ class Bloomberg(BasicNewsRecipe): img['src'] = img['data-native-src'] else: img['src'] = '' + for img in soup.findAll('img', attrs={'src':lambda x: x and x.endswith(('-1x-1.jpg', '-1x-1.png'))}): + img['src'] = img['src'].replace('-1x-1', '750x-1') return soup diff --git a/recipes/bloomberg.recipe b/recipes/bloomberg.recipe index 28210d9baf..75f0812f09 100644 --- a/recipes/bloomberg.recipe +++ b/recipes/bloomberg.recipe @@ -102,4 +102,6 @@ class Bloomberg(BasicNewsRecipe): img['src'] = img['data-native-src'] else: img['src'] = '' + for img in soup.findAll('img', attrs={'src':lambda x: x and x.endswith(('-1x-1.jpg', '-1x-1.png'))}): + img['src'] = img['src'].replace('-1x-1', '750x-1') return soup