mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update TLS
missing book details
This commit is contained in:
parent
cf5c4a7d15
commit
57a9682a71
@ -163,7 +163,7 @@ class SCMP(BasicNewsRecipe):
|
||||
load_article_from_json(script[0].text, b_root)
|
||||
except Exception:
|
||||
return raw_html
|
||||
head = root.xpath('//h2') + root.xpath('//h3')
|
||||
head = b_root.xpath('//h2') + b_root.xpath('//h3')
|
||||
for h2 in head:
|
||||
h2.tag = 'h4'
|
||||
raw = etree.tostring(b_root, encoding='unicode')
|
||||
|
@ -118,18 +118,6 @@ class tls(BasicNewsRecipe):
|
||||
else:
|
||||
prim = title = desc = label = auth = lede = ''
|
||||
|
||||
bks = ''
|
||||
if 'bookdetails' in data and data['bookdetails']:
|
||||
bks += '<br>'
|
||||
for a in data['bookdetails']:
|
||||
for x, y in a.items():
|
||||
if isinstance(y, str):
|
||||
if x == 'imageurl':
|
||||
bks += '<img src="{}">'.format(y)
|
||||
elif y:
|
||||
bks += '<div class="det">' + y + '</div>\n'
|
||||
bks += '<br>'
|
||||
|
||||
if 'article_data_leadimage' in data:
|
||||
i = data['article_data_leadimage']
|
||||
if 'full_image' in i and i['full_image']:
|
||||
@ -138,7 +126,20 @@ class tls(BasicNewsRecipe):
|
||||
+ i['imagecredit'] + '</i>'
|
||||
)
|
||||
cont = self.index_to_soup('https://www.the-tls.co.uk/wp-json/tls/v2/single-article/' + data['ID'], raw=True)
|
||||
body = json.loads(cont)['content']
|
||||
c_data = json.loads(cont)
|
||||
body = c_data['content']
|
||||
|
||||
bks = ''
|
||||
if 'bookdetails' in c_data and c_data['bookdetails']:
|
||||
bks += '<br>'
|
||||
for a in c_data['bookdetails']:
|
||||
for x, y in a.items():
|
||||
if isinstance(y, str):
|
||||
if x == 'imageurl':
|
||||
bks += '<img src="{}">'.format(y)
|
||||
elif y:
|
||||
bks += '<div class="det">' + y + '</div>\n'
|
||||
bks += '<br>'
|
||||
|
||||
html = '<html><body><div>' \
|
||||
+ label + title + desc + auth + lede + bks + body + \
|
||||
|
Loading…
x
Reference in New Issue
Block a user