Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 12-30-2010, 05:45 PM   #1
tfeld
Junior Member
tfeld began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2010
Device: PRS650
Post Recipe for KA-News.de

Find attached the recipe for a german regional news site of the city of Karlsruhe, Germany.

Code:
import re

class KANewsRecipe(BasicNewsRecipe):
    title = u'KA-News.de'
    description = u'Nachrichten aus Karlsruhe, Deutschland und der Welt.'
    lang='de'
    no_stylesheets = True

    oldest_article = 7
    max_articles_per_feed = 100

    feeds = [
                (u'News aus Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/karlsruhe.xml'),
                (u'Kulturnachrichten aus Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/kultur.xml'),
                (u'Durlach: News aus Durlach', 'http://www.ka-news.de/storage/rss/rss/durlach.xml'),
                (u'Stutensee: News aus Stutensee Blankenloch, Büchig, Friedrichstal, Staffort, Spöck', 'http://www.ka-news.de/storage/rss/rss/stutensee.xml'),
                (u'Bruchsal: News aus Bruchsal', 'http://www.ka-news.de/storage/rss/rss/bruchsal.xml'),
                (u'Wirtschaftsnews aus Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/wirtschaft.xml'),
                (u'ka-news.de - Sport', 'http://www.ka-news.de/storage/rss/rss/sport.xml'),
                (u'KSC-News - News rund um den KSC', 'http://www.ka-news.de/storage/rss/rss/ksc.xml'),
                (u'ka-news.de - BG Karlsruhe', 'http://www.ka-news.de/storage/rss/rss/basketball.xml')
            ]

    preprocess_regexps = [
        (re.compile(r'width:[0-9]*?px', re.DOTALL|re.IGNORECASE), lambda match: ''),
    ]

    remove_tags_before = dict(id='artdetail_ueberschrift')
    remove_tags_after = dict(id='artdetail_unterzeile')
    remove_tags = [dict(name=['div'], attrs={'class': 'lbx_table'}),
         dict(name=['div'], attrs={'class': 'lk_zumthema'}),
         dict(name=['div'], attrs={'class': 'lk_thumb'}),
         dict(name=['div'], attrs={'class': 'lk_trenner'}),
         dict(name=['div'], attrs={'class': 'lupen_container'}),
         dict(name=['script']),
         dict(name=['span'], attrs={'style': 'display:none;'}),
         dict(name=['span'], attrs={'class': 'comm_info'}),
         dict(name=['h3'], attrs={'id': 'artdetail_unterzeile'})]

    # removing style attribute _after_ removing specifig tags above
    remove_attributes = ['width','height','style']

    extra_css = '''
         h1{ font-size:large; font-weight:bold;  }
         h2{ font-size:medium; font-weight:bold; }
    '''

    def get_cover_url(self):
        return 'http://www.ka-news.de/storage/scl/techkanews/logos/434447_m1t1w250q75s1v29681_ka-news-Logo_mit_Schatten_transparent.png'
tfeld is offline   Reply With Quote
Reply

Tags
ka-news.de, recipe

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Daily News Recipe mean_gene Recipes 0 12-27-2010 12:07 PM
Customise News Recipe goaspy Calibre 5 12-08-2010 03:08 PM
Help with news recipe Acey Calibre 2 03-12-2010 06:36 AM
News recipe sorting OzAz Calibre 3 10-30-2009 06:28 PM
The Times news recipe? AprilHare Calibre 1 10-10-2008 01:48 PM


All times are GMT -4. The time now is 04:04 AM.


MobileRead.com is a privately owned, operated and funded community.