From c74cfc55cdec17039eed5a6708019ee77665fdd9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 19 Mar 2008 21:23:18 +0000 Subject: [PATCH] Move NEwsweek recipe to use current issue to get list of articles. --- src/libprs500/web/feeds/recipes/newsweek.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libprs500/web/feeds/recipes/newsweek.py b/src/libprs500/web/feeds/recipes/newsweek.py index 2c368879d3..4ce3258531 100644 --- a/src/libprs500/web/feeds/recipes/newsweek.py +++ b/src/libprs500/web/feeds/recipes/newsweek.py @@ -46,6 +46,7 @@ class Newsweek(BasicNewsRecipe): self.cover_url = small.replace('coversmall', 'coverlarge') articles = {} + ans = [] key = None for tag in soup.findAll(['h5', 'h6']): if tag.name == 'h6': @@ -56,6 +57,7 @@ class Newsweek(BasicNewsRecipe): key = 'uncategorized' key = string.capwords(key) articles[key] = [] + ans.append(key) elif tag.name == 'h5' and key is not None: a = tag.find('a', href=True) if a is not None: @@ -70,7 +72,9 @@ class Newsweek(BasicNewsRecipe): } if art['title'] and art['url']: articles[key].append(art) - return articles + ans = [(key, articles[key]) for key in ans if articles.has_key(key)] + + return ans def postprocess_html(self, soup):