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

  1. #!/usr/bin/env  python
  2. __license__     = 'GPL v3'
  3. __author__      = 'DrMerry Based on v1.01 by Lorenzo Vigentini'
  4. __copyright__   = 'For version 1.02, 1.03: DrMerry'
  5. __version__     = 'v1.03'
  6. __date__        = '11, July 2011'
  7. __description__ = 'Computeractive publishes new downloads, reviews, news stories, step-by-step guides and answers to PC problems every day. Original version (c): 2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
  8.  
  9. '''
  10. http://www.computeractive.co.uk/
  11. '''
  12.  
  13. from calibre.web.feeds.news import BasicNewsRecipe
  14. import re
  15.  
  16. class computeractive(BasicNewsRecipe):
  17.     __author__      = 'DrMerry'
  18.     description   = 'Computeractive publishes new downloads, reviews, news stories, step-by-step guides and answers to PC problems every day.'
  19.     cover_url     = 'http://images.pcworld.com/images/common/header/header-logo.gif'
  20.  
  21.     title          = 'Computer act!ve'
  22.     publisher      = 'Incisive media'
  23.     category       = 'PC, video, computing, product reviews, editing, cameras, production'
  24.  
  25.     language       = 'en'
  26.     timefmt        = '[%a, %d %b, %Y]'
  27.  
  28.     oldest_article        = 7
  29.     max_articles_per_feed = 25
  30.     use_embedded_content  = False
  31.     recursion             = 10
  32.  
  33.     remove_javascript     = True
  34.     no_stylesheets        = True
  35.     remove_empty_feeds   = True
  36.     remove_tags_after = dict(name='div', attrs={'class':'article_tags_block'})
  37.  
  38.     keep_only_tags     = [
  39.                             dict(name='div', attrs={'id':'container_left'})
  40.                         ]
  41.  
  42.     remove_tags        = [
  43.                             dict(name='div', attrs={'id':['seeAlsoTags','commentsModule','relatedArticles','mainLeft','mainRight','recent_comment_block_parent','reviewDetails']}),
  44.                             dict(name='div', attrs={'class':['buyIt','detailMpu','small_section','recent_comment_block_parent','title_right_button_fix','section_title.title_right_button_fix','common_button']}),
  45.                             dict(name='a', attrs={'class':'largerImage'})
  46.                         ]
  47.  
  48.     preprocess_regexps = [
  49.         (re.compile(r'(<a [^>]*>|</a>)', re.DOTALL|re.IGNORECASE),
  50.         lambda match: ''),
  51.     ]
  52.  
  53.     feeds          = [
  54.                        (u'General content', u'http://feeds.computeractive.co.uk/rss/latest/computeractive/all'),
  55.                        (u'News', u'http://feeds.computeractive.co.uk/rss/latest/computeractive/news'),
  56.                      ]
  57.  
  58.  
  59.     extra_css = '''
  60.                 h1 {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;}
  61.                 h2 {font-family:Arial,Helvetica,sans-serif; font-size:18px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; }
  62.                 h3 {color:#333333;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;}
  63.                 h4 {color:#333333; font-family:Arial,Helvetica,sans-serif;font-size:14px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold;}
  64.                 h5 {color:#333333; font-family:Arial,Helvetica,sans-serif; font-size:12px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold;text-transform:uppercase;}
  65.                 .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;}
  66.                 .author {color:#333333;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;}
  67.                 p {font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:10px;}
  68.                 .breadcrumbs {margin:0 0 0.6em 0;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:8px;}
  69.                 #breadcrumbsLeft {width:360px; }
  70.                 .breadcrumbs ul {color:#999; display:inline; margin:1em 0 0 0; padding:0; list-style:none; }
  71.                 .breadcrumbs li { display:inline; }
  72.                 .breadcrumbs a:link, .breadcrumbs a:visited { color:#999; text-decoration:none; }
  73.                 .breadcrumbs a:hover, .breadcrumbs a:active { color:#999; text-decoration:underline; }
  74.                 #postHeader #reviewDetails { padding-left: 0px; }
  75.                 #reviewDetails { float:left; margin:0 0 0 10px; padding:0; width:574px; border-top:1px dotted #0071BC; }
  76.             #reviewDetails div { margin:0; padding:0; }
  77.         #reviewDetailsLeft { float:left; width:334px; margin:0 10px 0 0; padding:0; }
  78.         #reviewDetailsRight { float:right; width:230px; margin:0; padding:0; }
  79.             #reviewDetails div h2 { font-size:1.2em; float:none; margin:0.5em 0 0.5em 0; padding:0; }
  80.         #reviewDetails #verdict { width:334px; float:left; margin:0; padding:0; }
  81.         #reviewDetails #ratings, #reviewDetails #price { width:230px; float:left; margin:0; padding:0; }
  82.         #reviewDetails #ratings img { border:0; margin:0; padding:0; }
  83.         #verdict p strong { width:334px; float:left; margin:0 0 0.25em; padding:0; }
  84.         #verdict ul { width:334px; float:left; margin:0; padding:0; }
  85.         #verdict li { width:334px; float:left; list-style:none; clear:left; margin:0 4px 0.3em 0px; padding:0 0 0 12px;}
  86.         html > body #verdict li { width:322px; }
  87.                 #post { margin-bottom:2em; clear:both; }
  88.                 #post .content p { margin:1em 0; line-height:1.5em; }
  89.                 #post p a:link { color:#005599; text-decoration:none; font-weight:bold; }
  90.                 #post p a:hover, #post p a:active { color:#cc0000; text-decoration:underline; }
  91.                 #post p a:visited { color:#003366; text-decoration:none; font-weight:bold; }
  92.                 #postHeader .author { font-weight:normal; margin:1em 8px 0.25em 0; }
  93.                 #postHeader .postMetaData { color:#666; margin:0 8px 0 0; }
  94.                 '''
  95.  
  96.