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

  1. #!/usr/bin/env  python
  2. __license__     = 'GPL v3'
  3. __author__      = 'Lorenzo Vigentini'
  4. __copyright__   = '2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
  5. __version__     = 'v1.01'
  6. __date__        = '14, January 2010'
  7. __description__ = 'Digital Arts - comprehensive coverage of the art of graphic design, 3D, animation, video, effects, web and interactive design, in print and online.'
  8.  
  9. '''
  10. http://media.digitalartsonline.co.uk/
  11. '''
  12.  
  13. from calibre.web.feeds.news import BasicNewsRecipe
  14. from calibre.ptempfile import PersistentTemporaryFile
  15.  
  16. temp_files = []
  17. articles_are_obfuscated = True
  18.  
  19. class digiArts(BasicNewsRecipe):
  20.     __author__    = 'Lorenzo Vigentini'
  21.     description   = 'Digital Arts - comprehensive coverage of the art of graphic design, 3D, animation, video, effects, web and interactive design, in print and online.'
  22.     cover_url     = 'http://media.digitalartsonline.co.uk/graphics/logo_digital_arts.gif'
  23.  
  24.     title          = 'Digital Arts Magazine  '
  25.     publisher      = 'IDG Communication'
  26.     category       = 'Multimedia, photo, video, computing, product reviews, editing, cameras, production'
  27.  
  28.     language       = 'en'
  29.     encoding       = 'cp1252'
  30.     timefmt        = '[%a, %d %b, %Y]'
  31.  
  32.     oldest_article        = 30
  33.     max_articles_per_feed = 100
  34.     use_embedded_content  = False
  35.     recursion             = 10
  36.  
  37.     remove_javascript     = True
  38.     no_stylesheets        = True
  39.  
  40.     def get_obfuscated_article(self, url):
  41.         br = self.get_browser()
  42.         br.open(url+'&print')
  43.  
  44.         response = br.follow_link(url, nr = 0)
  45.         html = response.read()
  46.  
  47.         self.temp_files.append(PersistentTemporaryFile('_fa.html'))
  48.         self.temp_files[-1].write(html)
  49.         self.temp_files[-1].close()
  50.         return self.temp_files[-1].name
  51.  
  52.     keep_only_tags     = [
  53.                             dict(name='div', attrs={'id':['articleHeader','articleContent']})
  54.                         ]
  55.  
  56.     remove_tags        = [
  57.                             dict(name='div', attrs={'class':['submissionBar','mpuContainer']}),
  58.                             dict(name='div', attrs={'id':['articleSidebar','articleFooter']})
  59.                         ]
  60.     remove_tags_after   = [
  61.                             dict(name='p', attrs={'id':'articlePageList'})
  62.                         ]
  63.     feeds          = [
  64.                        (u'Content', u'http://rss.feedsportal.com/c/662/f/8410/index.rss')
  65.                     ]
  66.  
  67.     extra_css = '''
  68.                 h1 {font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:20px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:18px;}
  69.                 h2 {font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:18px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:16px; }
  70.                 h3 {color:#333333;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:16px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:14px;}
  71.                 h4 {color:#333333; font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:16px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:14px; }
  72.                 h5 {color:#333333; font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:12px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:14px; text-transform:uppercase;}
  73.                 .newsdate {color:#333333;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:italic; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
  74.                 .author {color:#333333;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:bold; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
  75.                 img {align:left;}
  76.                 '''
  77.