Update Berliner Zeitung and Tagesspiegel

This commit is contained in:
Kovid Goyal 2016-04-25 07:15:17 +05:30
parent a0acc5362a
commit 417cf783a9
2 changed files with 51 additions and 65 deletions

View File

@ -1,44 +1,46 @@
#!/usr/bin/env python2
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import (unicode_literals, division, absolute_import,
print_function)
from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.web.feeds.recipes import BasicNewsRecipe
'''Calibre recipe to convert the RSS feeds of the Berliner Zeitung to an ebook.''' def classes(classes):
q = frozenset(classes.split(' '))
return dict(attrs={'class':lambda x:x and frozenset(x.split()).intersection(q)})
class SportsIllustratedRecipe(BasicNewsRecipe) : class BerlinerZeitung(BasicNewsRecipe) :
__author__ = 'a.peter' title = 'Berliner Zeitung'
__copyright__ = 'a.peter' __author__ = 'Kovid Goyal'
__license__ = 'GPL v3'
language = 'de' language = 'de'
description = 'Berliner Zeitung RSS' description = 'Berliner Zeitung RSS'
version = 4
title = u'Berliner Zeitung'
timefmt = ' [%d.%m.%Y]' timefmt = ' [%d.%m.%Y]'
ignore_duplicate_articles = {'title', 'url'}
remove_empty_feeds = True
#oldest_article = 7.0 # oldest_article = 7.0
no_stylesheets = True no_stylesheets = True
remove_javascript = True remove_javascript = True
use_embedded_content = False use_embedded_content = False
publication_type = 'newspaper' publication_type = 'newspaper'
remove_tags_before = dict(name='div', attrs={'class':'newstype'}) keep_only_tags = [
remove_tags_after = [dict(id='article_text')] classes('dm_article_body dm_article_header'),
]
remove_tags = [
classes('dm_article_share'),
]
feeds = [(u'Startseite', u'http://www.berliner-zeitung.de/home/10808950,10808950,view,asFeed.xml'), feeds = [x.split() for x in [
(u'Politik', u'http://www.berliner-zeitung.de/home/10808018,10808018,view,asFeed.xml'), 'Berlin http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23699382-asYahooFeed.xml',
(u'Wirtschaft', u'http://www.berliner-zeitung.de/home/10808230,10808230,view,asFeed.xml'), 'Brandenburg http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23699570-asYahooFeed.xml',
(u'Berlin', u'http://www.berliner-zeitung.de/home/10809148,10809148,view,asFeed.xml'), 'Politik http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23699614-asYahooFeed.xml',
(u'Brandenburg', u'http://www.berliner-zeitung.de/home/10809312,10809312,view,asFeed.xml'), 'Wirtschaft http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23699644-asYahooFeed.xml',
(u'Wissenschaft', u'http://www.berliner-zeitung.de/home/10808894,10808894,view,asFeed.xml'), 'Sport http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23699874-asYahooFeed.xml',
(u'Digital', u'http://www.berliner-zeitung.de/home/10808718,10808718,view,asFeed.xml'), 'Kultur http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23700020-asYahooFeed.xml',
(u'Kultur', u'http://www.berliner-zeitung.de/home/10809150,10809150,view,asFeed.xml'), 'Panorama http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23700178-asYahooFeed.xml',
(u'Panorama', u'http://www.berliner-zeitung.de/home/10808334,10808334,view,asFeed.xml'), 'Wissen http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23700222-asYahooFeed.xml',
(u'Sport', u'http://www.berliner-zeitung.de/home/10808794,10808794,view,asFeed.xml'), 'Digital http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23700594-asYahooFeed.xml',
(u'Hertha', u'http://www.berliner-zeitung.de/home/10808800,10808800,view,asFeed.xml'), 'Ratgeber http://www.berliner-zeitung.de/blueprint/servlet/xml/berliner-zeitung/23700190-asYahooFeed.xml',
(u'Union', u'http://www.berliner-zeitung.de/home/10808802,10808802,view,asFeed.xml'), ]]
(u'Verkehr', u'http://www.berliner-zeitung.de/home/10809298,10809298,view,asFeed.xml'),
(u'Polizei', u'http://www.berliner-zeitung.de/home/10809296,10809296,view,asFeed.xml'),
(u'Meinung', u'http://www.berliner-zeitung.de/home/10808020,10808020,view,asFeed.xml')]
def get_masthead_url(self):
return 'http://www.berliner-zeitung.de/image/view/10810244,7040611,data,logo.png'
def print_version(self, url):
return url.replace('.html', ',view,printVersion.html')

