title: How to retrieve javascript variable value with xpath?=
body: <p>I am trying to extract pricing and other attributes from this JS-Code:</p>
  
  <pre><code>  &lt;script type="application/ld+json"&gt;
  {
    "@context": "http://schema.org/",
    "@type": "Product",
    "name": "Rolex Cellini Time 50505",
    "image": [
          "https://chronexttime.imgix.net/S/1/S1006/S1006_58774a90efd04.jpg?w=1024&amp;amp;auto=format&amp;amp;fm=jpg&amp;amp;q=75&amp;amp;usm=30&amp;amp;usmrad=1&amp;amp;h=1024&amp;amp;fit=clamp"      ],
    "description": "Werk: automatic; Herrenuhr; Gehäusegröße: 39; Gehäuse: rose-gold; Armband: leather; Glas: sapphire; Jahr: 2018; Lieferumfang: Originale Box, Originale Papiere, Herstellergarantie",
    "mpn": "S1006",
    "brand":{
      "@type": "Thing",
      "name": "Rolex"
    },
    "offers":{
      "@type": "Offer",
      "priceCurrency": "EUR",
      "price": "11500",
      "itemCondition": "http://schema.org/NewCondition",
      "availability": "http://schema.org/InStock",
  
      "seller":{
        "@type": "Organization",
        "name": "CHRONEXT Service Germany GmbH"
      }
    }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Alternatively this code might do it as well:</p>
  
  <pre><code>  &lt;script type="text/javascript"&gt;
  window.articleInfo = {
      'id': 'S1006',
      'model': 'Cellini Time',
      'brand': 'Rolex',
      'reference': '50505',
      'priceLocal': '11500',
      'currencyCode': 'EUR'
  };
  </code></pre>
  
  <p>There is much more other JS code on the same page, so I am not sure how to adress this particular script with xpath. </p>
  
  <p>I tried this:</p>
  
  <pre><code>response.xpath('//script[contains(.,"price")]/text()').extract_first()
  </code></pre>
  
  <p>but the response contains a bunch of values, while I am only looking for the price of 11500. Later on I would also try to get e.g. the name and condition.</p>