| 1 |
#!/usr/bin/env python |
| 2 |
# vim:fileencoding=utf-8 |
| 3 |
|
| 4 |
from __future__ import absolute_import, division, print_function, unicode_literals |
| 5 |
|
| 6 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 7 |
|
| 8 |
''' |
| 9 |
ACM Queue Magazine |
| 10 |
''' |
| 11 |
|
| 12 |
|
| 13 |
class QueueAcmOrg(BasicNewsRecipe): |
| 14 |
title = 'ACM Queue Magazine' |
| 15 |
__author__ = 'yodha8' |
| 16 |
description = 'Queue is the ACM magazine for practicing software engineers. Published once every 2 months. Example: Jan-Feb.' |
| 17 |
oldest_article = 60 |
| 18 |
max_articles_per_feed = 50 |
| 19 |
auto_cleanup = True |
| 20 |
language = 'en' |
| 21 |
cover_url = 'https://queue.acm.org/img/acmqueue_logo.gif' |
| 22 |
|
| 23 |
feeds = [ |
| 24 |
('All Queue Content', 'https://queue.acm.org/rss/feeds/queuecontent.xml'), |
| 25 |
] |
| 26 |
|
| 27 |
def get_cover_url(self): |
| 28 |
soup = self.index_to_soup('https://queue.acm.org/') |
| 29 |
imgs = soup.find_all( |
| 30 |
'img', |
| 31 |
attrs={'src': lambda x: x and x.startswith('/app/')}, |
| 32 |
) |
| 33 |
if len(imgs) > 0: |
| 34 |
self.cover_url = 'https://queue.acm.org/' + imgs[0]['src'] |
| 35 |
return getattr(self, 'cover_url', self.cover_url) |