mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Yahoo News
This commit is contained in:
parent
5a7275b976
commit
82246b62ea
@ -1,5 +1,11 @@
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
import re
|
|
||||||
|
|
||||||
|
def classes(classes):
|
||||||
|
q = frozenset(classes.split(' '))
|
||||||
|
return dict(
|
||||||
|
attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class YahooNews(BasicNewsRecipe):
|
class YahooNews(BasicNewsRecipe):
|
||||||
@ -20,13 +26,15 @@ class YahooNews(BasicNewsRecipe):
|
|||||||
(u'Science', u'http://rss.news.yahoo.com/rss/science')
|
(u'Science', u'http://rss.news.yahoo.com/rss/science')
|
||||||
]
|
]
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'id': 'yn-story'})]
|
keep_only_tags = [
|
||||||
|
dict(name='h1'),
|
||||||
|
dict(attrs={'itemprop': 'articleBody'})
|
||||||
|
]
|
||||||
|
|
||||||
remove_tags = [dict(name='div', attrs={'class': ['hd', 'ft', 'yn-share-social']}),
|
remove_tags = [
|
||||||
dict(name='div', attrs={'id': ['yn-story-minor-media']})]
|
classes('canvas-yahoovideo canvas-sharebuttons'),
|
||||||
|
dict(name='button'),
|
||||||
preprocess_regexps = [
|
]
|
||||||
(re.compile(r'<span>Play Video</span>', re.DOTALL), lambda match: '<span></span>')]
|
|
||||||
|
|
||||||
extra_css = '''
|
extra_css = '''
|
||||||
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user