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

  1. from calibre.web.feeds.news import BasicNewsRecipe
  2.  
  3. class DilemaVeche(BasicNewsRecipe):
  4.     title          = u'Dilema Veche' # apare vinerea, mai pe dupa-masa,depinde de Luiza cred (care se semneaza ca fiind creatorul fiecarui articol in feed-ul RSS)
  5.     __author__            = 'song2' # inspirat din scriptul pentru Le Monde. Inspired from the Le Monde script
  6.     description           = '"Sint vechi, domnule!" (I.L. Caragiale)'
  7.     publisher             = 'Adevarul Holding'
  8.     oldest_article        = 7
  9.     max_articles_per_feed = 200
  10.     encoding              = 'utf8'
  11.     language = 'ro'
  12.     masthead_url = 'http://www.dilemaveche.ro/sites/all/themes/dilema/theme/dilema_two/layouter/dilema_two_homepage/logo.png'
  13.     publication_type = 'magazine'
  14.     feeds = [
  15.                 ('Editoriale si opinii - Situatiunea', 'http://www.dilemaveche.ro/taxonomy/term/37/0/feed'),
  16.                 ('Editoriale si opinii - Pe ce lume traim', 'http://www.dilemaveche.ro/taxonomy/term/38/0/feed'),
  17.                 ('Editoriale si opinii - Bordeie si obiceie', 'http://www.dilemaveche.ro/taxonomy/term/44/0/feed'),
  18.                 ('Editoriale si opinii - Talc Show', 'http://www.dilemaveche.ro/taxonomy/term/44/0/feed'),
  19.                 ('Tema saptamanii', 'http://www.dilemaveche.ro/taxonomy/term/19/0/feed'),
  20.                 ('La zi in cultura - Dilema va recomanda', 'http://www.dilemaveche.ro/taxonomy/term/58/0/feed'),
  21.                 ('La zi in cultura - Carte', 'http://www.dilemaveche.ro/taxonomy/term/14/0/feed'),
  22.                 ('La zi in cultura - Film', 'http://www.dilemaveche.ro/taxonomy/term/13/0/feed'),
  23.                 ('La zi in cultura - Muzica', 'http://www.dilemaveche.ro/taxonomy/term/1341/0/feed'),
  24.                 ('La zi in cultura - Arte performative', 'http://www.dilemaveche.ro/taxonomy/term/1342/0/feed'),
  25.                 ('La zi in cultura - Arte vizuale', 'http://www.dilemaveche.ro/taxonomy/term/1512/0/feed'),
  26.                 ('Societate - Ieri cu vedere spre azi', 'http://www.dilemaveche.ro/taxonomy/term/15/0/feed'),
  27.                 ('Societate - Din polul opus', 'http://www.dilemaveche.ro/taxonomy/term/41/0/feed'),
  28.                 ('Societate - Mass comedia', 'http://www.dilemaveche.ro/taxonomy/term/43/0/feed'),
  29.                 ('Societate - La singular si la plural', 'http://www.dilemaveche.ro/taxonomy/term/42/0/feed'),
  30.                 ('Oameni si idei - Educatie', 'http://www.dilemaveche.ro/taxonomy/term/46/0/feed'),
  31.                 ('Oameni si idei - Polemici si dezbateri', 'http://www.dilemaveche.ro/taxonomy/term/48/0/feed'),
  32.                 ('Oameni si idei - Stiinta si tehnologie', 'http://www.dilemaveche.ro/taxonomy/term/46/0/feed'),
  33.                 ('Dileme on-line', 'http://www.dilemaveche.ro/taxonomy/term/005/0/feed')
  34.                  ]
  35.     remove_tags_before = dict(name='div',attrs={'class':'spacer_10'})
  36.     remove_tags = [
  37.         dict(name='div', attrs={'class':'art_related_left'}),
  38.         dict(name='div', attrs={'class':'controale'}),
  39.         dict(name='div', attrs={'class':'simple_overlay'}),
  40.     ]
  41.     remove_tags_after = [dict(id='facebookLike')]
  42.     remove_javascript = True
  43.     no_stylesheets        = True
  44.     remove_empty_feeds = True
  45.     extra_css             = """
  46.         body{font-family: Georgia,Times,serif }
  47.         img{margin-bottom: 0.4em; display:block}
  48.                             """
  49.     def get_cover_url(self):
  50.         cover_url = None
  51.         soup = self.index_to_soup('http://dilemaveche.ro')
  52.         link_item = soup.find('div',attrs={'class':'box_dr_pdf_picture'})
  53.         if link_item and link_item.a:
  54.            cover_url = link_item.a['href']
  55.         br = BasicNewsRecipe.get_browser()
  56.         try:
  57.             br.open(cover_url)
  58.         except: #daca nu gaseste pdf-ul
  59.             self.log("\nPDF indisponibil")
  60.             link_item = soup.find('div',attrs={'class':'box_dr_pdf_picture'})
  61.             if link_item and link_item.img:
  62.                 cover_url = link_item.img['src']
  63.             br = BasicNewsRecipe.get_browser()
  64.             try:
  65.                  br.open(cover_url)
  66.             except: #daca nu gaseste nici imaginea mica mica
  67.                 print('Mama lor de nenorociti! nu este nici pdf nici imagine')
  68.                 cover_url ='http://www.dilemaveche.ro/sites/all/themes/dilema/theme/dilema_two/layouter/dilema_two_homepage/logo.png'
  69.         return cover_url
  70.     cover_margins = (10, 15, '#ffffff')
  71.  
  72.