Debian Codegraph @

recipes/nytimes_sports.recipe

raw
1 #!/usr/bin/env python
2 # encoding: utf-8
3
4 from __future__ import with_statement
5
6 __license__ = 'GPL 3'
7 __copyright__ = 'zotzo'
8 __docformat__ = 'restructuredtext en'
9 '''
10 http://fifthdown.blogs.nytimes.com/
11 http://offthedribble.blogs.nytimes.com/
12 http://thequad.blogs.nytimes.com/
13 http://slapshot.blogs.nytimes.com/
14 http://goal.blogs.nytimes.com/
15 http://bats.blogs.nytimes.com/
16 http://straightsets.blogs.nytimes.com/
17 http://formulaone.blogs.nytimes.com/
18 http://onpar.blogs.nytimes.com/
19 '''
20
21 from calibre.web.feeds.news import BasicNewsRecipe
22
23
24 class NYTimesSports(BasicNewsRecipe):
25 title = 'New York Times Sports Beat'
26 language = 'en_US'
27 __author__ = 'rylsfan'
28 description = 'Indepth sports from the New York Times'
29 publisher = 'The New York Times'
30 category = 'Sports'
31 oldest_article = 3
32 max_articles_per_feed = 25
33 use_embedded_content = False
34 no_stylesheets = True
35 delay = 1
36
37 feeds = [
38 ('The Fifth Down', 'https://fifthdown.blogs.nytimes.com/feed/'),
39 ('The Quad', 'https://thequad.blogs.nytimes.com/feed/'),
40 ('Slap Shot', 'https://slapshot.blogs.nytimes.com/feed/'),
41 ('Goal', 'https://goal.blogs.nytimes.com/feed/'),
42 ('Bats', 'https://bats.blogs.nytimes.com/feed/'),
43 ('Straight Sets', 'https://straightsets.blogs.nytimes.com/feed/'),
44 ('Formula One', 'https://formulaone.blogs.nytimes.com/feed/'),
45 ('On Par', 'https://onpar.blogs.nytimes.com/feed/'),
46 ]
47
48 def preprocess_raw_html(self, raw_html, url):
49 if not hasattr(self, 'nyt_parser'):
50 from calibre.live import load_module
51
52 m = load_module('calibre.web.site_parsers.nytimes')
53 self.nyt_parser = m
54 html = self.nyt_parser.extract_html(self.index_to_soup(raw_html))
55 return html