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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. www.iprofesional.com
  5. '''
  6.  
  7. from calibre.web.feeds.news import BasicNewsRecipe
  8.  
  9. class iProfesional(BasicNewsRecipe):
  10.     title                 = 'iProfesional.com'
  11.     __author__            = 'Darko Miletic'
  12.     description           = 'Las ultimas noticias sobre profesionales'
  13.     publisher             = 'Emprendimientos Corporativos S.A.'
  14.     category              = 'news, IT, impuestos, negocios, politics, Argentina'
  15.     oldest_article        = 2
  16.     max_articles_per_feed = 200
  17.     no_stylesheets        = True
  18.     encoding              = 'utf8'
  19.     use_embedded_content  = False
  20.     language              = 'es_AR'
  21.     remove_empty_feeds    = True
  22.     publication_type      = 'nesportal'
  23.     masthead_url          = 'http://www.iprofesional.com/img/logo-iprofesional.png'
  24.     extra_css             = """
  25.                                body{font-family: Arial,Helvetica,sans-serif }
  26.                                img{margin-bottom: 0.4em; display:block}
  27.                                .titulo-interior{font-family: Georgia,"Times New Roman",Times,serif}
  28.                                .autor-nota{font-size: small; font-weight: bold; font-style: italic; color: gray}
  29.                             """
  30.  
  31.     conversion_options = {
  32.                           'comment'   : description
  33.                         , 'tags'      : category
  34.                         , 'publisher' : publisher
  35.                         , 'language'  : language
  36.                         }
  37.  
  38.     keep_only_tags = [dict(attrs={'class':['fecha','interior-nota']})]
  39.  
  40.     remove_tags = [
  41.                      dict(name=['meta','link','base','embed','object','iframe'])
  42.                     ,dict(attrs={'class':['menu-imprimir','guardarNota','IN-widget','fin','permalink']})
  43.                   ]
  44.     remove_attributes=['lang','xmlns:og','xmlns:fb']
  45.  
  46.  
  47.     feeds = [
  48.               (u'Ultimas noticias'  , u'http://feeds.feedburner.com/iprofesional-principales-noticias')
  49.              ,(u'Finanzas'          , u'http://feeds.feedburner.com/iprofesional-finanzas'            )
  50.              ,(u'Impuestos'         , u'http://feeds.feedburner.com/iprofesional-impuestos'           )
  51.              ,(u'Negocios'          , u'http://feeds.feedburner.com/iprofesional-economia'            )
  52.              ,(u'Comercio Exterior' , u'http://feeds.feedburner.com/iprofesional-comercio-exterior'   )
  53.              ,(u'Tecnologia'        , u'http://feeds.feedburner.com/iprofesional-tecnologia'          )
  54.              ,(u'Management'        , u'http://feeds.feedburner.com/iprofesional-managment'           )
  55.              ,(u'Marketing'         , u'http://feeds.feedburner.com/iprofesional-marketing'           )
  56.              ,(u'Legales'           , u'http://feeds.feedburner.com/iprofesional-legales'             )
  57.              ,(u'Autos'             , u'http://feeds.feedburner.com/iprofesional-autos'               )
  58.              ,(u'Vinos'             , u'http://feeds.feedburner.com/iprofesional-vinos-bodegas'       )
  59.             ]
  60.  
  61.     def preprocess_html(self, soup):
  62.         for item in soup.findAll(style=True):
  63.             del item['style']
  64.         for item in soup.findAll('a'):
  65.             limg = item.find('img')
  66.             if item.string is not None:
  67.                str = item.string
  68.                item.replaceWith(str)
  69.             else:
  70.                if limg:
  71.                   item.name = 'div'
  72.                   item.attrs = []
  73.                else:
  74.                    str = self.tag_to_string(item)
  75.                    item.replaceWith(str)
  76.         for item in soup.findAll('img'):
  77.             if not item.has_key('alt'):
  78.                item['alt'] = 'image'
  79.         return soup
  80.