from calibre.web.feeds.news import BasicNewsRecipe


class AdvancedUserRecipe1305470859(BasicNewsRecipe):
    title = 'Impulse.de'
    language = 'de'
    __author__ = 'schuster'
    oldest_article = 14
    max_articles_per_feed = 100
    no_stylesheets = True
    remove_javascript = True
    use_embedded_content = False
    cover_url = 'http://www.bvk.de/files/image/bilder/Logo%20Impulse.jpg'

    extra_css = '''
                    h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
                    h4{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
                    img {min-width:300px; max-width:600px; min-height:300px; max-height:800px}
                    p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
    '''

    def print_version(self, url):
        return url.replace('#utm_source=rss2&utm_medium=rss_feed&utm_campaign=/', '?mode=print')

    remove_tags_bevor = [dict(name='h1', attrs={'class': 'h2'})]
    remove_tags_after = [dict(name='div', attrs={'class': 'artikelfuss'})]

    feeds = [('impulstest', 'http://www.impulse.de/rss/')]

    remove_tags = [
        dict(attrs={'class': ['navSeitenAlle', 'kommentieren', 'teaserheader', 'teasercontent', 'info', 'zwischenhead', 'kasten_artikel']}),
        dict(
            id=['metaNav', 'impKopf', 'impTopNav', 'impSubNav', 'footerRahmen', 'gatrixx_marktinformationen', 'pager', 'weitere', 'socialmedia', 'rating_open']
        ),
        dict(span=['ratingtext', 'Gesamtranking', 'h3', '']),
        dict(rel=['canonical']),
    ]
