good day. There is a page with a map on which some objects are applied. These objects are hard coded in the js code of the page. You need to tear them out in java code. I tried to incite jsoup, but he doesn’t really want to work with the code. here is an example

marker = L.marker([56.71218916006565, 55.993525088012726], {icon: icons[15]}); marker.on('mouseover', openPopup); marker.popupShown = false; marker.is_camera = true; if (marker.is_camera) { marker.name = 'Город творчества'; marker.server = '11.34.178.158'; marker.number = '001-999-144'; marker.token = '80e0b21a1e3b4b5d832380b21b3254e4'; } else { marker.content = ''; } marker.bindPopup('', {maxWidth: 175, closeButton: is_mobile(), closeOnClick: is_mobile()}); if (!is_mobile()) { marker.off('click'); } else { marker.on('click', openPopup); } marker.on('mouseout', function (event) { var marker = event.target; marker._hide_timer = setTimeout(function () { hidePopup(marker); }, 1000); }); marker.on('popupopen', function () { if (this.is_camera) { window.cache.camera = { name: this.name, server: this.server, number: this.number, token: this.token }; this.getPopup().setContent('<a class="cursor" id="PopupOnMarker"><span class="ClickToView">Нажмите для просмотра</span><img style="border:0;width:170px;height:150px;" width="170" height="150" src="http://' + this.server + '/' + this.number + '/preview.jpg?token=80e0b21a1e3b4b5d832380b21b3254e4"></a>'); } else { this.getPopup().setContent(this.content); } }); marker.on('popupclose', function () { this.getPopup().setContent(''); }); marker.addTo(layouts['gorod-tvorchestva']); marker = L.marker([53.729585327853944, 55.948357545362974], {icon: icons[15]}); marker.on('mouseover', openPopup); marker.popupShown = false; marker.is_camera = true; if (marker.is_camera) { marker.name = 'Город творчества'; marker.server = '11.30.138.138'; marker.number = '001-999-150'; marker.token = 'bd22d27e201144dc8c28043b865c5736'; } else { marker.content = ''; } marker.bindPopup('', {maxWidth: 175, closeButton: is_mobile(), closeOnClick: is_mobile()}); if (!is_mobile()) { marker.off('click'); } else { marker.on('click', openPopup); } marker.on('mouseout', function (event) { var marker = event.target; marker._hide_timer = setTimeout(function () { hidePopup(marker); }, 1000); }); marker.on('popupopen', function () { if (this.is_camera) { window.cache.camera = { name: this.name, server: this.server, number: this.number, token: this.token }; this.getPopup().setContent('<a class="cursor" id="PopupOnMarker"><span class="ClickToView">Нажмите для просмотра</span><img style="border:0;width:170px;height:150px;" width="170" height="150" src="http://' + this.server + '/' + this.number + '/preview.jpg?token=bd22d27e201144dc8c28043b865c5736"></a>'); } else { this.getPopup().setContent(this.content); } }); marker.on('popupclose', function () { this.getPopup().setContent(''); }); marker.addTo(layouts['gorod-tvorchestva']); 

need to tear out name, server, number and token

    1 answer 1

    try this:

     Document doc = ... Element script = doc.select("script").first(); // Get the script part Pattern p = Pattern.compile("(?is)key=\"(.+?)\""); // Regex for the value of the key Matcher m = p.matcher(script.html()); // you have to use html here and NOT text! Text will drop the 'key' part while( m.find() ) { System.out.println(m.group()); // the whole key ('key = value') System.out.println(m.group(1)); // value only } 
    • I did not understand something with the regular schedule .. what should I put in there? with this m.find () text I have false right away - baralgin1003
    • one
      In the regular list, instead of key= you need name= , server= , etc. - Dmitri88