calibre/recipes/popscience.recipe
Kovid Goyal 567040ee1e Perform PEP8 compliance checks on the entire codebase
Some bits of PEP 8 are turned off via setup.cfg
2016-07-29 21:25:17 +05:30

34 lines
1.1 KiB
Plaintext

from calibre.web.feeds.news import BasicNewsRecipe
class AdvancedUserRecipe1282101454(BasicNewsRecipe):
title = 'Popular Science'
language = 'en'
__author__ = 'Kovid Goyal'
description = 'Popular Science'
publisher = 'Popular Science'
oldest_article = 7 # change this if you want more current articles. I like to go a week in
max_articles_per_feed = 100
no_stylesheets = True
remove_javascript = True
use_embedded_content = False
feeds = [
('Gadgets', 'http://www.popsci.com/full-feed/gadgets'),
('Cars', 'http://www.popsci.com/full-feed/cars'),
('Science', 'http://www.popsci.com/full-feed/science'),
('Technology', 'http://www.popsci.com/full-feed/technology'),
('DIY', 'http://www.popsci.com/full-feed/diy'),
]
keep_only_tags = [
dict(attrs={'class': lambda x: x and {
'pane-node-header', 'pane-node-body'} & set(x.split())}),
]
def preprocess_html(self, soup):
for img in soup.findAll('img', attrs={'data-medsrc': True}):
img['src'] = img['data-medsrc']
return soup