Debian Codegraph @

recipes/wash_times.recipe

raw
1 #!/usr/bin/env python
2 __license__ = 'GPL v3'
3 __copyright__ = '2008, Kovid Goyal [email protected]'
4 __docformat__ = 'restructuredtext en'
5
6 import re
7
8 from calibre.web.feeds.news import BasicNewsRecipe
9
10
11 class WashingtonTimes(BasicNewsRecipe):
12 title = 'Washington Times'
13 max_articles_per_feed = 15
14 language = 'en_US'
15 __author__ = 'Kos Semonski'
16
17 preprocess_regexps = [
18 (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1])
19 for i in [
20 (r'<HEAD>.*?</HEAD>', lambda match: '<HEAD></HEAD>'),
21 (r'<div id="apple-rss-sidebar-background">.*?<!-- start Entries -->', lambda match: ''),
22 (r'<!-- end apple-rss-content-area -->.*?</body>', lambda match: '</body>'),
23 (r'<script.*?>.*?</script>', lambda match: ''),
24 (r'<body onload=.*?>.*?<a href="http://www.upi.com">', lambda match: '<body style="font: 8pt arial;">'),
25 (r'<script src="http://www.g.*?>.*?</body>', lambda match: ''),
26 (r'<span style="font: 16pt arial', lambda match: '<span style="font: 12pt arial'),
27 ]
28 ]
29
30 def get_feeds(self):
31 return [
32 ('Headlines', 'http://www.washingtontimes.com/rss/headlines/news/headlines/'),
33 ('Newsmakers', 'http://www.washingtontimes.com/rss/headlines/news/newsmakers/'),
34 ('National', 'http://www.washingtontimes.com/rss/headlines/news/national/'),
35 ('World', 'http://www.washingtontimes.com/rss/headlines/news/world/'),
36 ('Editor Favs', 'http://www.washingtontimes.com/rss/headlines/news/editor-favorites/'),
37 ('Editorials', 'http://www.washingtontimes.com/rss/headlines/opinion/editorials/'),
38 ('Cartoons', 'http://www.washingtontimes.com/rss/headlines/opinion/cartoons/'),
39 ('Business', 'http://www.washingtontimes.com/rss/headlines/news/business/'),
40 ('Technology', 'http://www.washingtontimes.com/rss/headlines/news/technology/'),
41 ('Security', 'http://www.washingtontimes.com/rss/headlines/news/security/'),
42 ('Politics', 'http://www.washingtontimes.com/rss/headlines/news/politics/'),
43 ('Congress', 'http://www.washingtontimes.com/rss/headlines/news/congress/'),
44 ]
45
46 def print_version(self, url):
47 return url + '/print/'