from calibre.web.feeds.news import BasicNewsRecipe


class NewsandObserver(BasicNewsRecipe):
    title = u'Raleigh News & Observer'
    description = 'News from Raleigh, North Carolina'
    language = 'en'
    __author__ = 'Krittika Goyal updated by Walt Anthony'
    oldest_article = 3  # days
    max_articles_per_feed = 25
    summary_length = 150

    no_stylesheets = True
    remove_javascript = True

    remove_tags_before = dict(name='h1', attrs={'id': 'story_headline'})
    remove_tags_after = dict(name='div', attrs={'id': 'story_text_remaining'})

    remove_tags = [
        dict(name='iframe'),
        dict(name='div', attrs={'id': ['right-rail', 'story_tools', 'toolbox', 'toolbar',
                                       'tool', 'shirttail', 'comment_widget', 'story_keywords', 'txtResizeTool']}),
        dict(name='div', attrs={'class': ['Buy-It-Now', 'story_link_share']}),
        dict(name='ul', attrs={'class': 'bold_tabs_nav'}),

    ]

    feeds = [
        ('Cover', 'http://www.newsobserver.com/100/index.rss'),
        ('News', 'http://www.newsobserver.com/102/index.rss'),
        ('Politics', 'http://www.newsobserver.com/105/index.rss'),
        ('Business', 'http://www.newsobserver.com/104/index.rss'),
        ('Sports', 'http://www.newsobserver.com/103/index.rss'),
        ('College Sports', 'http://www.newsobserver.com/119/index.rss'),
        ('Lifestyles', 'http://www.newsobserver.com/106/index.rss'),
        ('Editorials', 'http://www.newsobserver.com/158/index.rss')
    ]
