home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / upi.recipe < prev    next >
Text File  |  2011-09-09  |  2KB  |  42 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 UnitedPressInternational(BasicNewsRecipe):
  11.  
  12.     title = 'United Press International'
  13.     max_articles_per_feed = 15
  14.     html2lrf_options = ['--override-css= "H1 {font-family: Arial; font-weight: bold; color: #000000; size: 10pt;}"']
  15.     language = 'en'
  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.upi.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 [ ('Top Stories', 'http://www.upi.com/rss/NewsTrack/Top_News/'),
  35.                  ('Science', 'http://www.upi.com/rss/NewsTrack/Science/'),
  36.                  ('Heatlth', 'http://www.upi.com/rss/NewsTrack/Health/'),
  37.                  ('Quirks', 'http://www.upi.com/rss/NewsTrack/Quirks/'),
  38.         ]
  39.  
  40.     def print_version(self, url):
  41.         return url + 'print/'
  42.