Using Scrapy, how do I get value of a Javascript variable ....
Here is the my code ...
<script rel="bmc-data">
var match = 'yes';
var country = 'uk';
var tmData = {
"googleExperimentVariation": "1",
"pageTitle": "Child Care",
"page_type": "claimed",
"company_state": "wyostate",
"company_city": "mycity"
};
</script>
I want to check the value of page_type variable. If its "claimed" process the page, or else move on ....
I have already seen this and this
I have tried this ...
pattern = r'page_type = "(\w+)",'
response.xpath('//script[@rel="bmc-data"]').re(pattern)
but ofcourse this is not working, becuase I think my regex is wrong.