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

  1. from calibre.web.feeds.news import BasicNewsRecipe
  2. import re
  3.  
  4. class AdvancedUserRecipe1282101454(BasicNewsRecipe):
  5.     title = 'Popular Science'
  6.     language = 'en'
  7.     __author__ = 'TonytheBookworm'
  8.     description = 'Popular Science'
  9.     publisher = 'Popular Science'
  10.     category = 'gadgets,science'
  11.     oldest_article = 7 # change this if you want more current articles. I like to go a week in
  12.     max_articles_per_feed = 100
  13.     no_stylesheets = True
  14.     remove_javascript = True
  15.     use_embedded_content = True
  16.  
  17.     masthead_url = 'http://www.raytheon.com/newsroom/rtnwcm/groups/Public/documents/masthead/rtn08_popscidec_masthead.jpg'
  18.  
  19.  
  20.     feeds          = [
  21.  
  22.                       ('Gadgets', 'http://www.popsci.com/full-feed/gadgets'),
  23.                       ('Cars', 'http://www.popsci.com/full-feed/cars'),
  24.                       ('Science', 'http://www.popsci.com/full-feed/science'),
  25.                       ('Technology', 'http://www.popsci.com/full-feed/technology'),
  26.                       ('DIY', 'http://www.popsci.com/full-feed/diy'),
  27.  
  28.                     ]
  29.  
  30.  
  31.  #The following will get read of the Gallery: links when found
  32.  
  33.     def preprocess_html(self, soup) :
  34.         weblinks = soup.findAll(['head','h2'])
  35.         if weblinks is not None:
  36.             for link in weblinks:
  37.                 if re.search('(Gallery)(:)',str(link)):
  38.  
  39.                   link.parent.extract()
  40.         return soup
  41.   #-----------------------------------------------------------------
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.