Debian Codegraph @

recipes/cacm.recipe

raw
1 #!/usr/bin/env python
2 # vim:fileencoding=utf-8
3
4 from calibre.web.feeds.news import BasicNewsRecipe
5
6
7 class CACM(BasicNewsRecipe):
8 title = 'ACM CACM Magazine'
9 description = 'Published on day 1 of every month.'
10 language = 'en'
11 oldest_article = 30
12 max_articles_per_feed = 100
13 auto_cleanup = True
14
15 feeds = [
16 ('ACM CACM', 'https://cacm.acm.org/magazine.rss'),
17 ]
18
19 def get_cover_url(self):
20 """
21 Parse out cover URL from cover page.
22 Example:
23 From: https://cacm.acm.org/system/assets/0004/2570/April2022.Cover.1000x1338.large.jpg?1647524668&1647524668
24 Get: https://cacm.acm.org/system/assets/0004/2570/April2022.Cover.1000x1338.jpg
25 """
26
27 soup = self.index_to_soup('https://cacm.acm.org/')
28 a_img = soup.find('a', class_='menuCover')
29 img_url = a_img.img['src']
30 img_url = img_url.split('?')[0]
31 img_url = img_url.replace('.large', '')
32 return img_url