From 3ac265c26342475d22ff0827d19040272a1cd3a7 Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Thu, 4 Jan 2024 10:54:59 +0530 Subject: [PATCH] Update foreign_policy.recipe --- recipes/foreign_policy.recipe | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/foreign_policy.recipe b/recipes/foreign_policy.recipe index 8a2bccc452..38104dce92 100644 --- a/recipes/foreign_policy.recipe +++ b/recipes/foreign_policy.recipe @@ -38,8 +38,9 @@ class ForeignPolicy(BasicNewsRecipe): def parse_index(self): soup = self.index_to_soup('https://foreignpolicy.com/the-magazine') - img = soup.find('img', attrs={'data-lazy-src': lambda x: x and '-cover' in x}) - self.cover_url = img['data-lazy-src'] + img = soup.find('img', attrs={'src': lambda x: x and '-cover' in x}) + if img: + self.cover_url = img['src'] current_section = None amap = OrderedDict() for x in soup.findAll(name=('h2', 'h3')):