__license__ = 'GPL v3'
__copyright__ = '2010, Walt Anthony <workshop.northpole at gmail.com>'
'''
www.hotair.com
'''

from calibre.web.feeds.news import BasicNewsRecipe


def classes(classes):
    q = frozenset(classes.split(' '))
    return dict(attrs={
        'class': lambda x: x and frozenset(x.split()).intersection(q)})


class hotair(BasicNewsRecipe):
    title = u'Hot Air'
    __author__ = 'Walt Anthony'
    description = "The world's first, full-service conservative Internet broadcast network"
    publisher = 'Hot Air'
    category = 'news, politics, USA'
    oldest_article = 3
    max_articles_per_feed = 100
    summary_length = 150
    language = 'en'
    encoding = 'utf-8'
    use_embedded_content = False
    remove_javascript = True

    conversion_options = {
        'comment': description, 'tags': category, 'publisher': publisher, 'language': language
    }

    keep_only_tags = [
            dict(name='h1'),
            classes('byline article-image article-text'),
    ]

    remove_tags = [dict(name=['iframe', 'small', 'embed', 'button',
                              'object', 'link', 'script', 'form'])]

    feeds = [
        ('Hot Air', 'http://feeds.feedburner.com/hotair/main'),
        ('The Greenroom', 'http://feeds2.feedburner.com/hotair/greenroom')
    ]
