Debian Codegraph @

recipes/bbc_sport.recipe

raw
1 __license__ = 'GPL v3'
2 __copyright__ = '2010, limawhiskey <limawhiskey at gmail.com>'
3 '''
4 news.bbc.co.uk/sport/
5 '''
6 import re
7
8 from calibre.web.feeds.recipes import BasicNewsRecipe
9
10
11 class BBC(BasicNewsRecipe):
12 title = 'BBC Sport'
13 __author__ = 'limawhiskey, Darko Miletic, Starson17'
14 description = 'Sports news from UK. A fast version that does not download pictures'
15 oldest_article = 2
16 max_articles_per_feed = 100
17 no_stylesheets = True
18 use_embedded_content = False
19 encoding = 'utf8'
20 publisher = 'BBC'
21 category = 'sport, news, UK, world'
22 language = 'en_GB'
23 publication_type = 'newsportal'
24 extra_css = ' body{ font-family: Verdana,Helvetica,Arial,sans-serif } .introduction{font-weight: bold} .story-feature{display: block; padding: 0; border: 1px solid; width: 40%; font-size: small} .story-feature h2{text-align: center; text-transform: uppercase} ' # noqa: E501
25 preprocess_regexps = [(re.compile(r'<!--.*?-->', re.DOTALL), lambda m: '')]
26 conversion_options = {'comments': description, 'tags': category, 'language': language, 'publisher': publisher, 'linearize_tables': True}
27
28 keep_only_tags = [dict(name='div', attrs={'class': ['ds', 'mxb']}), dict(attrs={'class': ['story-body', 'storybody']})]
29
30 remove_tags = [
31 dict(
32 name='div',
33 attrs={
34 'class': [
35 'storyextra',
36 'share-help',
37 'embedded-hyper',
38 'story-feature wide ',
39 'story-feature narrow',
40 'cap',
41 'caption',
42 'q1',
43 'sihf',
44 'mva',
45 'videoInStoryC',
46 'sharesb',
47 'mvtb',
48 ]
49 },
50 ),
51 dict(name=['img']),
52 dict(name=['br']),
53 ]
54
55 remove_attributes = ['width', 'height']
56
57 feeds = [
58 ('Sport Front Page', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/front_page/rss.xml'),
59 ('Football', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/rss.xml'),
60 ('Cricket', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/cricket/rss.xml'),
61 ('Formula 1', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/motorsport/formula_one/rss.xml'),
62 ('Commonwealth Games', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/commonwealth_games/delhi_2010/rss.xml'),
63 ('Golf', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/golf/rss.xml'),
64 ('Rugby Union', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/rugby_union/rss.xml'),
65 ('Rugby League', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/rugby_league/rss.xml'),
66 ('Tennis', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/tennis/rss.xml'),
67 ('Motorsport', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/motorsport/rss.xml'),
68 ('Boxing', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/boxing/rss.xml'),
69 ('Athletics', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/athletics/rss.xml'),
70 ('Snooker', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/snooker/rss.xml'),
71 ('Horse Racing', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/horse_racing/rss.xml'),
72 ('Cycling', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/cycling/rss.xml'),
73 ('Disability Sport', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/disability_sport/rss.xml'),
74 ('Other Sport', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/other_sports/rss.xml'),
75 ('Olympics 2012', 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/olympics/london_2012/rss.xml'),
76 ]