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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. gulfnews.com
  5. '''
  6.  
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9. class GulfNews(BasicNewsRecipe):
  10.     title                 = 'Gulf News'
  11.     __author__            = 'Darko Miletic'
  12.     description           = 'News from United Arab Emirrates, persian gulf and rest of the world'
  13.     publisher             = 'Al Nisr Publishing LLC'
  14.     category              = 'news, politics, UAE, world'
  15.     oldest_article        = 2
  16.     max_articles_per_feed = 200
  17.     no_stylesheets        = True
  18.     encoding              = 'utf8'
  19.     use_embedded_content  = False
  20.     language              = 'en'
  21.     remove_empty_feeds    = True
  22.     publication_type      = 'newsportal'
  23.     masthead_url          = 'http://gulfnews.com/media/img/gulf_news_logo.jpg'
  24.     extra_css             = """
  25.                                body{font-family: Arial,Helvetica,sans-serif }
  26.                                img{margin-bottom: 0.4em; display:block}
  27.                                h1{font-family: Georgia, 'Times New Roman', Times, serif}
  28.                                ol,ul{list-style: none}
  29.                                .synopsis{font-size: small}
  30.                                .details{font-size: x-small}
  31.                                .image{font-size: xx-small}
  32.                             """
  33.  
  34.     conversion_options = {
  35.                           'comment'   : description
  36.                         , 'tags'      : category
  37.                         , 'publisher' : publisher
  38.                         , 'language'  : language
  39.                         }
  40.  
  41.     remove_tags = [
  42.                      dict(name=['meta','link','object','embed'])
  43.                      ,dict(attrs={'class':['quickLinks','ratings']})
  44.                      ,dict(attrs={'id':'imageSelector'})
  45.                   ]
  46.     remove_attributes=['lang']
  47.     keep_only_tags=[
  48.                      dict(name='h1')
  49.                      ,dict(attrs={'class':['synopsis','details','image','article']})
  50.                    ]
  51.  
  52.  
  53.     feeds = [
  54.               (u'UAE News'      , u'http://gulfnews.com/cmlink/1.446094')
  55.              ,(u'Business'      , u'http://gulfnews.com/cmlink/1.446098')
  56.              ,(u'Entertainment' , u'http://gulfnews.com/cmlink/1.446095')
  57.              ,(u'Sport'         , u'http://gulfnews.com/cmlink/1.446096')
  58.              ,(u'Life'          , u'http://gulfnews.com/cmlink/1.446097')
  59.             ]
  60.  
  61.     def preprocess_html(self, soup):
  62.         for item in soup.findAll(style=True):
  63.             del item['style']
  64.         return soup
  65.