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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. thewest.com.au
  5. '''
  6.  
  7. import re
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9.  
  10. class TheWest(BasicNewsRecipe):
  11.     title                 = 'The West Australian'
  12.     __author__            = 'Darko Miletic'
  13.     description           = 'News from Australia'
  14.     publisher             = 'thewest.com.au'
  15.     category              = 'news, politics, Australia'
  16.     oldest_article        = 2
  17.     max_articles_per_feed = 200
  18.     no_stylesheets        = True
  19.     encoding              = 'utf8'
  20.     use_embedded_content  = False
  21.     language              = 'en_AU'
  22.     remove_empty_feeds    = True
  23.     publication_type      = 'newspaper'
  24.     masthead_url          = 'http://l.yimg.com/ao/i/mp/properties/news/02/wan/img/wan-logo-h49.png'
  25.     extra_css             = ' .article{font-family: Arial,Helvetica,sans-serif } .image{font-size: x-small} '
  26.  
  27.     preprocess_regexps = [
  28.        (re.compile(r'</title>.*?</head>', re.DOTALL|re.IGNORECASE),lambda match: '</title></head>')
  29.     ]
  30.  
  31.     conversion_options = {
  32.                           'comment'   : description
  33.                         , 'tags'      : category
  34.                         , 'publisher' : publisher
  35.                         , 'language'  : language
  36.                         }
  37.  
  38.     remove_tags       = [
  39.                           dict(attrs={'class':['tools','lhs']})
  40.                          ,dict(attrs={'id'   :'tools-bottom'})
  41.                          ,dict(attrs={'href' :'http://twitter.com/thewest_com_au'})
  42.                         ]
  43.     keep_only_tags    = [dict(attrs={'class':'mod article'})]
  44.     remove_attributes = ['width','height']
  45.  
  46.  
  47.     feeds = [
  48.                (u'WA News'       , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/wa.xml'            )
  49.               ,(u'National'      , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/national.xml'      )
  50.               ,(u'World'         , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/world.xml'         )
  51.               ,(u'Offbeat'       , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/offbeat.xml'       )
  52.               ,(u'Business'      , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/business.xml'      )
  53.               ,(u'Sport'         , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/sport.xml'         )
  54.               ,(u'Entertainment' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/entertainment.xml' )
  55.               ,(u'Travel'        , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/travel.xml'        )
  56.               ,(u'Life+Style'    , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/lifestyle.xml'     )
  57.             ]
  58.  
  59.     def get_article_url(self, article):
  60.         return article.get('guid',  None)
  61.  
  62.     def preprocess_html(self, soup):
  63.         return self.adeify_images(soup)
  64.