mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Popular Science
This commit is contained in:
parent
f01a490730
commit
9f0578b4bd
@ -1,21 +1,16 @@
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
import re
|
|
||||||
|
|
||||||
class AdvancedUserRecipe1282101454(BasicNewsRecipe):
|
class AdvancedUserRecipe1282101454(BasicNewsRecipe):
|
||||||
title = 'Popular Science'
|
title = 'Popular Science'
|
||||||
language = 'en'
|
language = 'en'
|
||||||
__author__ = 'TonytheBookworm'
|
__author__ = 'Kovid Goyal'
|
||||||
description = 'Popular Science'
|
description = 'Popular Science'
|
||||||
publisher = 'Popular Science'
|
publisher = 'Popular Science'
|
||||||
category = 'gadgets,science'
|
|
||||||
oldest_article = 7 # change this if you want more current articles. I like to go a week in
|
oldest_article = 7 # change this if you want more current articles. I like to go a week in
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
use_embedded_content = True
|
use_embedded_content = False
|
||||||
|
|
||||||
masthead_url = 'http://www.raytheon.com/newsroom/rtnwcm/groups/Public/documents/masthead/rtn08_popscidec_masthead.jpg'
|
|
||||||
|
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
|
|
||||||
@ -26,31 +21,11 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe):
|
|||||||
('DIY', 'http://www.popsci.com/full-feed/diy'),
|
('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):
|
||||||
#The following will get read of the Gallery: links when found
|
for img in soup.findAll('img', attrs={'data-medsrc':True}):
|
||||||
|
img['src'] = img['data-medsrc']
|
||||||
def preprocess_html(self, soup) :
|
|
||||||
weblinks = soup.findAll(['head','h2'])
|
|
||||||
if weblinks is not None:
|
|
||||||
for link in weblinks:
|
|
||||||
if re.search('(Gallery)(:)',str(link)):
|
|
||||||
|
|
||||||
link.parent.extract()
|
|
||||||
return soup
|
return soup
|
||||||
#-----------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user