Some of the data I want to scrape is contained inside the pages JavaScript. It looks similar to this pattern:
<script type="text/javascript">
arrayName["field1"] = 12;
arrayName["field2"] = 42;
arrayName["field3"] = 1442;
</script>
<script type="text/javascript">
arrayName["field4"] = 62;
arrayName["field5"] = 3;
arrayName["field6"] = 542;
</script>
It's mixed in with a hell of a lot of other Javascript. I need to get these values.
I started like so:
var dom = CQ.CreateFromUrl("http://somesite.xxx");
CQ script = dom["script[type='text/javascript']"];
But I cannot think now how to grab this data. Is the only way to do it to create a regex and loop over everything or is there another way that has better performance?
I can't see how to use CSS selectors for actual JavaScript code. Should I try different approach?