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

  1. import re
  2. from calibre.web.feeds.news import BasicNewsRecipe
  3.  
  4.  
  5. class AssociatedPress(BasicNewsRecipe):
  6.  
  7.     title = u'Associated Press'
  8.     description = 'Global news'
  9.     __author__ = 'Kovid Goyal and Sujata Raman'
  10.     use_embedded_content   = False
  11.     language = 'en'
  12.     no_stylesheets = True
  13.     max_articles_per_feed = 15
  14.     html2lrf_options = ['--force-page-break-before-tag="chapter"']
  15.  
  16.  
  17.     preprocess_regexps = [ (re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in
  18. [
  19.          (r'<span class="entry-content">', lambda match : '<div class="entry-content">'),
  20.     ]
  21.     ]
  22.  
  23.  
  24.     keep_only_tags = [ dict(name='div', attrs={'class':['body']}),
  25.                        dict(name='div', attrs={'class':['entry-content']}),
  26.                        ]
  27.     remove_tags = [dict(name='table', attrs={'class':['ap-video-table','ap-htmlfragment-table','ap-htmltable-table']}),
  28.                    dict(name='span', attrs={'class':['apCaption','tabletitle']}),
  29.                    dict(name='td', attrs={'bgcolor':['#333333']}),
  30.                   ]
  31.     extra_css = '''
  32.                .headline{font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;}
  33.                .bline{color:#003366;}
  34.                 body{font-family:Arial,Helvetica,sans-serif;}
  35.                 '''
  36.  
  37.  
  38.     feeds = [
  39.                    ('AP Headlines', 'http://hosted.ap.org/lineups/TOPHEADS-rss_2.0.xml?SITE=ORAST&SECTION=HOME'),
  40.                    ('AP US News', 'http://hosted.ap.org/lineups/USHEADS-rss_2.0.xml?SITE=CAVIC&SECTION=HOME'),
  41.                    ('AP World News', 'http://hosted.ap.org/lineups/WORLDHEADS-rss_2.0.xml?SITE=SCAND&SECTION=HOME'),
  42.                    ('AP Political News', 'http://hosted.ap.org/lineups/POLITICSHEADS-rss_2.0.xml?SITE=ORMED&SECTION=HOME'),
  43.                    ('AP Washington State News', 'http://hosted.ap.org/lineups/WASHINGTONHEADS-rss_2.0.xml?SITE=NYPLA&SECTION=HOME'),
  44.                    ('AP Technology News', 'http://hosted.ap.org/lineups/TECHHEADS-rss_2.0.xml?SITE=CTNHR&SECTION=HOME'),
  45.                    ('AP Health News', 'http://hosted.ap.org/lineups/HEALTHHEADS-rss_2.0.xml?SITE=FLDAY&SECTION=HOME'),
  46.                    ('AP Science News', 'http://hosted.ap.org/lineups/SCIENCEHEADS-rss_2.0.xml?SITE=OHCIN&SECTION=HOME'),
  47.                    ('AP Strange News', 'http://hosted.ap.org/lineups/STRANGEHEADS-rss_2.0.xml?SITE=WCNC&SECTION=HOME'),
  48.     ]
  49.  
  50.