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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -