home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_3756 < prev    next >
Encoding:
Text File  |  2010-08-04  |  2.7 KB  |  75 lines

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2010, Saverio Palmieri Neto <saverio.palmieri at gmail.com>'
  5. '''
  6. folha.uol.com.br
  7. '''
  8.  
  9. from calibre.web.feeds.news import BasicNewsRecipe
  10.  
  11. class FolhaOnline(BasicNewsRecipe):
  12.     title                 = 'Folha de Sao Paulo'
  13.     __author__            = 'Saverio Palmieri Neto'
  14.     description           = 'Brazilian news from Folha de Sao Paulo Online'
  15.     publisher             = 'Folha de Sao Paulo'
  16.     category              = 'Brasil, news'
  17.     oldest_article        = 2
  18.     max_articles_per_feed = 1000
  19.     summary_length        = 2048
  20.     no_stylesheets        = True
  21.     use_embedded_content  = False
  22.     timefmt               = ' [%d %b %Y (%a)]'
  23.     encoding              = 'cp1252'
  24.     cover_url             = 'http://lh5.ggpht.com/_hEb7sFmuBvk/TFoiKLRS5dI/AAAAAAAAADM/kcVKggZwKnw/capa_folha.jpg'
  25.     cover_margins         = (5,5,'white')
  26.     remove_javascript     = True
  27.  
  28.     keep_only_tags = [dict(name='div', attrs={'id':'articleNew'})]
  29.  
  30.     remove_tags = [
  31.                      dict(name='script')
  32.                     ,dict(name='div',
  33.                         attrs={'id':[
  34.                             'articleButton'
  35.                             ,'bookmarklets'
  36.                             ,'ad-180x150-1'
  37.                             ,'contextualAdsArticle'
  38.                             ,'articleEnd'
  39.                             ,'articleComments'
  40.                             ]})
  41.                     ,dict(name='div',
  42.                         attrs={'class':[
  43.                             'openBox adslibraryArticle'
  44.                             ]})
  45.                     ,dict(name='a')
  46.                     ,dict(name='iframe')
  47.                     ,dict(name='link')
  48.                   ]
  49.  
  50.  
  51.     feeds = [
  52.     (u'Em cima da hora', u'http://feeds.folha.uol.com.br/emcimadahora/rss091.xml')
  53.     ,(u'Ambiente', u'http://feeds.folha.uol.com.br/ambiente/rss091.xml')
  54.     ,(u'Bichos', u'http://feeds.folha.uol.com.br/bichos/rss091.xml')
  55.     ,(u'Poder', u'http://feeds.folha.uol.com.br/poder/rss091.xml')
  56.     ,(u'Ciencia', u'http://feeds.folha.uol.com.br/ciencia/rss091.xml')
  57.     ,(u'Cotidiano', u'http://feeds.folha.uol.com.br/cotidiado/rss091.xml')
  58.     ,(u'Saber', u'http://feeds.folha.uol.com.br/saber/rss091.xml')
  59.     ,(u'Equil├¡brio e Sa├║de', u'http://feeds.folha.uol.com.br/equilibrioesaude/rss091.xml')
  60.     ,(u'Esporte', u'http://feeds.folha.uol.com.br/esporte/rss091.xml')
  61.     ,(u'Ilustrada', u'http://feeds.folha.uol.com.br/ilustrada/rss091.xml')
  62.     ,(u'Ilustr├¡ssima', u'http://feeds.folha.uol.com.br/ilustrissima/rss091.xml')
  63.     ,(u'Mercado', u'http://feeds.folha.uol.com.br/mercado/rss091.xml')
  64.     ,(u'Mundo', u'http://feeds.folha.uol.com.br/mundo/rss091.xml')
  65.     ,(u'Tec', u'http://feeds.folha.uol.com.br/tec/rss091.xml')
  66.     ,(u'Turismo', u'http://feeds.folha.uol.com.br/turismo/rss091.xml')
  67.             ]
  68.  
  69.     def preprocess_html(self, soup):
  70.         for item in soup.findAll(style=True):
  71.             del item['style']
  72.         return soup
  73.  
  74.     language = 'pt'
  75.