home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / wash_times.recipe < prev    next >
Text File  |  2011-09-09  |  2KB  |  50 lines

  1. #!/usr/bin/env  python
  2. __license__   = 'GPL v3'
  3. __copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
  4. __docformat__ = 'restructuredtext en'
  5.  
  6. import re
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9.  
  10. class WashingtonTimes(BasicNewsRecipe):
  11.  
  12.     title = 'Washington Times'
  13.     max_articles_per_feed = 15
  14.     language = 'en'
  15.     __author__ = 'Kos Semonski'
  16.  
  17.  
  18.     preprocess_regexps = [ (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in
  19.                           [
  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'<div class=\'headerDIV\'><h2><a style="color: #990000;" href="http://www.washingtontimes.com/NewsTrack/Top_News/">Top News</a></h2></div>.*?<br clear="all">', lambda match : ''),
  26.         (r'<script src="http://www.g.*?>.*?</body>', lambda match : ''),
  27.         (r'<span style="font: 16pt arial', lambda match : '<span style="font: 12pt arial'),
  28.      ]
  29.     ]
  30.  
  31.  
  32.  
  33.     def get_feeds(self):
  34.         return [ (u'Headlines', u'http://www.washingtontimes.com/rss/headlines/news/headlines/'),
  35.                       (u'Newsmakers', u'http://www.washingtontimes.com/rss/headlines/news/newsmakers/'),
  36.       (u'National', u'http://www.washingtontimes.com/rss/headlines/news/national/'),
  37.       (u'World', u'http://www.washingtontimes.com/rss/headlines/news/world/'),
  38.       (u'Editor Favs', u'http://www.washingtontimes.com/rss/headlines/news/editor-favorites/'),
  39.       (u'Editorials', u'http://www.washingtontimes.com/rss/headlines/opinion/editorials/'),
  40.       (u'Cartoons', u'http://www.washingtontimes.com/rss/headlines/opinion/cartoons/'),
  41.                       (u'Business', u'http://www.washingtontimes.com/rss/headlines/news/business/'),
  42.       (u'Technology', u'http://www.washingtontimes.com/rss/headlines/news/technology/'),
  43.                       (u'Security', u'http://www.washingtontimes.com/rss/headlines/news/security/'),
  44.       (u'Politics', u'http://www.washingtontimes.com/rss/headlines/news/politics/'),
  45.                       (u'Congress', u'http://www.washingtontimes.com/rss/headlines/news/congress/'),
  46.           ]
  47.  
  48.     def print_version(self, url):
  49.         return url + '/print/'
  50.