This commit is contained in:
Kovid Goyal 2009-08-07 09:35:56 -06:00
parent f6d5980fb3
commit 1bcdfbb9d3

View File

@ -10,7 +10,7 @@ from calibre.ptempfile import PersistentTemporaryFile
from threading import RLock from threading import RLock
class ChicagoTribune(BasicNewsRecipe): class ChicagoTribune(BasicNewsRecipe):
title = 'Chicago Tribune' title = 'Chicago Tribune'
__author__ = 'Kovid Goyal' __author__ = 'Kovid Goyal'
description = 'Politics, local and business news from Chicago' description = 'Politics, local and business news from Chicago'
@ -19,7 +19,7 @@ class ChicagoTribune(BasicNewsRecipe):
articles_are_obfuscated = True articles_are_obfuscated = True
remove_tags_before = dict(name='h1') remove_tags_before = dict(name='h1')
obfuctation_lock = RLock() obfuctation_lock = RLock()
feeds = [ feeds = [
('Latest news', 'http://feeds.chicagotribune.com/chicagotribune/news/'), ('Latest news', 'http://feeds.chicagotribune.com/chicagotribune/news/'),
('Local news', 'http://feeds.chicagotribune.com/chicagotribune/news/local/'), ('Local news', 'http://feeds.chicagotribune.com/chicagotribune/news/local/'),
@ -52,13 +52,13 @@ class ChicagoTribune(BasicNewsRecipe):
('iPhone Blog', 'http://feeds.feedburner.com/redeye/iphoneblog'), ('iPhone Blog', 'http://feeds.feedburner.com/redeye/iphoneblog'),
('Julie\'s Health Club', 'http://feeds.chicagotribune.com/chicagotribune_julieshealthclub/'), ('Julie\'s Health Club', 'http://feeds.chicagotribune.com/chicagotribune_julieshealthclub/'),
] ]
temp_files = [] temp_files = []
def get_article_url(self, article): def get_article_url(self, article):
return article.get('feedburner_origlink', article.get('guid', article.get('link'))) return article.get('feedburner_origlink', article.get('guid', article.get('link')))
def get_obfuscated_article(self, url, logger): def get_obfuscated_article(self, url):
with self.obfuctation_lock: with self.obfuctation_lock:
soup = self.index_to_soup(url) soup = self.index_to_soup(url)
img = soup.find('img', alt='Print') img = soup.find('img', alt='Print')
@ -79,4 +79,4 @@ class ChicagoTribune(BasicNewsRecipe):
self.temp_files[-1].write(html.encode('utf-8')) self.temp_files[-1].write(html.encode('utf-8'))
self.temp_files[-1].close() self.temp_files[-1].close()
return self.temp_files[-1].name return self.temp_files[-1].name