Debian Codegraph @

recipes/cato.recipe

raw
1 import re
2
3 from calibre.web.feeds.news import BasicNewsRecipe
4
5
6 class CATOInstitute(BasicNewsRecipe):
7 title = 'The CATO Institute'
8 description = (
9 'The Cato Institute is a public policy research organization — a think tank — '
10 'dedicated to the principles of individual liberty, limited government, free markets and peace. '
11 'Its scholars and analysts conduct independent, nonpartisan research on a wide range of policy issues.'
12 )
13 __author__ = '_reader'
14 __date__ = '05 July 2012'
15 __version__ = '1.0'
16 cover_url = 'http://www.cato.org/images/logo.jpg'
17 masthead_url = 'http://www.cato.org/images/logo.jpg'
18 language = 'en'
19 oldest_article = 30 # days
20 max_articles_per_feed = 100
21 needs_subscription = False
22 publisher = 'CATO Institute'
23 category = 'commentary'
24 tags = 'commentary'
25 publication_type = 'blog'
26 no_stylesheets = True
27 use_embedded_content = False
28 encoding = None
29 simultaneous_downloads = 10
30 recursions = 0
31 remove_javascript = True
32 remove_empty_feeds = True
33 auto_cleanup = True
34
35 conversion_options = {
36 'comments': description,
37 'tags': tags,
38 'language': language,
39 'publisher': publisher,
40 'authors': publisher,
41 'smarten_punctuation': True,
42 }
43
44 feeds = [
45 ('Cato Recent Op-Eds', 'http://feeds.cato.org/CatoRecentOpeds'),
46 ('Cato Homepage Headlines', 'http://feeds.cato.org/CatoHomepageHeadlines'),
47 ('Cato Media Updates', 'http://feeds.cato.org/CatoMediaUpdates'),
48 ('Cato@Liberty', 'http://feeds.cato.org/Cato-at-liberty'),
49 ('Cato Unbound', 'http://feeds.feedburner.com/cato-unbound'),
50 ('Education and Child Policy', 'http://www.cato.org/rss/ra.xml?name=education-child-policy'),
51 ('Finance, Banking & Monetary Policy', 'http://www.cato.org/rss/ra.xml?name=finance-banking-monetary-policy'),
52 ('Government and Politics', 'http://www.cato.org/rss/ra.xml?name=government-politics'),
53 ('International Economics & Development', 'http://www.cato.org/rss/ra.xml?name=international-economics-development'),
54 ('Political Philosophy', 'http://www.cato.org/rss/ra.xml?name=political-philosophy'),
55 ('Social Security', 'http://www.cato.org/rss/ra.xml?name=social-security'),
56 ('Telecom, Internet & Information Policy', 'http://www.cato.org/rss/ra.xml?name=telecom-internet-information-policy'),
57 ('Energy and Environment', 'http://www.cato.org/rss/ra.xml?name=energy-environment'),
58 ('Foreign Policy and National Security', 'http://www.cato.org/rss/ra.xml?name=foreign-policy-national-security'),
59 ('Health Care', 'http://www.cato.org/rss/ra.xml?name=health-care'),
60 ('Law and Civil Liberties', 'http://www.cato.org/rss/ra.xml?name=law-civil-liberties'),
61 ('Regulatory Studies', 'http://www.cato.org/rss/ra.xml?name=regulatory-studies'),
62 ('Tax and Budget Policy', 'http://www.cato.org/rss/ra.xml?name=tax-budget-policy'),
63 ('Trade and Immigration', 'http://www.cato.org/rss/ra.xml?name=trade-immigration'),
64 ]
65
66 def print_version(self, url):
67 R_unbound = re.compile(r'(^.*cato-unbound.*)(\/\?utm_source.*$)', re.DOTALL | re.IGNORECASE) # CATO Unbound
68 R_pubs = re.compile(r'(^.*\/publications\/.*$)', re.DOTALL | re.IGNORECASE) # CATO Publications
69 if re.match(R_unbound, url):
70 printURL = r'\g<1>' + '/print/'
71 elif re.match(R_pubs, url):
72 printURL = url + '?print'
73 else:
74 printURL = url + '/print/'
75 return printURL