home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / cio.recipe < prev    next >
Text File  |  2011-09-09  |  8KB  |  112 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__ = 'CIO is the leading information brand for today s busy chief information officer. '
  8.  
  9. '''
  10. http://www.cio.co.uk/
  11. '''
  12.  
  13. from calibre.web.feeds.news import BasicNewsRecipe
  14. from calibre.ptempfile import PersistentTemporaryFile
  15.  
  16. class cio(BasicNewsRecipe):
  17.     __author__    = 'Lorenzo Vigentini'
  18.     description   = 'CIO is the leading information brand for today\'s busy chief information officer.'
  19.     cover_url     = 'http://media.cio.co.uk/graphics/shared/cio-logo.gif'
  20.  
  21.     title          = 'CIO '
  22.     publisher      = 'IDG Communication'
  23.     category       = 'IT, technology, business, industry'
  24.  
  25.     language       = 'en'
  26.     timefmt        = '[%a, %d %b, %Y]'
  27.  
  28.     oldest_article        = 7
  29.     max_articles_per_feed = 10
  30.     use_embedded_content  = False
  31.     recursion             = 10
  32.  
  33.     remove_javascript     = True
  34.     no_stylesheets        = True
  35.  
  36.     temp_files = []
  37.     articles_are_obfuscated = True
  38.  
  39.     def get_obfuscated_article(self, url):
  40.         br = self.get_browser()
  41.         br.open(url)
  42.         response = br.follow_link(url_regex='&print&intcmp=ROSATT2$', nr = 0)
  43.         html = response.read()
  44.         self.temp_files.append(PersistentTemporaryFile('_fa.html'))
  45.         self.temp_files[-1].write(html)
  46.         self.temp_files[-1].close()
  47.         return self.temp_files[-1].name
  48.  
  49.     keep_only_tags     = [
  50.                             dict(name='div', attrs={'id':'mainContent'})
  51.                         ]
  52.  
  53.     feeds          = [
  54.                         (u'News', u'http://www.cio.co.uk/rss/feeds/cio-news.xml'),
  55.                         (u'Debate', u'http://www.cio.co.uk/rss/feeds/cio-debate.xml'),
  56.                         (u'Analysis', u'http://www.cio.co.uk/rss/feeds/cio-analysis.xml'),
  57.                         (u'Opinion', u'http://www.cio.co.uk/rss/feeds/cio-opinion.xml'),
  58.                         (u'In-Depth', u'http://www.cio.co.uk/rss/feeds/cio-in-depth.xml'),
  59.                         (u'Change management', u'http://www.cio.co.uk/rss/feeds/cio-change-management-management.xml'),
  60.                         (u'Regulatory compliance', u'http://www.cio.co.uk/rss/feeds/cio-regulatory-compliance-management.xml'),
  61.                         (u'Business strategy', u'http://www.cio.co.uk/rss/feeds/cio-business-strategy-management.xml'),
  62.                         (u'Technology', u'http://www.cio.co.uk/rss/feeds/cio-technology-management.xml'),
  63.                         (u'Security', u'http://www.cio.co.uk/rss/feeds/cio-security-management.xml'),
  64.                         (u'Soft skills', u'http://www.cio.co.uk/rss/feeds/cio-soft-skills-management.xml'),
  65.                         (u'The CIO career', u'http://www.cio.co.uk/rss/feeds/cio-cio-career-management.xml'),
  66.                         (u'Budgets', u'http://www.cio.co.uk/rss/feeds/cio-budgets-management.xml'),
  67.                         (u'Supplier management', u'http://www.cio.co.uk/rss/feeds/cio-supplier-management-management.xml'),
  68.                         (u'Board politics', u'http://www.cio.co.uk/rss/feeds/cio-board-politics-management.xml'),
  69.                         (u'Enterprise software', u'http://www.cio.co.uk/rss/feeds/cio-enterprise-software-technology.xml'),
  70.                         (u'Mobile and wireless', u'http://www.cio.co.uk/rss/feeds/cio-mobile-wireless-technology.xml'),
  71.                         (u'Security', u'http://www.cio.co.uk/rss/feeds/cio-security-technology.xml'),
  72.                         (u'Storage', u'http://www.cio.co.uk/rss/feeds/cio-storage-technology.xml'),
  73.                         (u'Desktop and client', u'http://www.cio.co.uk/rss/feeds/cio-desktop-client-technology.xml'),
  74.                         (u'Outsourcing', u'http://www.cio.co.uk/rss/feeds/cio-outsourcing-technology.xml'),
  75.                         (u'Internet and e-commerce', u'http://www.cio.co.uk/rss/feeds/cio-internet-technology.xml'),
  76.                         (u'Database management', u'http://www.cio.co.uk/rss/feeds/cio-database-management-technology.xml'),
  77.                         (u'Communications and networking ', u'http://www.cio.co.uk/rss/feeds/cio-communication-networking-technology.xml'),
  78.                         (u'Grid computing', u'http://www.cio.co.uk/rss/feeds/cio-grid-computing-cloud-technology.xml'),
  79.                         (u'Enterprise search', u'http://www.cio.co.uk/rss/feeds/cio-enterprise-search-technology.xml'),
  80.                         (u'CRM ', u'http://www.cio.co.uk/rss/feeds/cio-crm-technology.xml'),
  81.                         (u'Ade McCormack ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-ade-mccormack.xml'),
  82.                         (u'Andy Hayler ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-andy-hayler.xml'),
  83.                         (u'CEB ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-ceb.xml'),
  84.                         (u'CIO Staff ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-cio-staff.xml'),
  85.                         (u'Dave Pepperell ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-dave-pepperell.xml'),
  86.                         (u'Elliot Limb ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-elliot-limb.xml'),
  87.                         (u'Freeform Dynamics ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-freeform-dynamics.xml'),
  88.                         (u'Giles Nelson ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-giles-nelson.xml'),
  89.                         (u'Mark Chillingworth ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-mark-chillingworth.xml'),
  90.                         (u'Martin Veitch ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-martin-veitch.xml'),
  91.                         (u'Mike Altendorf ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-mike-altendorf.xml'),
  92.                         (u'Richard Steel ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-richard-steel.xml'),
  93.                         (u'Richard Sykes ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-richard-sykes.xml'),
  94.                         (u'Rob Llewellyn ', u'http://www.cio.co.uk/rss/feeds/cio-opinion-rob-llewellyn.xml'),
  95.                         (u'Free thinking ', u'http://www.cio.co.uk/rss/feeds/cio-blog-free-thinking.xml'),
  96.                         (u'Leading CIOs ', u'http://www.cio.co.uk/rss/feeds/cio-blog-leading-cios.xml'),
  97.                         (u'CIO News View ', u'http://www.cio.co.uk/rss/feeds/cio-blog-cio-news-view.xml'),
  98.                         (u'CIO Blog ', u'http://www.cio.co.uk/rss/feeds/cio-blog-cio-blog.xml'),
  99.                         (u'Transformation CIO ', u'http://www.cio.co.uk/rss/feeds/cio-blog-transformation-cio.xml')
  100.                     ]
  101.  
  102.     extra_css = '''
  103.                 h1 {color:#FF2222;font-family: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:20px;}
  104.                 h2 {color:#4D4D4D;font-family: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:16px; }
  105.                 h3 {color:#4D4D4D;font-family:Arial,Helvetica,sans-serif; font-size:15px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:15px;}
  106.                 h4 {color:#333333; font-family:Arial,Helvetica,sans-serif;font-size:13px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:13px; }
  107.                 h5 {color:#333333; font-family:Arial,Helvetica,sans-serif; font-size:11px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:11px; text-transform:uppercase;}
  108.                 .newsdate {color:#333333;font-family: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;}
  109.                 .articleInfo {color:#4D4D4D;font-family: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;}
  110.                 img {align:left;}
  111.                 '''
  112.