mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Fix Independent
This commit is contained in:
parent
589d9e9077
commit
cfc5618ff8
@ -110,7 +110,6 @@ class TheIndependentNew(BasicNewsRecipe):
|
|||||||
if picdiv is not None:
|
if picdiv is not None:
|
||||||
self.add_toc_thumbnail(article,picdiv['src'])
|
self.add_toc_thumbnail(article,picdiv['src'])
|
||||||
|
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
|
|
||||||
#remove 'advertorial articles'
|
#remove 'advertorial articles'
|
||||||
@ -273,12 +272,15 @@ class TheIndependentNew(BasicNewsRecipe):
|
|||||||
|
|
||||||
|
|
||||||
def _insertRatingStars(self,soup,item):
|
def _insertRatingStars(self,soup,item):
|
||||||
if item.contents is None:
|
if item.contents is None or len(item.contents) < 1:
|
||||||
return
|
return
|
||||||
rating = item.contents[0]
|
rating = item.contents[0]
|
||||||
if not rating.isdigit():
|
|
||||||
return None
|
try:
|
||||||
rating = int(item.contents[0])
|
rating = float(item.contents[0])
|
||||||
|
except:
|
||||||
|
print 'Could not convert decimal rating to star: malformatted float.'
|
||||||
|
return
|
||||||
for i in range(1,6):
|
for i in range(1,6):
|
||||||
star = Tag(soup,'img')
|
star = Tag(soup,'img')
|
||||||
if i <= rating:
|
if i <= rating:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user