home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_3611 < prev    next >
Encoding:
Text File  |  2010-03-03  |  1.3 KB  |  38 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.  
  15.     feeds = [
  16.              (u'Astronomy Picture of the Day', u'http://apod.nasa.gov/apod.rss')
  17.              ]
  18.  
  19.     extra_css = '''
  20.                     h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
  21.                     h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
  22.                     p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
  23.                     body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
  24.         '''
  25.     def postprocess_html(self, soup, first_fetch):
  26.         center_tags = soup.findAll(['center'])
  27.         p_tags = soup.findAll(['p'])
  28.         last_center = center_tags[-1:]
  29.         last_center[0].extract()
  30.         first_p = p_tags[:1]
  31.         for tag in first_p:
  32.             tag.extract()
  33.         last2_p = p_tags[-2:]
  34.         for tag in last2_p:
  35.             tag.extract()
  36.         return soup
  37.  
  38.