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

  1. #!/usr/bin/env  python
  2. __license__   = 'GPL v3'
  3. __author__    = 'Gabriele Marini, based on Darko Miletic'
  4. __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
  5. description   = 'Italian daily newspaper - v1.00 05-05-2010'
  6.  
  7. '''
  8. http://www.leggo.it
  9. '''
  10. import time
  11. from calibre.web.feeds.news import BasicNewsRecipe
  12.  
  13. class LeggoIT(BasicNewsRecipe):
  14.     __author__        = 'Gabriele Marini'
  15.     description   = 'Italian Free daily newspaper'
  16.  
  17. #    cover_url      = 'http://www.leggo.it/img/logo-leggo2.gif'
  18.     title          = u'Leggo.it'
  19.     publisher      = 'Ced Caltagirone Editore S.p.A.'
  20.     category       = 'News, politics, culture, economy, general interest'
  21.  
  22.     language       = 'it'
  23.     timefmt        = '[%a, %d %b, %Y]'
  24.  
  25.     oldest_article = 5
  26.     max_articles_per_feed = 100
  27.     use_embedded_content  = False
  28.     recursion             = 100
  29.  
  30.     no_stylesheets        = True
  31.     remove_javascript = True
  32.     conversion_options = {'linearize_tables':True}
  33.  
  34.     keep_only_tags     = [
  35.                           dict(name='h1',attrs={'class':'nero22'}),
  36.                           dict(name='div',attrs={'id':'testodim'})
  37.                          ]
  38.     feeds          = [
  39.                        (u'Home Page', u'http://www.leggo.it/rss/home.xml'),
  40.                        (u'Italia', u'http://www.leggo.it/rss/italia.xml'),
  41.                        (u'Esteri', u'http://www.leggo.it/rss/esteri.xml'),
  42.                        (u'Economia', u'http://www.leggo.it/rss/economia.xml'),
  43.                        (u'Sport', u'http://www.leggo.it/rss/sport.xml'),
  44.                        (u'Gossip', u'http://www.leggo.it/rss/gossip.xml'),
  45.                        (u'Spettacoli', u'http://www.leggo.it/rss/spettacoli.xml'),
  46.                        (u'Salute', u'http://www.leggo.it/rss/salute.xml'),
  47.                        (u'Scienza', u'http://www.leggo.it/rss/scienza.xml')
  48.                      ]
  49.     def get_cover_url(self):
  50.         cover = None
  51.         st = time.localtime()
  52.         year = str(st.tm_year)
  53.         month = "%.2d" % st.tm_mon
  54.         day = "%.2d" % st.tm_mday
  55.         cover='http://www.leggo.it/'+ year +  month + day + '/jpeg/LEGGO_ROMA_1.jpg'
  56.         br = BasicNewsRecipe.get_browser()
  57.         try:
  58.             br.open(cover)
  59.         except:
  60.             cover='http://www.leggo.it/'+ year +  month + day + '/jpeg/LEGGO_ROMA_3.jpg'
  61.             br = BasicNewsRecipe.get_browser()
  62.             try:
  63.                 br.open(cover)
  64.             except:
  65.                 self.log("\nCover unavailable")
  66.                 cover = 'http://www.leggo.it/img/logo-leggo2.gif'
  67.         return cover
  68.  
  69.  
  70.