View File

@ -1,34 +1,33 @@
from calibre.web.feeds.news import BasicNewsRecipe #!/usr/bin/env python2
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import (unicode_literals, division, absolute_import,
print_function)
from calibre.web.feeds.recipes import BasicNewsRecipe
def classes(classes):
q = frozenset(classes.split(' '))
return dict(attrs={'class':lambda x:x and frozenset(x.split()).intersection(q)})
class TagesspiegelRss(BasicNewsRecipe): class TagesspiegelRss(BasicNewsRecipe):
title = u'Der Tagesspiegel' title = 'Der Tagesspiegel'
__author__ = 'Kovid Goyal'
oldest_article = 1 oldest_article = 1
max_articles_per_feed = 100 max_articles_per_feed = 100
language = 'de' language = 'de'
publication_type = 'newspaper' publication_type = 'newspaper'
auto_cleanup = True
no_stylesheets = True no_stylesheets = True
remove_stylesheets = True remove_stylesheets = True
remove_javascript = True remove_javascript = True
remove_empty_feeds = True
encoding = 'utf-8' encoding = 'utf-8'
use_embedded_content = False use_embedded_content = False
ignore_duplicate_articles = {'title', 'url'}
remove_empty_feeds = True
extra_css = ''' keep_only_tags = [
.hcf-overline{color:#990000; font-family:Arial,Helvetica,sans-serif;font-size:xx-small;display:block} classes('ts-lead ts-article-body ts-intro ts-title ts-authors')
.hcf-teaser{font-family:Verdana,Arial,Helvetica;font-size:x-small;margin-top:0} ]
h1{font-family:Arial,Helvetica,sans-serif;font-size:large;clear:right;}
.hcf-caption{color:#666666; font-family:Arial,Helvetica,sans-serif;font-size:xx-small;}
.hcf-copyright{color:#666666; font-family:Arial,Helvetica,sans-serif;font-size:xx-small;}
.hcf-article{font-family:Arial,Helvetica;font-size:x-small}
.quote{font-family:Georgia,Palatino,Palatino Linotype,FreeSerif,serif;font-size:x-small}
.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;}
'''
remove_tags = [{'class':'hcf-header'}, {'class':'hcf-atlas'}, {'class':'hcf-colon'}, {'class':'hcf-date hcf-separate'}]
feeds = [ feeds = [
(u'Politik', u'http://www.tagesspiegel.de/contentexport/feed/politik'), (u'Politik', u'http://www.tagesspiegel.de/contentexport/feed/politik'),
@ -42,20 +41,5 @@ class TagesspiegelRss(BasicNewsRecipe):
(u'Wissen', u'http://www.tagesspiegel.de/contentexport/feed/wissen') (u'Wissen', u'http://www.tagesspiegel.de/contentexport/feed/wissen')
] ]
def print_version(self, url):
# print url
u = url.find('0L0Stagesspiegel0Bde')
u = 'http://www.tagesspiegel.de' + url[u + 20:]
u = u.replace('0C', '/')
u = u.replace('0E', '-')
u = u.replace('A', '')
u = u.replace('0B', '.')
u = u.replace('.html/story01.htm', '.html')
url = u.split('/')
url[-1] = 'v_print,%s?p='%url[-1]
u = '/'.join(url)
# print u
return u
def get_masthead_url(self): def get_masthead_url(self):
return 'http://www.tagesspiegel.de/images/tsp_logo/3114/6.png' return 'http://www.tagesspiegel.de/images/tsp_logo/3114/6.png'