| 1 |
#!/usr/bin/env python |
| 2 |
# vim:fileencoding=utf-8 |
| 3 |
from __future__ import absolute_import, division, print_function, unicode_literals |
| 4 |
|
| 5 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 6 |
|
| 7 |
|
| 8 |
class KleineZeitungRecipe(BasicNewsRecipe): |
| 9 |
__license__ = 'GPL v3' |
| 10 |
__author__ = 'kwetal' |
| 11 |
language = 'de_AT' |
| 12 |
version = 1 |
| 13 |
|
| 14 |
title = 'Kleine Zeitung' |
| 15 |
publisher = 'Kleine Zeitung GmbH & Co KG' |
| 16 |
category = 'News, Newspaper' |
| 17 |
description = 'Nachrichten aus \u00d6sterreich' |
| 18 |
|
| 19 |
use_embedded_content = False |
| 20 |
remove_empty_feeds = True |
| 21 |
oldest_article = 2 |
| 22 |
max_articles_per_feed = 100 |
| 23 |
|
| 24 |
no_stylesheets = True |
| 25 |
remove_javascript = True |
| 26 |
|
| 27 |
masthead_url = 'https://cdn-kl.niceshops.com/images/logos/logo_kleine_invoice.jpg' |
| 28 |
|
| 29 |
feeds = [ |
| 30 |
('Nachrichten', 'http://www.kleinezeitung.at/rss/nachrichten'), |
| 31 |
('Politik', 'http://www.kleinezeitung.at/rss/politik'), |
| 32 |
('Wirtschaft', 'http://www.kleinezeitung.at/rss/wirtschaft'), |
| 33 |
('Österreich und die Welt', 'http://www.kleinezeitung.at/rss/chronik'), |
| 34 |
('Leben', 'http://www.kleinezeitung.at/rss/leben'), |
| 35 |
('Sport', 'http://www.kleinezeitung.at/rss/sport'), |
| 36 |
# ('Ennstal', 'http://www.kleinezeitung.at/rss/rss_ennstal'), |
| 37 |
# ('Graz & Umgebung', 'http://www.kleinezeitung.at/rss/rss_graz'), |
| 38 |
# ('Leoben', 'http://www.kleinezeitung.at/rss/rss_leoben'), |
| 39 |
# ('Murtal', 'http://www.kleinezeitung.at/rss/rss_murtal'), |
| 40 |
# ('Mürztal', 'http://www.kleinezeitung.at/rss/rss_muerztal'), |
| 41 |
# ('Oststeier', 'http://www.kleinezeitung.at/rss/rss_oststeier'), |
| 42 |
# ('Süd & Südwest', 'http://www.kleinezeitung.at/rss/rss_suedsuedwest'), |
| 43 |
# ('Südost & Süd', 'http://www.kleinezeitung.at/rss/rss_sueostsued'), |
| 44 |
# ('Weiz', 'http://www.kleinezeitung.at/rss/rss_weiz'), |
| 45 |
# ('Weststeier', 'http://www.kleinezeitung.at/rss/rss_weststeier'), |
| 46 |
# ('Feldkirchen', 'http://www.kleinezeitung.at/rss/rss_feldkirchen'), |
| 47 |
# ('Klagenfurt', 'http://www.kleinezeitung.at/rss/rss_klagenfurt'), |
| 48 |
# ('Lavanttal', 'http://www.kleinezeitung.at/rss/rss_lavanttal'), |
| 49 |
# ('Oberkärnten', 'http://www.kleinezeitung.at/rss/rss_oberkaernten'), |
| 50 |
# ('Osttirol', 'http://www.kleinezeitung.at/rss/rss_osttirol'), |
| 51 |
# ('St. Veit', 'http://www.kleinezeitung.at/rss/rss_stveit'), |
| 52 |
# ('Villach', 'http://www.kleinezeitung.at/rss/rss_villach'), |
| 53 |
# ('Völkermarkt', 'http://www.kleinezeitung.at/rss/rss_voelkermarkt') |
| 54 |
] |
| 55 |
|
| 56 |
remove_tags_before = dict(attrs={'class': 'hline'}) |
| 57 |
remove_tags_after = [dict(name='div', attrs={'class': 'articletext'})] |
| 58 |
remove_tags = [dict(name='hr')] |
| 59 |
|
| 60 |
extra_css = ''' |
| 61 |
h1 {text-align: left;} |
| 62 |
''' |
| 63 |
|
| 64 |
def print_version(self, url): |
| 65 |
main, sep, id = url.rpartition('/') |
| 66 |
return main + '/print.do' |
| 67 |
|
| 68 |
def preprocess_html(self, soup): |
| 69 |
if soup.find('div', {'class': 'articletext'}) is None: |
| 70 |
self.abort_article() |
| 71 |
return soup |