From cd1765b93528492720ab09c674df67a6f1c8b630 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 13 Apr 2013 10:07:08 +0530 Subject: [PATCH] Update Science News --- recipes/science_news.recipe | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/recipes/science_news.recipe b/recipes/science_news.recipe index 53b451030a..b2329899ac 100644 --- a/recipes/science_news.recipe +++ b/recipes/science_news.recipe @@ -50,6 +50,10 @@ class ScienceNewsIssue(BasicNewsRecipe): dict(name='ul', attrs={'id':'toc'}) ] + remove_tags= [ dict(name='a', attrs={'class':'enlarge print-no'}), + dict(name='a', attrs={'rel':'shadowbox'}) + ] + feeds = [(u"Science News Current Issues", u'http://www.sciencenews.org/view/feed/type/edition/name/issues.rss')] match_regexps = [ @@ -57,6 +61,12 @@ class ScienceNewsIssue(BasicNewsRecipe): r'www.sciencenews.org/view/generic/id' ] + def image_url_processor(self, baseurl, url): + x = url.split('/') + if x[4] == u'scale': + url = u'http://www.sciencenews.org/view/download/id/' + x[6] + u'/name/' + x[-1] + return url + def get_cover_url(self): cover_url = None index = 'http://www.sciencenews.org/view/home' @@ -64,7 +74,6 @@ class ScienceNewsIssue(BasicNewsRecipe): link_item = soup.find(name = 'img',alt = "issue") if link_item: cover_url = 'http://www.sciencenews.org' + link_item['src'] + '.jpg' - return cover_url def preprocess_html(self, soup):