From 83cff90848bd55ede705fc14ec0db2ac32c8c04a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 9 May 2018 19:54:17 +0530 Subject: [PATCH] Update The Federalist --- recipes/the_federalist.recipe | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/recipes/the_federalist.recipe b/recipes/the_federalist.recipe index 3ea247af57..4334f3a065 100644 --- a/recipes/the_federalist.recipe +++ b/recipes/the_federalist.recipe @@ -39,7 +39,19 @@ class Federalist(BasicNewsRecipe): ('All', 'http://thefederalist.com/feed/'), ] + def preprocess_html(self, soup): + for img in soup.findAll('img', attrs={'data-lazy-src': True}): + img['src'] = img['data-lazy-src'] + seen = set() + for img in soup.findAll('img', src=True): + src = img['src'] + if src in seen: + img.extract() + seen.add(src) + return soup + # def parse_index(self): # return [('Articles', [ - # {'title':'xxx', 'url':'http://thefederalist.com/2018/05/04/fans-take-on-marvel-dc-and-the-comic-book-industrys-sjw-self-destruction/'} + # {'title':'img', 'url':'http://thefederalist.com/2018/05/09/venezuelas-economic-problems-caused-socialism-not-falling-oil-prices/'}, + # {'title':'xxx', 'url':'http://thefederalist.com/2018/05/04/fans-take-on-marvel-dc-and-the-comic-book-industrys-sjw-self-destruction/'}, # ])]