From 54e524c7e113b5736134ce029f70b02489b4e1ac Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 29 Apr 2010 18:30:44 -0600 Subject: [PATCH] Fix #5403 (Articles to PC Mag not downloaded) --- resources/recipes/pc_mag.recipe | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/resources/recipes/pc_mag.recipe b/resources/recipes/pc_mag.recipe index 7d6049ec2b..227d777034 100644 --- a/resources/recipes/pc_mag.recipe +++ b/resources/recipes/pc_mag.recipe @@ -9,8 +9,9 @@ __description__ = 'PCMag (www.pcmag.com) delivers authoritative, labs-based comp ''' http://www.pcmag.com/ ''' - +import re from calibre.web.feeds.news import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import Comment class pcMag(BasicNewsRecipe): __author__ = 'Lorenzo Vigentini' @@ -33,9 +34,6 @@ class pcMag(BasicNewsRecipe): remove_javascript = True no_stylesheets = True - keep_only_tags = [ - dict(name='div', attrs={'id':'articleContent'}) - ] feeds = [ (u'Tech Commentary from the Editors of PC Magazine', u'http://rssnewsapps.ziffdavis.com/PCMAG_commentary.xml'), @@ -49,8 +47,13 @@ class pcMag(BasicNewsRecipe): (u'Technology News from Ziff Davis', u'http://rssnewsapps.ziffdavis.com/pcmagbreakingnews.xml') ] + keep_only_tags = [dict(attrs={'class':'content-page'})] remove_tags = [ - dict(name='div', attrs={'id':['microAd','intellitxt','articleDeckTalkback','inlineDigg','underArticleLinks','w_talkback']}), - dict(name='span', attrs={'id':['highlights_content','yahooBuzzBadge-48558872521263350499378']}) - ] + dict(attrs={'class':['control-side','comment','highlights_content','btn-holder','subscribe-panel', + 'grey-box comments-box']}), + dict(id=['inlineDigg']), + dict(text=lambda text:isinstance(text, Comment)), + dict(name='img', width='1'), + ] + preprocess_regexps = [(re.compile(r"