How to scrap html script tags?

Hello,
is it possible to scrap texts in html script tags with WebScraper?

Sorry if this was asked before, I couldn't find information.

Here is a use-case:
For example to scrap such html script tag to retrieve latitudes (43.498387) and longitudes (-1.543922) :

<script type="text/javascript">
        google.maps.event.addDomListener(window, 'load', init);

        function init() {
            var mapOptions = {
                scrollwheel: false,
                zoom: 10,
                center: new google.maps.LatLng(43.498387, -1.543922),
                styles: []
            };

            // ...
        }
    </script>

In case it can be useful to anyone, you can extract such latitudes and longitudes by using an HTML selector on body and using a regex to extract the text you're looking for:

In this example, the regexp is:
(position: new google.maps.LatLng\([-]?[0-9]+\.[0-9]+,\s?[-]?[0-9]+\.[0-9]+\))

And then parse this text from your spread sheets

I couldn't find a way to use regexp results groups

2 Likes

Try this regex, which should pick out the coordinates:

(?<=LatLng\().+(?=\)\,)