Revert to using old nytimes profile, since the reader cant handle the LRF file created by the new profile

This commit is contained in:
Kovid Goyal 2008-03-01 19:37:22 +00:00
parent 3c7f0c2ffa
commit 30182d8657
2 changed files with 19 additions and 1 deletions

View File

@ -173,11 +173,12 @@ class DefaultProfile(object):
def __init__(self, logger, verbose=False, username=None, password=None):
def __init__(self, logger, verbose=False, username=None, password=None, lrf=True):
self.logger = logger
self.username = username
self.password = password
self.verbose = verbose
self.lrf = lrf
self.temp_dir = tempfile.mkdtemp(prefix=__appname__+'_')
self.browser = self.get_browser()
try:

View File

@ -53,7 +53,24 @@ class NYTimes(DefaultProfile):
br.submit()
return br
def get_feeds(self):
src = self.browser.open('http://www.nytimes.com/services/xml/rss/index.html').read()
soup = BeautifulSoup(src[src.index('<html'):])
feeds = []
for link in soup.findAll('link', attrs={'type':'application/rss+xml'}):
if link['title'] not in ['NYTimes.com Homepage', 'Obituaries', 'Pogue\'s Posts',
'Dining & Wine', 'Home & Garden', 'Multimedia',
'Most E-mailed Articles',
'Automobiles', 'Fashion & Style', 'Television News',
'Education']:
feeds.append((link['title'], link['href'].replace('graphics8', 'www')))
return feeds
def parse_feeds(self):
if self.lrf: # The new feed causes the SONY Reader to crash
return DefaultProfile.parse_feeds(self)
src = self.browser.open('http://www.nytimes.com/pages/todayspaper/index.html').read().decode('cp1252')
soup = BeautifulSoup(src)