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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2009-2010, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. spectator.org
  5. '''
  6.  
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9. class TheAmericanSpectator(BasicNewsRecipe):
  10.     title                 = 'The American Spectator'
  11.     __author__            = 'Darko Miletic'
  12.     description           = 'News from USA'
  13.     category              = 'news, politics, USA, world'
  14.     publisher             = 'The American Spectator'
  15.     oldest_article        = 7
  16.     max_articles_per_feed = 100
  17.     no_stylesheets        = True
  18.     use_embedded_content  = False
  19.     language              = 'en'
  20.     INDEX                 = 'http://spectator.org'
  21.       
  22.     conversion_options = {  
  23.                              'comments'        : description
  24.                             ,'tags'            : category
  25.                             ,'language'        : language
  26.                             ,'publisher'       : publisher
  27.                          }
  28.  
  29.     keep_only_tags   = [
  30.                              dict(name='div', attrs={'class':'post inner'})
  31.                             ,dict(name='div', attrs={'class':'author-bio'})
  32.                          ]
  33.  
  34.     remove_tags     = [
  35.                              dict(name='object')
  36.                             ,dict(name='div', attrs={'class':['col3','post-options','social']})
  37.                             ,dict(name='p'  , attrs={'class':['letter-editor','meta']})
  38.                         ]
  39.                          
  40.     feeds = [ (u'Articles', u'http://feeds.feedburner.com/amspecarticles')]
  41.  
  42.     def get_cover_url(self):
  43.         cover_url = None
  44.         soup = self.index_to_soup(self.INDEX)
  45.         link_item = soup.find('a',attrs={'class':'cover'})
  46.         if link_item:
  47.             soup2 = self.index_to_soup(link_item['href'])
  48.             link_item2 = soup2.find('div',attrs={'class':'post inner issues'})
  49.             cover_url = self.INDEX + link_item2.img['src']
  50.         return cover_url
  51.           
  52.     def print_version(self, url):
  53.         return url + '/print'
  54.         
  55.     def get_article_url(self, article):
  56.         return article.get('guid', None)
  57.         
  58.