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

  1. # -*- coding: utf-8 -*-
  2. #!/usr/bin/env  python
  3.  
  4. __license__   = 'GPL v3'
  5. __copyright__ = u'2011, Silviu Cotoar\u0103'
  6. '''
  7. promotor.ro
  8. '''
  9.  
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class Promotor(BasicNewsRecipe):
  13.     title                 = u'Promotor'
  14.     __author__            = u'Silviu Cotoar\u0103'
  15.     description           = u'Auto-moto'
  16.     publisher             = u'Promotor'
  17.     oldest_article        = 25
  18.     language              = 'ro'
  19.     max_articles_per_feed = 100
  20.     no_stylesheets        = True
  21.     use_embedded_content  = False
  22.     category              = 'Ziare,Reviste,TV,Auto'
  23.     encoding              = 'utf-8'
  24.     cover_url             = 'http://www.promotor.ro/images/logo_promotor.gif'
  25.  
  26.     conversion_options = {
  27.                              'comments'   : description
  28.                             ,'tags'       : category
  29.                             ,'language'   : language
  30.                             ,'publisher'  : publisher
  31.                          }
  32.     extra_css = '''
  33.                     h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
  34.                     h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
  35.                     .byline {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;}
  36.                     .date {font-family:Arial,Helvetica,sans-serif; font-size:xx-small;}
  37.                     p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  38.                     .copyright {font-family:Arial,Helvetica,sans-serif;font-size:xx-small;text-align:center}
  39.                     .story{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  40.                     .entry-asset asset hentry{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  41.                     .pagebody{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  42.                     .maincontentcontainer{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  43.                     .story-body{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  44.                     body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
  45.                 '''
  46.  
  47.     keep_only_tags = [
  48.                           dict(name='div', attrs={'class':'casetatitluarticol'})
  49.                         , dict(name='div', attrs={'style':'width: 273px; height: 210px; overflow: hidden; margin: 0pt auto;'})
  50.                         , dict(name='div', attrs={'class':'textb'})
  51.                         , dict(name='div', attrs={'class':'contentarticol'})
  52.                      ]
  53.  
  54.     remove_tags = [
  55.                       dict(name='td', attrs={'class':['connect_widget_vertical_center connect_widget_button_cell']})
  56.                     , dict(name='div', attrs={'class':['etichetagry']})
  57.                     , dict(name='span', attrs={'class':['textb']})
  58.                   ]
  59.  
  60.     remove_tags_after = [
  61.                               dict(name='div', attrs={'class':['etichetagry']})
  62.                             , dict(name='span', attrs={'class':['textb']})
  63.                         ]
  64.  
  65.     feeds          = [
  66.                         (u'Feeds', u'http://www.promotor.ro/rss')
  67.                      ]
  68.  
  69.     def preprocess_html(self, soup):
  70.         return self.adeify_images(soup)
  71.