Read <script> tag from website


I have a website that puts all its API data into a script tag. For example:

<!DOCTYPE html>
<script type="application/ld+json">

I have been able to fetch the website successfully. My question now is, how do I take the response and parse it so that I can read that JSON data.

Essentially I want to be able to do something like

  1. Fetch the website
  2. Parse the HTML
  3. Parse the JSON from that HTML
  4. name =
  5. image = Media.image

something like that.

Any ideas?