From 5d35c23c5e4031653fef33cee9067693e9961f7c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 11 Feb 2017 17:31:19 +0530 Subject: [PATCH] ... --- recipes/economist.recipe | 12 ++++++------ recipes/economist_free.recipe | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/recipes/economist.recipe b/recipes/economist.recipe index f07dc512a2..a545885edb 100644 --- a/recipes/economist.recipe +++ b/recipes/economist.recipe @@ -147,17 +147,17 @@ class Economist(BasicNewsRecipe): secname = self.tag_to_string(section) self.log(secname) for a in section.findNextSiblings('a', href=True): - title = ( - self.tag_to_string( - a.find(attrs={'class': 'print-edition__link-title'}) - ) or self.tag_to_string(a) - ) + spans = a.findAll('span') + if len(spans) == 2: + title = '{}: {}'.format(*map(self.tag_to_string, spans)) + else: + title = self.tag_to_string(a) articles.append({'title': title, 'url': process_url(a['href'])}) self.log(' ', title, articles[-1]['url']) if articles: feeds.append((secname, articles)) return feeds - self.economist_parse_old_index(soup) + return self.economist_parse_old_index(soup) def economist_parse_old_index(self, soup): feeds = OrderedDict() diff --git a/recipes/economist_free.recipe b/recipes/economist_free.recipe index f07dc512a2..a545885edb 100644 --- a/recipes/economist_free.recipe +++ b/recipes/economist_free.recipe @@ -147,17 +147,17 @@ class Economist(BasicNewsRecipe): secname = self.tag_to_string(section) self.log(secname) for a in section.findNextSiblings('a', href=True): - title = ( - self.tag_to_string( - a.find(attrs={'class': 'print-edition__link-title'}) - ) or self.tag_to_string(a) - ) + spans = a.findAll('span') + if len(spans) == 2: + title = '{}: {}'.format(*map(self.tag_to_string, spans)) + else: + title = self.tag_to_string(a) articles.append({'title': title, 'url': process_url(a['href'])}) self.log(' ', title, articles[-1]['url']) if articles: feeds.append((secname, articles)) return feeds - self.economist_parse_old_index(soup) + return self.economist_parse_old_index(soup) def economist_parse_old_index(self, soup): feeds = OrderedDict()