| 1 |
#!/usr/bin/env python |
| 2 |
# License: GPLv3 Copyright: 2008, Kovid Goyal <kovid at kovidgoyal.net> |
| 3 |
|
| 4 |
from __future__ import unicode_literals |
| 5 |
|
| 6 |
from calibre.web.feeds.news import BasicNewsRecipe, classes |
| 7 |
|
| 8 |
|
| 9 |
class AmericanProspect(BasicNewsRecipe): |
| 10 |
title = 'American Prospect' |
| 11 |
__author__ = 'Kovid Goyal' |
| 12 |
oldest_article = 300 |
| 13 |
language = 'en_US' |
| 14 |
max_articles_per_feed = 100 |
| 15 |
recursions = 0 |
| 16 |
no_stylesheets = True |
| 17 |
remove_javascript = True |
| 18 |
encoding = 'utf-8' |
| 19 |
|
| 20 |
use_embedded_content = False |
| 21 |
|
| 22 |
keep_only_tags = [ |
| 23 |
dict(id=['title', 'content']), |
| 24 |
] |
| 25 |
remove_tags = [classes('slideout-close-btn media-options')] |
| 26 |
|
| 27 |
def get_feeds(self): |
| 28 |
soup = self.index_to_soup('https://prospect.org/archive') |
| 29 |
for a in soup.findAll('a', href=True): |
| 30 |
href = a['href'] |
| 31 |
if href.endswith('-issue/'): |
| 32 |
d = href.strip('/').split('/')[-1] |
| 33 |
self.timefmt = ' [{}]'.format(d.rpartition('-')[0]) |
| 34 |
self.log('Found magazine URL', href) |
| 35 |
return [('Articles', href + 'index.rss')] |
| 36 |
return [('Articles', 'https://prospect.org/api/rss/all.rss')] |