#!/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 = u'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 = [
        (u'Prima Pagina', u'http://rss.adnkronos.com/RSS_PrimaPagina.xml'),
        (u'Ultima Ora', u'http://rss.adnkronos.com/RSS_Ultimora.xml'),
        (u'Politica', u'http://rss.adnkronos.com/RSS_Politica.xml'),
        (u'Esteri', u'http://rss.adnkronos.com/RSS_Esteri.xml'),
        (u'Cronoca', u'http://rss.adnkronos.com/RSS_Cronaca.xml'),
        (u'Economia', u'http://rss.adnkronos.com/RSS_Economia.xml'),
        (u'Finanza', u'http://rss.adnkronos.com/RSS_Finanza.xml'),
        (u'CyberNews', u'http://rss.adnkronos.com/RSS_CyberNews.xml'),
        (u'Spettacolo', u'http://rss.adnkronos.com/RSS_Spettacolo.xml'),
        (u'Cultura', u'http://rss.adnkronos.com/RSS_Cultura.xml'),
        (u'Sport', u'http://rss.adnkronos.com/RSS_Sport.xml'),
        (u'Sostenibilita', u'http://rss.adnkronos.com/RSS_Sostenibilita.xml'),
        (u'Salute', u'http://rss.adnkronos.com/RSS_Salute.xml')
    ]
