How to scrape lat/long from JavaScript code using Scrapy / XPath

I want to extract the latitude and longitude from this script

<script type="text/javascript">
    window.DETAILS_PAGE_MAP_GLOBALS = {
        GOOGLE_MAPS_LONGITUDE: 55.4159330979,
        GOOGLE_MAPS_LATITUDE: 25.1549968578
    };
</script>

I tried this xpath

contains(.//script[@type='text/javascript']/text(), 'window.DETAILS_PAGE_MAP_GLOBALS')

I always get 0. I know it is referring to false

my question how could I get the lat and long from that script? I think contains might help but i don't know how


ANSWERS:


You can use regular expressions with Scrapy selectors.

An example straight from the docs:

sel.xpath('//a[contains(@href, "image")]/text()').re(r'Name:\s*(.*)')

That way, you can get the data out in one go.



 MORE:


 ? How to scrape lat/long from JavaScript code using Scrapy / XPath
 ? How to scrape lat/long from JavaScript code using Scrapy / XPath
 ? Regarding, Python, Scrapy and Xpath
 ? Convert the XPath gotten from browser to usable XPath for Scrapy
 ? Scrapy xpath get text of an element that starts with <
 ? Using XPath with Scrapy
 ? Scrape text from a node with multiple descendants with Scrapy
 ? Scrape text from a node with multiple descendants with Scrapy
 ? Scrape text from a node with multiple descendants with Scrapy
 ? Increment scraping using Scrapy on the URL