javascript - Scraping a url ending in .js using python -
i trying historical earnings data website using python. url data ends in .js (which javascript link). problem if use urllib.urlopen read link, converts string , it's nightmare extract data string. wondering if there module allows download data in similar json.
the link trying scrape is: http://test.optionslam.com/site_media/chart/data/goog_data.js
this how trying it:
data = urlopen('http://test.optionslam.com/site_media/chart/data/goog_data.js').read()
can please suggest better approach this?
just remove var =
parts , terminating ;
, use json parser on rest. sure such thing exists python.
something this:
- get string do
- replace
var
{
- replace
=
:
- replace
;
},
- remove last
,
- read in json
Comments
Post a Comment