#!/usr/bin/env python

__license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
'''
dn.se
'''
from calibre.web.feeds.news import BasicNewsRecipe


class DN_se(BasicNewsRecipe):
    title = 'Dagens Nyheter'
    __author__ = 'Darko Miletic'
    description = 'News from Sweden'
    publisher = 'Dagens Nyheter'
    category = 'news, politics, Sveden'
    oldest_article = 2
    delay = 1
    max_articles_per_feed = 100
    no_stylesheets = True
    use_embedded_content = False
    encoding = 'utf-8'
    language = 'sv'

    conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language}

    feeds = [
        ('Nyheter', 'https://www.dn.se/m/rss/toppnyheter'),
        ('Ekonomi', 'https://www.dn.se/ekonomi-rss'),
        ('Sport', 'https://www.dn.se/sport-rss'),
        ('Debatt', 'https://www.dn.se/debatt-rss'),
        ('Ledare', 'https://www.dn.se/ledare-rss'),
        ('Kultur', 'https://www.dn.se/kultur-rss'),
    ]

    keep_only_tags = [dict(name='div', attrs={'id': 'article-content'})]
    remove_tags_before = dict(name='h1')
    remove_tags_after = dict(name='div', attrs={'id': 'byline'})
    remove_tags = [dict(name=['object', 'link', 'base']), dict(name='div', attrs={'id': 'hook'})]
