View Single Post
Old 12-13-2011, 03:02 PM   #2
a.peter
Enthusiast
a.peter began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Sep 2011
Device: Sony PRS-350, Kindle Touch
Version 4 of the recipe

Since the Berliner Zeitung has changed its web pages, a new RSS based recipe was needed. Here it is.

Spoiler:

Code:
from calibre.web.feeds.recipes import BasicNewsRecipe

'''Calibre recipe to convert the RSS feeds of the Berliner Zeitung to an ebook.'''

class SportsIllustratedRecipe(BasicNewsRecipe) :
    __author__    = 'a.peter'
    __copyright__ = 'a.peter'
    __license__   = 'GPL v3'
    language      = 'de'
    description   = 'Berliner Zeitung RSS'
    version       = 4
    title         = u'Berliner Zeitung RSS'
    timefmt       = ' [%d.%m.%Y]' 

    #oldest_article = 7.0
    no_stylesheets = True
    remove_javascript = True
    use_embedded_content = False
    publication_type = 'newspaper'
    
    remove_tags_before = dict(name='div', attrs={'class':'newstype'})
    remove_tags_after = [dict(id='article_text')]
    
    feeds = [(u'Startseite', u'http://www.berliner-zeitung.de/home/10808950,10808950,view,asFeed.xml'), 
             (u'Politik', u'http://www.berliner-zeitung.de/home/10808018,10808018,view,asFeed.xml'), 
             (u'Wirtschaft', u'http://www.berliner-zeitung.de/home/10808230,10808230,view,asFeed.xml'), 
             (u'Berlin', u'http://www.berliner-zeitung.de/home/10809148,10809148,view,asFeed.xml'), 
             (u'Brandenburg', u'http://www.berliner-zeitung.de/home/10809312,10809312,view,asFeed.xml'), 
             (u'Wissenschaft', u'http://www.berliner-zeitung.de/home/10808894,10808894,view,asFeed.xml'), 
             (u'Digital', u'http://www.berliner-zeitung.de/home/10808718,10808718,view,asFeed.xml'), 
             (u'Kultur', u'http://www.berliner-zeitung.de/home/10809150,10809150,view,asFeed.xml'), 
             (u'Panorama', u'http://www.berliner-zeitung.de/home/10808334,10808334,view,asFeed.xml'), 
             (u'Sport', u'http://www.berliner-zeitung.de/home/10808794,10808794,view,asFeed.xml'), 
             (u'Hertha', u'http://www.berliner-zeitung.de/home/10808800,10808800,view,asFeed.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')
a.peter is offline   Reply With Quote