home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_3601 < prev    next >
Encoding:
Text File  |  2010-07-17  |  1.4 KB  |  39 lines

  1. from calibre.ptempfile import PersistentTemporaryFile
  2. from calibre.web.feeds.news import BasicNewsRecipe
  3.  
  4. class Alternet(BasicNewsRecipe):
  5.     title          = u'Alternet'
  6.     __author__= 'rty'
  7.     oldest_article = 7
  8.     max_articles_per_feed = 100
  9.     publisher = 'alternet.org'
  10.     category = 'News, Magazine'
  11.     description = 'News magazine and online community'
  12.     feeds          = [
  13.     (u'Front Page', u'http://feeds.feedblitz.com/alternet'),
  14.     (u'Breaking News', u'http://feeds.feedblitz.com/alternet_breaking_news'),
  15.     (u'Top Ten Campaigns', u'http://feeds.feedblitz.com/alternet_top_10_campaigns'),
  16.     (u'Special Coverage Areas', u'http://feeds.feedblitz.com/alternet_coverage')
  17.     ]
  18.     remove_attributes = ['width', 'align','cellspacing']
  19.     remove_javascript = True
  20.     use_embedded_content   = False
  21.     no_stylesheets = True
  22.     language = 'en'
  23.     encoding               = 'UTF-8'
  24.     temp_files = []
  25.     articles_are_obfuscated = True
  26.  
  27.     def get_article_url(self, article):
  28.        return article.get('link',  None)
  29.  
  30.     def get_obfuscated_article(self, url):
  31.         br = self.get_browser()
  32.         br.open(url)
  33.         response = br.follow_link(url_regex = r'/printversion/[0-9]+', nr = 0)
  34.         html = response.read()
  35.         self.temp_files.append(PersistentTemporaryFile('_fa.html'))
  36.         self.temp_files[-1].write(html)
  37.         self.temp_files[-1].close()
  38.         return self.temp_files[-1].name
  39.