# -*- coding: utf-8 -*-
__license__ = 'GPL v3'
__copyright__ = '2011 Aurélien Chabot <contact@aurelienchabot.fr>'
'''
20minutes.fr
'''
from calibre.web.feeds.recipes import BasicNewsRecipe


class Minutes(BasicNewsRecipe):

    title = '20 minutes'
    __author__ = u'Aurélien Chabot'
    description = 'Actualités'
    encoding = 'utf-8'
    publisher = '20minutes.fr'
    category = 'Actualités, France, Monde'
    language = 'fr'

    use_embedded_content = False
    timefmt = ' [%d %b %Y]'
    max_articles_per_feed = 15
    no_stylesheets = True
    remove_empty_feeds = True

    keep_only_tags = [
        dict(name='h1'),
        dict(attrs={'class': lambda x: x and 'lt-content' in x.split()}),
    ]
    remove_tags = [
        dict(attrs={'class': lambda x: x and 'content-related' in x.split()}),
    ]
    remove_tags_after = dict(id='ob_holder')

    feeds = [
        ('France', 'http://www.20minutes.fr/rss/actu-france.xml'),
        ('International', 'http://www.20minutes.fr/rss/monde.xml'),
        ('Tech/Web', 'http://www.20minutes.fr/rss/hightech.xml'),
        ('Sciences', 'http://www.20minutes.fr/rss/sciences.xml'),
        ('Economie', 'http://www.20minutes.fr/rss/economie.xml'),
        ('Politique', 'http://www.20minutes.fr/rss/politique.xml'),
        (u'Médias', 'http://www.20minutes.fr/rss/media.xml'),
        ('Cinema', 'http://www.20minutes.fr/rss/cinema.xml'),
        ('People', 'http://www.20minutes.fr/rss/people.xml'),
        ('Culture', 'http://www.20minutes.fr/rss/culture.xml'),
        ('Sport', 'http://www.20minutes.fr/rss/sport.xml'),
        ('Paris', 'http://www.20minutes.fr/rss/paris.xml'),
        ('Lyon', 'http://www.20minutes.fr/rss/lyon.xml'),
        ('Toulouse', 'http://www.20minutes.fr/rss/toulouse.xml')
    ]
