diff --git a/recipes/common_dreams.recipe b/recipes/common_dreams.recipe
index 62edfe8684..b4b498889f 100644
--- a/recipes/common_dreams.recipe
+++ b/recipes/common_dreams.recipe
@@ -1,12 +1,13 @@
#!/usr/bin/env python
##
-## Title: Common Dreams
+# Title: Common Dreams
##
-## License: GNU General Public License v3 - http://www.gnu.org/copyleft/gpl.html
+# License: GNU General Public License v3 -
+# http://www.gnu.org/copyleft/gpl.html
# Feb 2012: Cleaned up the output to have only the main article
-__license__ = 'GNU General Public License v3 - http://www.gnu.org/copyleft/gpl.html'
+__license__ = 'GNU General Public License v3 - http://www.gnu.org/copyleft/gpl.html'
'''
commondreams.org
'''
@@ -14,27 +15,22 @@ commondreams.org
import re
from calibre.web.feeds.news import BasicNewsRecipe
+
class CommonDreams(BasicNewsRecipe):
# Identify the recipe
-
- title = u'Common Dreams'
- description = u'Breaking News & Views for the Progressive Community.'
- cover_url = 'https://s3.amazonaws.com/s3.commondreams.org/images/common-dreams.png'
- __author__ = u'XanthanGum'
+
+ title = u'Common Dreams'
+ description = u'Breaking News & Views for the Progressive Community.'
+ cover_url = 'https://s3.amazonaws.com/s3.commondreams.org/images/common-dreams.png'
+ __author__ = u'XanthanGum'
language = 'en'
-
+
oldest_article = 7
max_articles_per_feed = 100
-
+
no_stylesheets = True
remove_javascript = True
- # Flattens all the tables to make it compatible with Nook
- conversion_options = {'linearize_tables' : True}
-
- remove_attributes = [ 'border', 'cellspacing', 'align', 'cellpadding', 'colspan',
- 'valign', 'vspace', 'hspace', 'alt', 'width', 'height' ]
-
# Specify extra CSS - overrides ALL other CSS (IE. Added last).
extra_css = 'body { font-family: verdana, helvetica, sans-serif; } \
.introduction, .first { font-weight: bold; } \
@@ -54,36 +50,29 @@ class CommonDreams(BasicNewsRecipe):
h2 { font-size: 150%; font-weight: bold; } \
h3 { font-size: 125%; font-weight: bold; } \
h4, h5, h6 { font-size: 100%; font-weight: bold; }'
-
+
# Remove the line breaks and float left/right and picture width/height.
- preprocess_regexps = [(re.compile(r'
', re.IGNORECASE), lambda m: ''),
- (re.compile(r'
', re.IGNORECASE), lambda m: ''),
- (re.compile(r'float:.*?'), lambda m: ''),
- (re.compile(r'width:.*?px'), lambda m: ''),
- (re.compile(r'height:.*?px'), lambda m: ''),
- (re.compile(r''), lambda m: ''),
- (re.compile(r''), lambda m: ''),
- ]
-
-
+ preprocess_regexps = [(re.compile(r'
', re.IGNORECASE), lambda m: ''),
+ (re.compile(
+ r'
', re.IGNORECASE), lambda m: ''),
+ (re.compile(r'float:.*?'), lambda m: ''),
+ (re.compile(r'width:.*?px'), lambda m: ''),
+ (re.compile(r'height:.*?px'), lambda m: ''),
+ (re.compile(r''), lambda m: ''),
+ (re.compile(r''), lambda m: ''),
+ ]
+
# Main article is inside this tag
- keep_only_tags = [
- dict(name='div', attrs={'id':lambda x: x and 'node-' in x}),
- ]
-
- remove_tags = [
- dict(name='div', attrs={'class':'node-links clear-block'}), # remove Share options
- ]
-
+ keep_only_tags = [dict(name='h1', attrs={'class': 'node__title managed-node-title'}),
+ dict(name='div', attrs={'class': ['field field--name-field-article-img field--type-image field--label-hidden',
+ 'field field--name-body field--type-text-with-summary field--label-hidden']}),
+ ]
# Identify the news feeds
-
- feeds = [(u'Headlines', u'https://www.commondreams.org/feed/headlines_rss'),
- (u'Further News Articles', u'https://www.commondreams.org/feed/further_rss'),
- (u'Views', u'https://www.commondreams.org/feed/views_rss'),
- (u'Progressive Newswire', u'https://www.commondreams.org/feed/newswire_rss')]
-
- def print_version(self, url):
- url = url + '?print'
- return url
\ No newline at end of file
+ feeds = [(u'Headlines', u'https://www.commondreams.org/feed/headlines_rss'),
+ (u'Further News Articles',
+ u'https://www.commondreams.org/feed/further_rss'),
+ (u'Views', u'https://www.commondreams.org/feed/views_rss'),
+ (u'Progressive Newswire', u'https://www.commondreams.org/feed/newswire_rss')]
+