#!/usr/bin/env python
__license__ = 'GPL v3'
__author__ = 'Gabriele Marini, based on Darko Miletic'
__copyright__ = '2009-2010, Darko Miletic <darko.miletic at gmail.com>'
description = 'Italian daily newspaper - 02-05-2010'

'''
http://www.adnkronos.com/
'''

from calibre.web.feeds.news import BasicNewsRecipe


class Adnkronos(BasicNewsRecipe):
    __author__ = 'Gabriele Marini'
    description = 'News agency'
    cover_url = 'http://www.adnkronos.com/IGN6/img/popup_ign.jpg'
    title = 'Adnkronos'
    publisher = 'Adnkronos Group - ews agency'
    category = 'News, politics, culture, economy, general interest'

    language = 'it'
    timefmt = '[%a, %d %b, %Y]'

    oldest_article = 7
    max_articles_per_feed = 80
    use_embedded_content = False
    recursion = 10

    remove_javascript = True

    def get_article_url(self, article):
        link = article.get('id', article.get('guid', None))
        return link

    extra_css = ' .newsAbstract{font-style: italic} '
    keep_only_tags = [dict(name='div', attrs={'class': ['breadCrumbs', 'newsTop', 'newsText']})]

    remove_tags = [dict(name='div', attrs={'class': ['leogoo', 'leogoo2']})]

    feeds = [
        ('Prima Pagina', 'http://rss.adnkronos.com/RSS_PrimaPagina.xml'),
        ('Ultima Ora', 'http://rss.adnkronos.com/RSS_Ultimora.xml'),
        ('Politica', 'http://rss.adnkronos.com/RSS_Politica.xml'),
        ('Esteri', 'http://rss.adnkronos.com/RSS_Esteri.xml'),
        ('Cronoca', 'http://rss.adnkronos.com/RSS_Cronaca.xml'),
        ('Economia', 'http://rss.adnkronos.com/RSS_Economia.xml'),
        ('Finanza', 'http://rss.adnkronos.com/RSS_Finanza.xml'),
        ('CyberNews', 'http://rss.adnkronos.com/RSS_CyberNews.xml'),
        ('Spettacolo', 'http://rss.adnkronos.com/RSS_Spettacolo.xml'),
        ('Cultura', 'http://rss.adnkronos.com/RSS_Cultura.xml'),
        ('Sport', 'http://rss.adnkronos.com/RSS_Sport.xml'),
        ('Sostenibilita', 'http://rss.adnkronos.com/RSS_Sostenibilita.xml'),
        ('Salute', 'http://rss.adnkronos.com/RSS_Salute.xml'),
    ]
