Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

How to parse a JSON file from HTML into Python using BeautifulSoup?

$
0
0

I have an HTML page with various information, like:

<input class="json-data" id="init-data" type="hidden" value='{"keyboardShortcuts":[{"name":"xxxx","description":"yyyyy", > etc...

How can I obtain something like

name = xxxx

That is my code so far, but every time it just prints None:

content = page.read()
html = BeautifulSoup(content, "html.parser")
element = html.find("input", class_="json-data", value_="keyboardShortcuts")

Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>