Update Sueddeutsche Zeitung mobil

This commit is contained in:
Kovid Goyal 2013-01-11 10:19:24 +05:30
parent 1110ec56ee
commit 9997d3ad2c
2 changed files with 17 additions and 9 deletions

View File

@ -1,9 +1,12 @@
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2012, Andreas Zeiser <andreas.zeiser@web.de>'
__copyright__ = '2012, 2013 Andreas Zeiser <andreas.zeiser@web.de>'
'''
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
@ -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/'
@ -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] == "&nbsp;mehr"):
if (article_name.find("&nbsp;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