Fix Chicago Tribune

This commit is contained in:
Kovid Goyal 2012-02-28 20:00:44 +05:30
parent 644ef91811
commit 0e90b3bac8

View File

@ -3,6 +3,7 @@ __license__ = 'GPL 3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import urllib, re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class ChicagoTribune(BasicNewsRecipe): class ChicagoTribune(BasicNewsRecipe):
@ -77,10 +78,15 @@ class ChicagoTribune(BasicNewsRecipe):
def get_article_url(self, article): def get_article_url(self, article):
url = article.get('feedburner_origlink', article.get('guid', article.get('link'))) ans = None
if url.endswith('?track=rss'): try:
url = url.partition('?')[0] s = article.summary
return url 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): def skip_ad_pages(self, soup):
text = soup.find(text='click here to continue to article') text = soup.find(text='click here to continue to article')