__license__ = 'GPL v3'
__copyright__ = '2014, Darko Miletic <darko.miletic at gmail.com>'
'''
www.wired.com
'''

from calibre.web.feeds.news import BasicNewsRecipe


class WiredDailyNews(BasicNewsRecipe):
    title = 'Wired Daily Edition'
    __author__ = 'Darko Miletic'
    description = ('Wired is a full-color monthly American magazine, published in both print '
                   'and online editions, that reports on how emerging technologies affect culture,'
                   'the economy and politics.')
    publisher = 'Conde Nast'
    category = 'news, IT, computers, technology'
    oldest_article = 2
    max_articles_per_feed = 200
    no_stylesheets = True
    encoding = 'utf-8'
    use_embedded_content = False
    language = 'en'
    ignore_duplicate_articles = {'url'}
    remove_empty_feeds = True
    publication_type = 'newsportal'
    extra_css             = """
                            .entry-header{
                                          text-transform: uppercase;
                                          vertical-align: baseline;
                                          display: inline;
                                         }
                            ul li{display: inline}
                            """

    remove_tags = [
        dict(name=['meta', 'link']),
        dict(name='div', attrs={'class': 'podcast_storyboard'}),
        dict(id=['sharing', 'social', 'article-tags', 'sidebar']),
    ]
    keep_only_tags = [
        dict(attrs={'data-js': ['post', 'postHeader']}),
    ]

    feeds = [
    (u'Top Stories', u'https://www.wired.com/feed/'),
    (u'Business', u'https://www.wired.com/category/business/feed/'),
    (u'Design', u'https://www.wired.com/category/design/feed/'),
    (u'Entertainment', u'https://www.wired.com/category/underwire/feed/'),
    (u'Tech', u'https://www.wired.com/category/gear/feed/'),
    (u'Product Reviews', u'https://www.wired.com/category/reviews/feed/'),
    (u'Science', u'https://www.wired.com/category/science/feed/'),
    (u'Science Blogs', u'https://www.wired.com/category/science/science-blogs/feed/'),
    (u'Security', u'https://www.wired.com/category/security/feed/'),
    (u'Transportation', u'https://www.wired.com/category/transportation/feed/'),
    (u'Photo', u'https://www.wired.com/category/photo/feed/'),
    ]

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