2015-05-08, 07:41
In my addon I want to scrape some json and turn it into a dict so I can grab the data I"m interested in. What's the easiest way to do this?
The string is all one line in the page and looks like this:
I want to somehow get it into a python dict, so I would scrape just the json object w/ a regex I'm assuming, and then convert that from JSON to dict.
Let's assume the URL is http://example.com I'm not sure how to make an HTTP request in my addon.
The string is all one line in the page and looks like this:
Code:
<script>var data = { "foo": "bar" };</script>
I want to somehow get it into a python dict, so I would scrape just the json object w/ a regex I'm assuming, and then convert that from JSON to dict.
Let's assume the URL is http://example.com I'm not sure how to make an HTTP request in my addon.