mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
IEEE Spectrum Magazine by yodha8
Merge branch 'master' of https://github.com/yodha8/calibre
This commit is contained in:
commit
3f9d52c32b
34
recipes/ieee_spectrum_mag.recipe
Normal file
34
recipes/ieee_spectrum_mag.recipe
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim:fileencoding=utf-8
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
|
class IEEESpectrumMagazine(BasicNewsRecipe):
|
||||||
|
title = "IEEE Spectrum Magazine"
|
||||||
|
lang = 'en'
|
||||||
|
__author__ = 'yodha8'
|
||||||
|
description = "Published on day 1 of every month."
|
||||||
|
oldest_article = 120 # Mag gathers articles published older than a month online. So we scan for 4 months in the feed.
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
auto_cleanup = True
|
||||||
|
|
||||||
|
# RSS feed for the current month
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
year_month = now.strftime("%Y/%B").lower()
|
||||||
|
month_feed_url = "https://spectrum.ieee.org/feeds/magazine/{}.rss".format(
|
||||||
|
year_month
|
||||||
|
)
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
('IEEE Spectrum Magazine', month_feed_url),
|
||||||
|
]
|
||||||
|
|
||||||
|
def get_cover_url(self):
|
||||||
|
"""Go to this month's URL and pull cover image from there."""
|
||||||
|
month_url = "https://spectrum.ieee.org/magazine/{}".format(self.year_month)
|
||||||
|
soup = self.index_to_soup(month_url)
|
||||||
|
img_meta = soup.find("meta", property="og:image")
|
||||||
|
img_url = img_meta["content"]
|
||||||
|
return img_url
|
Loading…
x
Reference in New Issue
Block a user