#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2012, faber1971'
__version__ = 'v1.00'
__date__ = '16, April 2012'
__description__ = 'Geopolitical Italian magazine'


from calibre.web.feeds.news import BasicNewsRecipe


class Limes(BasicNewsRecipe):
    description = 'Italian weekly magazine'
    __author__ = 'faber1971'

    cover_url = 'http://temi.repubblica.it/UserFiles/limes/Image/Loghi/logo-limes.gif'
    title = 'Limes'
    category = 'Geopolitical news'

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

    oldest_article = 16
    max_articles_per_feed = 100
    use_embedded_content = False
    recursion = 10

    remove_javascript = True
    no_stylesheets = True
    masthead_url = 'http://temi.repubblica.it/UserFiles/limes/Image/Loghi/logo-limes.gif'

    feeds = [
        (u'Limes', u'http://temi.repubblica.it/limes/feed/')
    ]

    keep_only_tags = [
        dict(name='div', attrs={'class': ['testo', 'copertina', 'occhiello', 'firma', 'didascalia',
                                          'content-second-right', 'detail-articles', 'titolo-local', 'generic-articles']}),
        dict(name='div', attrs={
             'class': ['generic-articles', 'summary', 'detail-articles']}),
        dict(name='div', attrs={'id': ['content-second-right', 'content2']})
    ]

    remove_tags = [
        dict(name='div', attrs={'class': ['servizi', 'aggiungi', 'label-web',
                                          'bottom-mobile', 'box-abbonamenti', 'box-cerca', 'big', 'little', 'stampaweb']}),
        dict(name='div', attrs={'id': [
             'topheader', 'header', 'navigation-new', 'navigation', 'content-second-left', 'menutext']}),
        dict(name='ul', attrs={'id': 'user-utility'}),
        dict(name=['script', 'noscript', 'iframe'])
    ]
