Debian Codegraph @

recipes/yahoo_news.recipe

raw
1 from calibre.web.feeds.news import BasicNewsRecipe
2
3
4 def classes(classes):
5 q = frozenset(classes.split(' '))
6 return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)})
7
8
9 class YahooNews(BasicNewsRecipe):
10 title = 'Yahoo News'
11 __author__ = 'Starson17'
12 description = 'Yahoo-Science'
13 language = 'en'
14 use_embedded_content = False
15 no_stylesheets = True
16 linearize_tables = True
17 oldest_article = 24
18 remove_javascript = True
19 remove_empty_feeds = True
20 max_articles_per_feed = 10
21
22 feeds = [ # There are dozens of other feeds at http://news.yahoo.com/rss
23 ('Top Stories', 'http://rss.news.yahoo.com/rss/topstories'),
24 ('Science', 'http://rss.news.yahoo.com/rss/science'),
25 ]
26
27 keep_only_tags = [dict(name='h1'), dict(attrs={'itemprop': 'articleBody'})]
28
29 remove_tags = [
30 classes('canvas-yahoovideo canvas-sharebuttons'),
31 dict(name='button'),
32 ]
33
34 extra_css = '''
35 h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
36 h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
37 p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
38 body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
39 '''