View Single Post
Old 02-20-2022, 03:24 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,427
Karma: 27757236
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
All you need is something like this in preprocess_raw_html

Code:
  soup = self.index_to_soup(raw)
  script = soup.find('script', type="application/ld+json")
  data = json.loads(str(script.contents[0]))
then you simply exract the data from json and cnvert it to simple html and return that.
kovidgoyal is offline   Reply With Quote