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

  1. from calibre.ebooks.BeautifulSoup import BeautifulSoup
  2. from calibre.web.feeds.news import BasicNewsRecipe
  3.  
  4. class Forbes(BasicNewsRecipe):
  5.     title          = u'Forbes'
  6.     description    = 'Business and Financial News'
  7.     __author__     = 'Darko Miletic'
  8.     oldest_article = 30
  9.     max_articles_per_feed = 100
  10.     language = 'en'
  11.  
  12.     no_stylesheets = True
  13.     html2lrf_options = ['--base-font-size', '10']     
  14.  
  15.     cover_url  = u'http://www.forbes.com/media/current_covers/forbes_120_160.gif'
  16.     
  17.     feeds          = [(u'Latest', u'http://www.forbes.com/news/index.xml'), 
  18.         (u'Most Popular', u'http://www.forbes.com/feeds/popstories.xml'), 
  19.         (u'Most Emailed', u'http://www.forbes.com/feeds/mostemailed.xml'), 
  20.         (u'Faces', u'http://www.forbes.com/facesscan/index.xml'), 
  21.         (u'Technology', u'http://www.forbes.com/technology/index.xml'), 
  22.         (u'Personal Tech', u'http://www.forbes.com/personaltech/index.xml'), 
  23.         (u'Wireless', u'http://www.forbes.com/wireless/index.xml'),
  24.         (u'Business', u'http://www.forbes.com/business/index.xml'), 
  25.         (u'Sports Money', u'http://www.forbes.com/sportsmoney/index.xml'), 
  26.         (u'Sports', u'http://www.forbes.com/forbeslife/sports/index.xml'),
  27.         (u'Vehicles', u'http://www.forbes.com/forbeslife/vehicles/index.xml'),
  28.         (u'Leadership', u'http://www.forbes.com/leadership/index.xml'), 
  29.         (u'Careers', u'http://www.forbes.com/leadership/careers/index.xml'),
  30.         (u'Compensation', u'http://www.forbes.com/leadership/compensation/index.xml'),
  31.         (u'Managing', u'http://www.forbes.com/leadership/managing/index.xml')]
  32.  
  33.     def print_version(self, url):
  34.         raw = self.browser.open(url).read()
  35.         soup = BeautifulSoup(raw.decode('latin1', 'replace'))
  36.         print_link = soup.find('a', {'onclick':"s_linkTrackVars='prop18';s_linkType='o';s_linkName='Print';if(typeof(globalPageName)!='undefined')s_prop18=globalPageName;s_lnk=s_co(this);s_gs(s_account);"})
  37.         if print_link is None:
  38.             return ''
  39.         return 'http://www.forbes.com' + print_link['href']