#!/usr/bin/env python

__license__ = 'GPL v3'
'''
sciencenews.org
'''
from calibre.web.feeds.news import BasicNewsRecipe


class ScienceNewsIssue(BasicNewsRecipe):
    title = u'Science News Recent Issues'
    __author__ = u'Darko Miletic, Sujata Raman and Starson17'
    description           = u'''Science News is an award-winning weekly
    newsmagazine covering the most important research in all fields of science.
    Its 16 pages each week are packed with short, accurate articles that appeal
    to both general readers and scientists. Published since 1922, the magazine
    now reaches about 150,000 subscribers and more than 1 million readers.
    These are the latest News Items from Science News. This recipe downloads
    the last 30 days worth of articles.'''
    category = u'Science, Technology, News'
    publisher = u'Society for Science & the Public'
    oldest_article = 15
    language = 'en'
    max_articles_per_feed = 50
    no_stylesheets = True
    use_embedded_content = False
    timefmt = ' [%A, %d %B, %Y]'
    auto_cleanup = False

    keep_only_tags = [
        dict(attrs={'class': lambda x: x and (
            'single__content___' in x or 'header-default__title___' in x or
            'header-default__deck___' in x or 'header-default__figure___' in x
        )})
    ]
    remove_tags = [
        dict(attrs={'class': lambda x: x and (
            'newsletter-signup__wrapper___' in x
        )})
    ]

    feeds = [(u"Science News Headlines",
              u'https://www.sciencenews.org/feed')]
