title: how to parsing json var inside script tag
body: <p>I'm trying to scrape the data shown in the scatter plot in <a href="https://www.proteinatlas.org/ENSG00000167286-CD3D/pathology/tissue/renal+cancer" rel="nofollow noreferrer">https://www.proteinatlas.org/ENSG00000167286-CD3D/pathology/tissue/renal+cancer</a></p>
  
  <p>The javascript is in </p>
  
  <pre><code>'&lt;script&gt; var plot = $('#scatter6001').scatterPlot({"Alive (n=651)":{"symbol":"circle","data":[{"x":0.407889650408,"y":12.811,"tooltip":"TCGA-KL-8324-01A&lt;br&gt;Female\/ Stage ii \/ Alive&lt;br&gt;FPKM: 0.4&lt;br&gt;Living days: 4676 (12.8 years)","class":"stage_ii sex_f best_low median_low"},{"x":0.587835812523,"y":8.0795,"tooltip":"TCGA-KL-8334-01A&lt;br&gt;Female\/ Stage iii \/ Alive&lt;br&gt;FPKM: 0.6&lt;br&gt;Living days: 2949 (8.1years)","class":"stage_iii sex_f best_low median_low"}'...});
  </code></pre>
  
  <p>My question is how to parse the information in TCGA-XX-XXXX-XXX, gender,stage, living or dead, FPKM and Living days? And how to save those information in the csv file?</p>
  
  <p>This is the code I have done.</p>
  
  <pre><code>page = urlopen("https://www.proteinatlas.org/ENSG00000167286-CD3D/pathology/tissue/prostate+cancer#imid_3605750")
  content = page.read()
  soup = BeautifulSoup(content,'lxml')
  
  table = soup.find('div', {'id':'scatter6001'})
  print(table)
  
  p = re.search(r"var plot = (.*?);",soup).group(1)
  print(p)
  </code></pre>
  
  <p>The code has some error, which is</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "scrap2.py", line 24, in
    
        p = re.search(r"var plot = (.*?);",soup).group(1)   File "C:\Python34\lib\re.py", line 170, in search
        return _compile(pattern, flags).search(string) TypeError: expected string or buffer</p>
  </blockquote>
  
  <p>How to solve this problem and scrap the data I want?</p>
  
  <p>Thanks</p>