From b49064d6b6adb19304baaa04d8184e61658be0e2 Mon Sep 17 00:00:00 2001 From: yodha8 <104330897+yodha8@users.noreply.github.com> Date: Sat, 30 Apr 2022 23:07:19 -0700 Subject: [PATCH] Update science_news.recipe * This is a bi-weekly magazine, so get last 14 days of articles. * Download latest cover of magazine. --- recipes/science_news.recipe | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/recipes/science_news.recipe b/recipes/science_news.recipe index dd594d8c4a..c91c8a0928 100644 --- a/recipes/science_news.recipe +++ b/recipes/science_news.recipe @@ -4,22 +4,19 @@ __license__ = 'GPL v3' ''' sciencenews.org ''' -from calibre.web.feeds.news import BasicNewsRecipe +from calibre.web.feeds.news import BasicNewsRecipe +import datetime class ScienceNewsIssue(BasicNewsRecipe): - title = u'Science News Recent Issues' + title = u'Science News' __author__ = u'Darko Miletic, Sujata Raman and Starson17' - description = u'''Science News is an award-winning weekly + description = u'''Science News is an award-winning bi-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.''' + This recipe downloads the last 2 weeks of articles.''' category = u'Science, Technology, News' publisher = u'Society for Science & the Public' - oldest_article = 15 + oldest_article = 14 language = 'en' max_articles_per_feed = 50 no_stylesheets = True @@ -39,5 +36,14 @@ class ScienceNewsIssue(BasicNewsRecipe): )}) ] - feeds = [(u"Science News Headlines", - u'https://www.sciencenews.org/feed')] + feeds = [(u"Articles", u'https://www.sciencenews.org/feed')] + + def get_cover_url(self): + d = datetime.date(2022, 3, 26) + t = datetime.date.today() + ld = None + while d <= t: + ld = d + d += datetime.timedelta(days=14) + url = ld.strftime("https://www.sciencenews.org/wp-content/uploads/%Y/%m/%m%d%y_cover.jpg") + return url