From 8dbaaaa37be884d00fb9ca801d34bff3e0da95f2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 27 Jul 2010 08:21:40 -0600 Subject: [PATCH] Fix #6302 (a change in the index-page broke the "Der Tagesspiegel"-recipe) --- resources/recipes/tagesspiegel.recipe | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/resources/recipes/tagesspiegel.recipe b/resources/recipes/tagesspiegel.recipe index 3129820e2c..b355a72ebd 100644 --- a/resources/recipes/tagesspiegel.recipe +++ b/resources/recipes/tagesspiegel.recipe @@ -10,7 +10,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class TagesspiegelRSS(BasicNewsRecipe): title = u'Der Tagesspiegel' - __author__ = 'Ingo Paschke' + __author__ = 'Ingo Paschke' language = 'de' oldest_article = 7 max_articles_per_feed = 100 @@ -26,7 +26,7 @@ class TagesspiegelRSS(BasicNewsRecipe): .quote .cite{font-family:Georgia,Palatino,Palatino Linotype,FreeSerif,serif;font-size:xx-small} .hcf-inline-left{float:left;margin-right:15px;position:relative;} .hcf-inline-right{float:right;margin-right:15px;position:relative;} - .hcf-smart-box{font-family: Arial, Helvetica, sans-serif; font-size: xx-small; margin: 0px 15px 8px 0px; width: 300px;} + .hcf-smart-box{font-family: Arial, Helvetica, sans-serif; font-size: xx-small; margin: 0px 15px 8px 0px; width: 300px;} ''' no_stylesheets = True @@ -39,30 +39,30 @@ class TagesspiegelRSS(BasicNewsRecipe): dict(name='link'), dict(name='iframe'),dict(name='style'),dict(name='meta'),dict(name='button'), dict(name='div', attrs={'class':["hcf-jump-to-comments","hcf-clear","hcf-magnify hcf-media-control"] }), dict(name='span', attrs={'class':["hcf-mainsearch",] }), - dict(name='ul', attrs={'class':["hcf-tools"]}), - dict(name='ul', attrs={'class': re.compile('hcf-services')}) + dict(name='ul', attrs={'class':["hcf-tools"]}), + dict(name='ul', attrs={'class': re.compile('hcf-services')}) ] def parse_index(self): soup = self.index_to_soup('http://www.tagesspiegel.de/zeitung/') def feed_title(div): - return ''.join(div.findAll(text=True, recursive=False)).strip() if div is not None else None + return ''.join(div.findAll(text=True, recursive=False)).strip() if div is not None else None articles = {} key = None ans = [] - maincol = soup.find('div', attrs={'class':re.compile('hcf-main-col')}) + maincol = soup.find('div', attrs={'class':re.compile('hcf-main-col')}) - for div in maincol.findAll(True, attrs={'class':['hcf-teaser', 'hcf-header', 'story headline']}): + for div in maincol.findAll(True, attrs={'class':['hcf-teaser', 'hcf-header', 'story headline']}): if div['class'] == 'hcf-header': - try: - key = string.capwords(feed_title(div.em.a)) - articles[key] = [] - ans.append(key) - except: - continue + try: + key = string.capwords(feed_title(div.em.a)) + articles[key] = [] + ans.append(key) + except: + continue elif div['class'] == 'hcf-teaser' and getattr(div.contents[0],'name','') == 'h2': a = div.find('a', href=True) @@ -88,5 +88,3 @@ class TagesspiegelRSS(BasicNewsRecipe): ans = [(key, articles[key]) for key in ans if articles.has_key(key)] return ans - -