UPDATE
July 31, 2013
I just wanted to let you know that PCWorld (en) recipe was fetching repeated
articles to it's
sections.
So after investigating the problem, I took it upon myself to update it and also share the update among you. Please post a reply here when it's been updated to calibre, this way I can stop using my custom recipe.
Please note that I did not change any of the other code in the recipe except for the rss links that are found here:
http://www.pcworld.com/about/RSS.html
Here is the code for the entire recipe:
Code:
#!/usr/bin/env python
__license__ = 'GPL v3'
__author__ = 'Lorenzo Vigentini'
__copyright__ = '2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
__version__ = 'v1.01'
__date__ = '14, January 2010'
__description__ = 'PC World and Macworld consistently deliver editorial excellence through award-winning content and trusted product reviews.'
'''
http://www.pcworld.com/
'''
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ptempfile import PersistentTemporaryFile
temp_files = []
articles_are_obfuscated = True
class pcWorld(BasicNewsRecipe):
__author__ = 'Lorenzo Vigentini'
description = 'PC World and Macworld consistently deliver editorial excellence through award-winning content and trusted product reviews.'
cover_url = 'http://images.pcworld.com/images/common/header/header-logo.gif'
title = 'PCWorld '
publisher = 'IDG Communication'
category = 'PC, video, computing, product reviews, editing, cameras, production'
language = 'en'
timefmt = '[%a, %d %b, %Y]'
oldest_article = 7
max_articles_per_feed = 20
use_embedded_content = False
recursion = 10
remove_javascript = True
no_stylesheets = True
auto_cleanup = True
def get_obfuscated_article(self, url):
br = self.get_browser()
br.open(url+'&print')
response = br.follow_link(url, nr = 0)
html = response.read()
self.temp_files.append(PersistentTemporaryFile('_fa.html'))
self.temp_files[-1].write(html)
self.temp_files[-1].close()
return self.temp_files[-1].name
#keep_only_tags = [
#dict(name='div', attrs={'class':'article'})
#]
#remove_tags = [
#dict(name='div', attrs={'class':['toolBar','mac_tags','toolBar btmTools','recommend longRecommend','recommend shortRecommend','textAds']}),
#dict(name='div', attrs={'id':['sidebar','comments','mac_tags']}),
#dict(name='ul', attrs={'class':['tools', 'tools clearfix']}),
#dict(name='li', attrs={'class':'sub'}),
#dict(name='p', attrs={'id':'userDesire'})
#]
feeds = [
(u'All Stories', u'http://www.pcworld.com/index.rss'),
(u'Reviews', u'http://www.pcworld.com/reviews/index.rss'),
(u'How-To', u'http://www.pcworld.com/howto/index.rss'),
(u'Video', u'http://www.pcworld.com/video/index.rss'),
(u'Game On', u'http://www.pcworld.com/column/game-on/index.rss'),
(u'Hassle free PC', u'http://www.pcworld.com/column/hassle-free-pc/index.rss'),
(u'Go Social', u'http://www.pcworld.com/column/go-social/index.rss'),
(u'Linux Line', u'http://www.pcworld.com/column/linux-line/index.rss'),
(u'Net Work', u'http://www.pcworld.com/column/net-work/index.rss'),
(u'Security Alert', u'http://www.pcworld.com/column/security-alert/index.rss'),
(u'Simply Business', u'http://www.pcworld.com/column/simply-business/index.rss'),
(u'Business', u'http://www.pcworld.com/category/business/index.rss'),
(u'Security & Privacy', u'http://www.pcworld.com/category/privacy/index.rss'),
(u'Windows', u'http://www.pcworld.com/category/windows/index.rss'),
(u'Laptops', u'http://www.pcworld.com/category/laptop-computers/index.rss'),
(u'Software', u'http://www.pcworld.com/category/software/index.rss'),
(u'Desktops', u'http://www.pcworld.com/category/desktop-computers/index.rss'),
(u'Printers', u'http://www.pcworld.com/category/printers/index.rss'),
(u'Phones', u'http://www.pcworld.com/category/phones/index.rss'),
(u'Tablets', u'http://www.pcworld.com/category/tablets/index.rss')
]
extra_css = '''
h1 {color:#FF0000;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:18px;}
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; }
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:14px;}
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:14px; }
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:14px; text-transform:uppercase;}
.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;}
.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;}
img {align:left;}
#breadcrumb {}
#breadcrumb ul {padding:0;margin:2px 0 0 0;}
#breadcrumb li {list-style:none;display:inline;padding:0;}
#breadcrumb li big {padding-right:2px;}
#articleHead {border-top:1px solid #CCC;padding-top:5px;clear:both;margin-bottom:10px;}
#articleHead h1 {font-size:25px;line-height:28px;margin:10px 0px 2px;padding:0px;}
#articleHead h2 {font-size:14px;line-height:16px;margin:0px 0px 6px;padding:0px;}
#articleHead p {font-size:15px;font-weight:bold;margin:0px;padding:0px;}
#articleHead .date {color:#999;margin:0px 0px 20px;padding:0px;}
'''