#!/usr/bin/env python
# vim:fileencoding=utf-8
from calibre.web.feeds.news import BasicNewsRecipe


class SalzburgerNachrichten(BasicNewsRecipe):
    title = 'Salzburger Nachrichten'
    __author__ = 'İlker Melik Sıtkı'
    oldest_article = 1
    max_articles_per_feed = 10
    language = 'de_AT'
    remove_javascript = True
    no_stylesheets = True
    remove_empty_feeds = True
    compress_news_images = True
    ignore_duplicate_articles = {'url'}
    cover_url = 'https://front.e-pages.dk/data/teasers/salzburgernachrichten/308/vector/ts1.jpg'

    extra_css = '''.article-title {font-size: 1.5em; color: #0358a9;}
                   h2 {font-size: 1.2em; color: #0358a9;}'''

    keep_only_tags = [
        dict(name='h1', attrs={'class': 'article-title'}),
        dict(name='div', attrs={'class': 'article-author'}),
        dict(name='div', attrs={'class': 'article-publication-date'}),
        dict(name='div', attrs={'class': 'media-normal'}),
        dict(name='div', attrs={'class': 'article-body-text'}),
        dict(name='div', attrs={'class': 'article-sections'}),
    ]

    remove_tags = [
        dict(name='source'),
        dict(name='figcaption'),
        dict(name='img', attrs={'class': 'article-author__logo'}),
        dict(name='p', attrs={'class': 'article-author__desktopprefix'}),
    ]

    feeds = [
        ('Salzburg', 'https://www.sn.at/salzburg/xml/rss'),
        ('Innenpolitik', 'https://www.sn.at/politik/innenpolitik/xml/rss'),
        ('Weltpolitik', 'https://www.sn.at/politik/weltpolitik/xml/rss'),
        ('Wirtschaft', 'https://www.sn.at/wirtschaft/xml/rss'),
        ('Kultur', 'https://www.sn.at/kultur/xml/rss'),
        ('Leben', 'https://www.sn.at/leben/xml/rss'),
        ('Wetter', 'https://www.sn.at/wetter/xml/rss'),
        ('Festspiele', 'https://www.sn.at/festspiele/xml/rss'),
        ('Sport', 'https://www.sn.at/sport/xml/rss'),
        ('Panorama', 'https://www.sn.at/panorama/xml/rss'),
        ('Wissen', 'https://www.sn.at/wissen/xml/rss'),
        ('Wochenende', 'https://www.sn.at/panorama/wissen/xml/rss'),
        ('Kinderseite', 'https://www.sn.at/panorama/kinder/xml/rss'),
        ('Jengeseite', 'https://www.sn.at/jungeseite/xml/rss'),
        ('SNin', 'https://www.sn.at/snin/xml/rss'),
        ('Chronik Österreich', 'https://www.sn.at/panorama/oesterreich/xml/rss'),
        ('Chronik International', 'https://www.sn.at/panorama/international/xml/rss'),
        ('Medien', 'https://www.sn.at/panorama/medien/xml/rss'),
        ('Briefe an die SN', 'https://www.sn.at/leserforum/xml/rss'),
        ('Veranstaltungen', 'https://www.sn.at/veranstaltungen/xml/rss'),
        ('Klimawandel', 'https://www.sn.at/panorama/klimawandel/xml/rss'),
    ]
