I'm trying to extract the content of a script tag on a store locator using Scrapy, but I'm a bit stuck.
Within view source, the script content looks like this:
<script>
var map_locations = [{"col_id":"1","col_postcode":"DN18 5DE","col_latitude":"53.6825556","col_longitude":"-0.438675","col_address1":"9a Market Lane","col_name":"XX","col_website":"https:\/\/branches.XX.co.uk\/barton-upon-humber\/9a-market-lane.html?type=0&stores=DN18+5DE?utm_source=directories&utm_medium=local&utm_campaign=yext&utm_content=1444","col_facebook":"https:\/\/www.facebook.com\/XXDN185DE\/","col_city":"Barton-Upon-Humber","col_state":"North Lincolnshire","col_yextid":"1444"}...
</script>
I copied the xpath and used response.xpath('/html/body/script[1]/text()') to retrieve it within the terminal
Now I want to parse the information in the script into separate columns, which I'll eventually load into csv.
How should I go about parsing that information? Say if I wanted the col_postcode? I've read other posts where people use regex & json.