Update science_news.recipe

* This is a bi-weekly magazine, so get last 14 days of articles.
* Download latest cover of magazine.
This commit is contained in:
yodha8 2022-04-30 23:07:19 -07:00 committed by GitHub
parent e3d9288bf1
commit b49064d6b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,22 +4,19 @@ __license__ = 'GPL v3'
''' '''
sciencenews.org sciencenews.org
''' '''
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.web.feeds.news import BasicNewsRecipe
import datetime
class ScienceNewsIssue(BasicNewsRecipe): class ScienceNewsIssue(BasicNewsRecipe):
title = u'Science News Recent Issues' title = u'Science News'
__author__ = u'Darko Miletic, Sujata Raman and Starson17' __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. newsmagazine covering the most important research in all fields of science.
Its 16 pages each week are packed with short, accurate articles that appeal This recipe downloads the last 2 weeks of articles.'''
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' category = u'Science, Technology, News'
publisher = u'Society for Science & the Public' publisher = u'Society for Science & the Public'
oldest_article = 15 oldest_article = 14
language = 'en' language = 'en'
max_articles_per_feed = 50 max_articles_per_feed = 50
no_stylesheets = True no_stylesheets = True
@ -39,5 +36,14 @@ class ScienceNewsIssue(BasicNewsRecipe):
)}) )})
] ]
feeds = [(u"Science News Headlines", feeds = [(u"Articles", u'https://www.sciencenews.org/feed')]
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