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

  1. from calibre.web.feeds.news import BasicNewsRecipe
  2.  
  3. class APOD(BasicNewsRecipe):
  4.     title          = u'Astronomy Picture of the Day'
  5.     __author__  = 'Starson17'
  6.     description = 'Astronomy Pictures'
  7.     language = 'en'
  8.     use_embedded_content    = False
  9.     no_stylesheets        = True
  10.     cover_url     = 'http://apod.nasa.gov/apod/image/1003/m78_torregrosa.jpg'
  11.     remove_javascript = True
  12.     recursions = 0
  13.     oldest_article        = 14
  14.     remove_attributes = ['onmouseover', 'onmouseout']
  15.  
  16.     feeds = [
  17.              (u'Astronomy Picture of the Day', u'http://apod.nasa.gov/apod.rss')
  18.              ]
  19.  
  20.     extra_css = '''
  21.                     h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
  22.                     h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
  23.                     p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  24.                     body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
  25.         '''
  26.     def postprocess_html(self, soup, first_fetch):
  27.         center_tags = soup.findAll(['center'])
  28.         p_tags = soup.findAll(['p'])
  29.         last_center = center_tags[-1:]
  30.         last_center[0].extract()
  31.         first_p = p_tags[:1]
  32.         for tag in first_p:
  33.             tag.extract()
  34.         last2_p = p_tags[-2:]
  35.         for tag in last2_p:
  36.             tag.extract()
  37.         return soup
  38.  
  39.