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

  1. __license__   = 'GPL v3'
  2. __copyright__ = '2008-2010, Darko Miletic <darko.miletic at gmail.com>'
  3. '''
  4. pescanik.net
  5. '''
  6.  
  7. import re
  8. from calibre.web.feeds.news import BasicNewsRecipe
  9. from calibre.ebooks.BeautifulSoup import Tag
  10.  
  11. class Pescanik(BasicNewsRecipe):
  12.     title                 = 'Pescanik'
  13.     __author__            = 'Darko Miletic'
  14.     description           = 'Pescanik'
  15.     publisher             = 'Pescanik'
  16.     category              = 'news, politics, Serbia'
  17.     oldest_article        = 10
  18.     max_articles_per_feed = 100
  19.     no_stylesheets        = True
  20.     use_embedded_content  = False
  21.     encoding              = 'utf-8'
  22.     language              = 'sr'
  23.     publication_type      = 'newsportal'    
  24.     extra_css             = ' @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} .article_description,body{font-family: Arial,"Lucida Grande",Tahoma,Verdana,sans1,sans-serif} .contentheading{font-size: x-large; font-weight: bold} .small{font-size: small} .createdate{font-size: x-small; font-weight: bold} '
  25.  
  26.     conversion_options = {
  27.                           'comment'   : description
  28.                         , 'tags'      : category
  29.                         , 'publisher' : publisher
  30.                         , 'language'  : language
  31.                         }
  32.  
  33.  
  34.     preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
  35.     
  36.     remove_attributes = ['valign','colspan','width','height','align','alt']
  37.     
  38.     remove_tags = [dict(name=['object','link','meta','script'])]
  39.  
  40.     keep_only_tags = [
  41.                          dict(attrs={'class':['contentheading','small','createdate']})
  42.                         ,dict(name='td', attrs={'valign':'top','colspan':'2'})                        
  43.                      ]
  44.                   
  45.     feeds       = [(u'Pescanik Online', u'http://www.pescanik.net/index.php?option=com_rd_rss&id=12')]
  46.  
  47.     def print_version(self, url):
  48.         nurl = url.replace('/index.php','/index2.php')
  49.         return nurl + '&pop=1&page=0'
  50.  
  51.     def preprocess_html(self, soup):
  52.         st = soup.findAll('td')
  53.         for it in st:
  54.             it.name='p'
  55.         for pt in soup.findAll('img'):
  56.             brtag = Tag(soup,'br')
  57.             brtag2 = Tag(soup,'br')
  58.             pt.append(brtag)
  59.             pt.append(brtag2)
  60.         return soup
  61.