Fix #8316 (Updated recipe for the Financial Times UK edition)

This commit is contained in:
Kovid Goyal 2011-01-14 08:42:19 -07:00
parent 4e9070019a
commit 2f4261e02c

View File

@ -1,5 +1,5 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = '2010-2011, Darko Miletic <darko.miletic at gmail.com>'
''' '''
ft.com ft.com
''' '''
@ -52,12 +52,9 @@ class FinancialTimes(BasicNewsRecipe):
.copyright{font-size: x-small} .copyright{font-size: x-small}
""" """
def parse_index(self): def get_artlinks(self, elem):
articles = [] articles = []
soup = self.index_to_soup(self.INDEX) for item in elem.findAll('a',href=True):
wide = soup.find('div',attrs={'class':'wide'})
if wide:
for item in wide.findAll('a',href=True):
url = self.PREFIX + item['href'] url = self.PREFIX + item['href']
title = self.tag_to_string(item) title = self.tag_to_string(item)
date = strftime(self.timefmt) date = strftime(self.timefmt)
@ -67,7 +64,26 @@ class FinancialTimes(BasicNewsRecipe):
,'url' :url ,'url' :url
,'description':'' ,'description':''
}) })
return [('FT UK edition',articles)] return articles
def parse_index(self):
feeds = []
soup = self.index_to_soup(self.INDEX)
wide = soup.find('div',attrs={'class':'wide'})
if not wide:
return feeds
strest = wide.findAll('h3', attrs={'class':'section'})
if not strest:
return feeds
st = wide.find('h4',attrs={'class':'section-no-arrow'})
if st:
strest.insert(0,st)
for item in strest:
ftitle = self.tag_to_string(item)
self.report_progress(0, _('Fetching feed')+' %s...'%(ftitle))
feedarts = self.get_artlinks(item.parent.ul)
feeds.append((ftitle,feedarts))
return feeds
def preprocess_html(self, soup): def preprocess_html(self, soup):
return self.adeify_images(soup) return self.adeify_images(soup)