From 0e90b3bac80fcbc5c0831a356185d679ed65385d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 28 Feb 2012 20:00:44 +0530 Subject: [PATCH] Fix Chicago Tribune --- recipes/chicago_tribune.recipe | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/recipes/chicago_tribune.recipe b/recipes/chicago_tribune.recipe index a5ec8f0743..14a6cc71ef 100644 --- a/recipes/chicago_tribune.recipe +++ b/recipes/chicago_tribune.recipe @@ -3,6 +3,7 @@ __license__ = 'GPL 3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' +import urllib, re from calibre.web.feeds.news import BasicNewsRecipe class ChicagoTribune(BasicNewsRecipe): @@ -77,10 +78,15 @@ class ChicagoTribune(BasicNewsRecipe): def get_article_url(self, article): - url = article.get('feedburner_origlink', article.get('guid', article.get('link'))) - if url.endswith('?track=rss'): - url = url.partition('?')[0] - return url + ans = None + try: + s = article.summary + ans = urllib.unquote( + re.search(r'href=".+?bookmark.cfm.+?link=(.+?)"', s).group(1)) + except: + pass + if ans is not None: + return ans.replace('?track=rss', '') def skip_ad_pages(self, soup): text = soup.find(text='click here to continue to article')