title: How to extract a JSON object that was defined in a HTML page javascript block using Python?
body: <p>I am downloading HTML pages that have data defined in them in the following way:</p>
  
  <pre><code>... &lt;script type= "text/javascript"&gt;    window.blog.data = {"activity":{"type":"read"}}; &lt;/script&gt; ...
  </code></pre>
  
  <p>I would like to extract the JSON object defined in 'window.blog.data'.
  Is there a simpler way than parsing it manually? (I am looking into Beautiful Soap but can't seem to find a method that will return the exact object without parsing)</p>
  
  <p>Thanks</p>
  
  <p><strong>Edit:</strong>
  Would it be possible and more correct to do this with a python headless browser (e.g., Ghost.py)?</p>