From 9997d3ad2c18e3ed11d9f419378382a4ffc72647 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 11 Jan 2013 10:19:24 +0530 Subject: [PATCH] Update Sueddeutsche Zeitung mobil --- recipes/libero.recipe | 2 +- recipes/sueddeutsche_mobil.recipe | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/recipes/libero.recipe b/recipes/libero.recipe index 709f3097d1..01c2da36c7 100644 --- a/recipes/libero.recipe +++ b/recipes/libero.recipe @@ -15,7 +15,7 @@ class LiberoNews(BasicNewsRecipe): description = 'Italian daily newspaper' #cover_url = 'http://www.liberoquotidiano.it/images/Libero%20Quotidiano.jpg' - cover_url = 'http://www.edicola.liberoquotidiano.it/vnlibero/fpcut.jsp?testata=milano' + cover_url = 'http://www.edicola.liberoquotidiano.it/vnlibero/fpcut.jsp?testata=milano' title = u'Libero ' publisher = 'EDITORIALE LIBERO s.r.l 2006' category = 'News, politics, culture, economy, general interest' diff --git a/recipes/sueddeutsche_mobil.recipe b/recipes/sueddeutsche_mobil.recipe index d1b08cbcba..7b1a9c4d8d 100644 --- a/recipes/sueddeutsche_mobil.recipe +++ b/recipes/sueddeutsche_mobil.recipe @@ -1,13 +1,16 @@ -# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai __license__ = 'GPL v3' -__copyright__ = '2012, Andreas Zeiser ' +__copyright__ = '2012, 2013 Andreas Zeiser ' ''' szmobil.sueddeutsche.de/ ''' +# History +# 2013.01.09 Fixed bugs in article titles containing "strong" and +# other small changes +# 2012.08.04 Initial release from calibre import strftime from calibre.web.feeds.recipes import BasicNewsRecipe -import re +import re class SZmobil(BasicNewsRecipe): title = u'Süddeutsche Zeitung mobil' @@ -26,6 +29,8 @@ class SZmobil(BasicNewsRecipe): delay = 1 cover_source = 'http://www.sueddeutsche.de/verlag' + # if you want to get rid of the date on the title page use + # timefmt = '' timefmt = ' [%a, %d %b, %Y]' root_url ='http://szmobil.sueddeutsche.de/' @@ -50,7 +55,7 @@ class SZmobil(BasicNewsRecipe): return browser - def parse_index(self): + def parse_index(self): # find all sections src = self.index_to_soup('http://szmobil.sueddeutsche.de') feeds = [] @@ -76,10 +81,10 @@ class SZmobil(BasicNewsRecipe): # first check if link is a special article in section "Meinungsseite" if itt.find('strong')!= None: article_name = itt.strong.string - article_shorttitle = itt.contents[1] + if len(itt.contents)>1: + shorttitles[article_id] = itt.contents[1] articles.append( (article_name, article_url, article_id) ) - shorttitles[article_id] = article_shorttitle continue @@ -89,7 +94,7 @@ class SZmobil(BasicNewsRecipe): else: article_name = itt.string - if (article_name[0:10] == " mehr"): + if (article_name.find(" mehr") == 0): # just another link ("mehr") to an article continue @@ -102,7 +107,9 @@ class SZmobil(BasicNewsRecipe): for article_name, article_url, article_id in articles: url = self.root_url + article_url title = article_name - pubdate = strftime('%a, %d %b') + # if you want to get rid of date for each article use + # pubdate = strftime('') + pubdate = strftime('[%a, %d %b]') description = '' if shorttitles.has_key(article_id): description = shorttitles[article_id] @@ -115,3 +122,4 @@ class SZmobil(BasicNewsRecipe): return all_articles +