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

  1. #!/usr/bin/env  python
  2.  
  3. __license__   = 'GPL v3'
  4. __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
  5. '''
  6. linux-magazine.com
  7. '''
  8.  
  9. from calibre.ebooks.BeautifulSoup import BeautifulSoup
  10. from calibre.web.feeds.news import BasicNewsRecipe
  11.  
  12. class LinuxMagazine(BasicNewsRecipe):
  13.     title                 = u'Linux Magazine'
  14.     __author__            = 'Darko Miletic'
  15.     description           = 'Linux news'  
  16.     language = 'en'
  17.   
  18.     oldest_article        = 7
  19.     max_articles_per_feed = 100
  20.     no_stylesheets        = True
  21.     use_embedded_content  = False
  22.  
  23.     remove_tags_after = dict(name='div', attrs={'class':'end_intro'})
  24.     remove_tags = [
  25.                      dict(name='div' , attrs={'class':'end_intro' })
  26.                     ,dict(name='table'  , attrs={'width':'100%'})
  27.                   ]
  28.  
  29.     feeds          = [(u'Linux Magazine Full Feed', u'http://www.linux-magazine.com/rss/feed/lmi_full')]
  30.         
  31.     def print_version(self, url):
  32.         raw = self.browser.open(url).read()
  33.         soup = BeautifulSoup(raw.decode('utf8', 'replace'))
  34.         print_link = soup.find('a', {'title':'Print this page'})
  35.         if print_link is None:
  36.             return url
  37.         return 'http://www.linux-magazine.com'+print_link['href']
  38.     
  39.