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

  1.  
  2. __license__   = 'GPL v3'
  3. __copyright__ = '2009-2010, Darko Miletic <darko.miletic at gmail.com>'
  4. '''
  5. azstarnet.com
  6. '''
  7. import urllib
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9.  
  10. class Azstarnet(BasicNewsRecipe):
  11.     title                 = 'Arizona  Daily Star'
  12.     __author__            = 'Darko Miletic'
  13.     description           = 'news from Arizona'
  14.     language              = 'en'
  15.     publisher             = 'azstarnet.com'
  16.     category              = 'news, politics, Arizona, USA'
  17.     oldest_article        = 3
  18.     max_articles_per_feed = 100
  19.     no_stylesheets        = True
  20.     use_embedded_content  = False
  21.     encoding              = 'utf-8'
  22.     masthead_url          = 'http://azstarnet.com/content/tncms/live/global/resources/images/logo.gif'
  23.     needs_subscription    = True
  24.  
  25.     conversion_options = {
  26.                           'comment'    : description
  27.                         , 'tags'       : category
  28.                         , 'publisher'  : publisher
  29.                         , 'language'   : language
  30.                         }
  31.  
  32.  
  33.     def get_browser(self):
  34.         br = BasicNewsRecipe.get_browser()
  35.         br.open('http://azstarnet.com/')
  36.         if self.username is not None and self.password is not None:
  37.             data = urllib.urlencode({ 'm':'login'
  38.                                      ,'u':self.username
  39.                                      ,'p':self.password
  40.                                      ,'z':'http://azstarnet.com/'
  41.                                    })
  42.             br.open('http://azstarnet.com/app/registration/proxy.php',data)
  43.         return br
  44.  
  45.     remove_tags = [dict(name=['object','link','iframe','base','img'])]
  46.  
  47.  
  48.     feeds = [
  49.                (u'Local News'    , u'http://azstarnet.com/search/?f=rss&t=article&c=news/local&l=25&s=start_time&sd=desc')
  50.               ,(u'National News' , u'http://azstarnet.com/search/?f=rss&t=article&c=news/national&l=25&s=start_time&sd=desc')
  51.               ,(u'World News'    , u'http://azstarnet.com/search/?f=rss&t=article&c=news/world&l=25&s=start_time&sd=desc')
  52.               ,(u'Sports'        , u'http://azstarnet.com/search/?f=rss&t=article&c=sports&l=25&s=start_time&sd=desc')
  53.               ,(u'Opinion'       , u'http://azstarnet.com/search/?f=rss&t=article&c=news/opinion&l=25&s=start_time&sd=desc')
  54.               ,(u'Movies'        , u'http://azstarnet.com/search/?f=rss&t=article&c=entertainment/movies&l=25&s=start_time&sd=desc')
  55.               ,(u'Food'          , u'http://azstarnet.com/search/?f=rss&t=article&c=lifestyles/food-and-cooking&l=25&s=start_time&sd=desc')
  56.             ]
  57.  
  58.     def preprocess_html(self, soup):
  59.         for item in soup.findAll(style=True):
  60.             del item['style']
  61.         return soup
  62.  
  63.     def print_version(self, url):
  64.         return url + '?print=1'
  65.  
  66.