From cfc5618ff8ee5731fb3c6ae16979cafb099d8a52 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 17 Dec 2011 08:57:22 +0530 Subject: [PATCH] Fix Independent --- recipes/independent.recipe | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/recipes/independent.recipe b/recipes/independent.recipe index db89a07264..938b27d644 100644 --- a/recipes/independent.recipe +++ b/recipes/independent.recipe @@ -109,7 +109,6 @@ class TheIndependentNew(BasicNewsRecipe): picdiv = soup.find('img') if picdiv is not None: self.add_toc_thumbnail(article,picdiv['src']) - def preprocess_html(self, soup): @@ -273,12 +272,15 @@ class TheIndependentNew(BasicNewsRecipe): def _insertRatingStars(self,soup,item): - if item.contents is None: + if item.contents is None or len(item.contents) < 1: return rating = item.contents[0] - if not rating.isdigit(): - return None - rating = int(item.contents[0]) + + try: + rating = float(item.contents[0]) + except: + print 'Could not convert decimal rating to star: malformatted float.' + return for i in range(1,6): star = Tag(soup,'img') if i <= rating: