home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / pc_advisor.recipe < prev    next >
Text File  |  2011-09-09  |  6KB  |  88 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__ = 'PC Advisor delivers expert advice you can trust to business and home PC users who want to buy the best-value equipment and make the most out of the equipment they already own.'
  8.  
  9. '''
  10. http://www.pcadvisor.co.uk/
  11. '''
  12.  
  13. from calibre.web.feeds.news import BasicNewsRecipe
  14.  
  15. class pcAdvisor(BasicNewsRecipe):
  16.     __author__    = 'Lorenzo Vigentini'
  17.     description   = 'PC Advisor delivers expert advice you can trust to business and home PC users who want to buy the best-value equipment and make the most out of the equipment they already own.'
  18.  
  19.     cover_url      = 'http://media.pcadvisor.co.uk/images/spacer.gif'
  20.     title          = 'Pc Advisor '
  21.     publisher      = 'IDG Communication'
  22.     category       = 'PC, computing, product reviews, UK'
  23.  
  24.     language       = 'en'
  25.     encoding       = 'cp1252'
  26.     timefmt        = '[%a, %d %b, %Y]'
  27.  
  28.     oldest_article        = 15
  29.     max_articles_per_feed = 25
  30.     use_embedded_content  = False
  31.     recursion             = 10
  32.  
  33.     remove_javascript     = True
  34.     no_stylesheets = True
  35.  
  36.     keep_only_tags     = [
  37.                             dict(name='div', attrs={'id':'articlecontent'})
  38.                         ]
  39.  
  40.     remove_tags        = [
  41.                             dict(name='div', attrs={'id':['crosssitesignup','submitarticle','dontPrint','commentsForm','userReviewFormContainer','reevooContainerId']}),
  42.                             dict(name='div', attrs={'class':'mpu'}),
  43.                             dict(name='p', attrs={'id':'articlePageList'}),
  44.                             dict(name='div', attrs={'style':['margin: 0pt 10px 5px;','margin: 0pt 10px 5px;']}),
  45.                             dict(name='p', attrs={'class':'dontPrint'}),
  46.                             dict(name='h2', attrs={'class':'sectionTitle'}),
  47.                             dict(name='a', attrs={'title':'Subscribe to PC Advisor'}),
  48.                             dict(name='a', attrs={'name':'revooContent'}),
  49.                             {'name':['form','script','link']}
  50.                         ]
  51.  
  52.     remove_tags_after = [
  53.                             dict(name='p', attrs={'id':'crosssitesignup'})
  54.                         ]
  55.  
  56.     def get_article_url(self, article):
  57.         return article.get('guid',  None)
  58.  
  59.     feeds          = [
  60.                        (u'News Headlines', u'http://www.pcadvisor.co.uk/rss/feeds/pcanews.xml'),
  61.                        (u'Reviews', u'http://www.pcadvisor.co.uk/rss/feeds/pcareviews.xml'),
  62.                        (u'New Products', u'http://www.pcadvisor.co.uk/rss/feeds/blog18.xml'),
  63.                        (u'PC Advisor Blog', u'http://www.pcadvisor.co.uk/rss/feeds/blog4.xml'),
  64.                        (u'PC Security', u'http://www.pcadvisor.co.uk/rss/feeds/pca-security.xml'),
  65.                        (u'Laptops', u'http://www.pcadvisor.co.uk/rss/feeds/pca-laptop.xml'),
  66.                        (u'Green Computing', u'http://www.pcadvisor.co.uk/rss/feeds/pca-green-computing.xml'),
  67.                        (u'Internet and broadband', u'http://www.pcadvisor.co.uk/rss/feeds/pca-internet.xml'),
  68.                        (u'Prones and PDAs', u'http://www.pcadvisor.co.uk/rss/feeds/pca-phones.xml'),
  69.                        (u'Software', u'http://www.pcadvisor.co.uk/rss/feeds/pca-software.xml'),
  70.                        (u'Small Business', u'http://www.pcadvisor.co.uk/rss/feeds/pca-small-business.xml'),
  71.                        (u'Photo and video', u'http://www.pcadvisor.co.uk/rss/feeds/pca-photo-video.xml'),
  72.                        (u'Mac News', u'http://www.pcadvisor.co.uk/rss/feeds/pca-mac.xml'),
  73.                        (u'Linux', u'http://www.pcadvisor.co.uk/rss/feeds/pca-linux.xml'),
  74.                        (u'WiFi and Networking', u'http://www.pcadvisor.co.uk/rss/feeds/pca-networking.xml'),
  75.                        (u'Gadgets', u'http://www.pcadvisor.co.uk/rss/feeds/pca-gadgets.xml')
  76.                      ]
  77.  
  78.     extra_css = '''
  79.                 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;}
  80.                 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; }
  81.                 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;}
  82.                 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; }
  83.                 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;}
  84.                 .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;}
  85.                 .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;}
  86.                 p {font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:10px;}
  87.                 '''
  88.