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

  1.  
  2. __license__   = 'GPL v3'
  3. __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
  4. '''
  5. europasur.es
  6. '''
  7.  
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9.  
  10. class Europasur(BasicNewsRecipe):
  11.     title                 = 'Europa Sur'
  12.     __author__            = 'Darko Miletic'
  13.     description           = 'News in Spanish'
  14.     publisher             = 'Joly Digital'
  15.     category              = 'news, politics, Spanish'
  16.     oldest_article        = 2
  17.     max_articles_per_feed = 100
  18.     use_embedded_content  = False
  19.     remove_empty_feeds    = True
  20.     delay                 = 2
  21.     no_stylesheets        = True
  22.     encoding              = 'cp1252'
  23.     language              = 'es'
  24.     publication_type      = 'newspaper'
  25.     extra_css             = """ body{font-family: Verdana,Arial,Helvetica,sans-serif}
  26.                                 h2{font-family: Georgia,Times New Roman,Times,serif}
  27.                                 .subtitle{font-weight:bold}
  28.                                 .caption{font-size: small}
  29.                                 .body{font-size: 1.1em}
  30.                                 .info{color: #848484}
  31.                             """
  32.  
  33.     conversion_options = {
  34.                           'comment'  : description
  35.                         , 'tags'     : category
  36.                         , 'publisher': publisher
  37.                         , 'language' : language
  38.                         }
  39.  
  40.     keep_only_tags = [
  41.                        dict(attrs={'class':['titles','current']})
  42.                       ,dict(attrs={'id':'newsBody'})
  43.                      ]
  44.     remove_tags = [
  45.                       dict(name=['iframe','base','embed','object'])
  46.                      ,dict(name='a', attrs={'class':'zoom thickbox'})
  47.                      ,dict(name='div', attrs={'class':'other'})
  48.                   ]
  49.     remove_attributes = ['width','height']
  50.  
  51.     feeds = [
  52.                 (u'Portada', u'http://www.europasur.es/rss/articles.php')
  53.                ,(u'Deportes', u'http://www.europasur.es/rss/articles.php?sec=1224')
  54.                ,(u'Economia', u'http://www.europasur.es/rss/articles.php?sec=427')
  55.                ,(u'Espana', u'http://www.europasur.es/rss/articles.php?sec=437')
  56.                ,(u'Mundo', u'http://www.europasur.es/rss/articles.php?sec=428')
  57.                ,(u'Pasarela', u'http://www.europasur.es/rss/articles.php?sec=1958')
  58.                ,(u'Ocio y cultura', u'http://www.europasur.es/rss/articles.php?sec=1210')
  59.                ,(u'Opinion', u'http://www.europasur.es/rss/articles.php?sec=1195')
  60.                ,(u'Tecnologia', u'http://www.europasur.es/rss/articles.php?sec=1681')
  61.                ,(u'Salud', u'http://www.europasur.es/rss/articles.php?sec=2379')
  62.             ]
  63.  
  64.     def image_url_processor(self, baseurl, url):
  65.         artl, sep, width = url.rpartition('&an=')
  66.         artid, sep, ext = artl.rpartition('.')
  67.         article_id = artid.rpartition('/')[2]
  68.         return 'http://media.grupojoly.com/cache/' + article_id + '_' + width + 'x' + width + '_' + ext + '000.' + ext
  69.