How to scrape inpage javascript

I’m struggling to scrape the right info. Our “city commune”, so to say, has a website with an embedded google map. Within the google map are all own city’s trashcontainers located, and also the fillingdegree.

See here: https://inzameling.spaarnelanden.nl/ (it’s in dutch) when you zoom in all the trash containers will be shown and when you click on one of them, a pop-up opens with info about the container.

Now i’ve search through their code, and saw the specific info I needed is located in an inpage tag (CSS selector: #MapPartial > script). In the script tag is an array named ‘oContainerModel’ with all objects.

A single object is shown like this:

{
   "iId":4343,
   "iNumberInDistrict":580,
   "iFillingDegreeStatus":1,
   "iDistrictId":11,
   "iCityDistrictId":17,
   "dFillingDegree":22,
   "dLatitude":52.35712,
   "dLongitude":4.64371,
   "sRegistrationNumber":"4103",
   "sDefaultDays":"\u003cimg class=\u0027defaultDayIcon\u0027 data-statusid=0 data-dayofweek=1 src=\u0027/Content/EmptyDays/ma_n2.png\u0027\u003e\u003cimg class=\u0027defaultDayIcon\u0027 data-statusid=0 data-dayofweek=2 src=\u0027/Content/EmptyDays/di_n2.png\u0027\u003e\u003cimg class=\u0027defaultDayIcon\u0027 data-statusid=0 data-dayofweek=3 src=\u0027/Content/EmptyDays/wo_n2.png\u0027\u003e\u003cimg class=\u0027defaultDayIcon\u0027 data-statusid=0 data-dayofweek=4 src=\u0027/Content/EmptyDays/do_n2.png\u0027\u003e\u003cimg class=\u0027defaultDayIcon\u0027 data-statusid=0 data-dayofweek=5 src=\u0027/Content/EmptyDays/vr_n2.png\u0027\u003e\u003cimg class=\u0027defaultDayIcon\u0027 data-statusid=0 data-dayofweek=6 src=\u0027/Content/EmptyDays/za_n2.png\u0027\u003e\u003cimg class=\u0027defaultDayIcon\u0027 data-statusid=0 data-dayofweek=0 src=\u0027/Content/EmptyDays/zo_n2.png\u0027\u003e",
   "sDefaultDaysOptional":"",
   "bIsOutOfUse":false,
   "bIsSkipped":false,
   "bIsEmptiedToday":false,
   "dtDateLastEmptied":"\/Date(1614837991103)\/",
   "iContainerProductId":7,
   "sProductName":"Rest",
   "sContainerKindName":"OC",
   "oPlanningDetail":{
      "iId":0,
      "iPlanningRowId":0,
      "oPlanningRow":null,
      "iContainerId":0,
      "oContainer":null,
      "iInitialStatus":1,
      "iRealTimeStatus":1,
      "bIsFromSplitPlanning":false,
      "dtDateModified":null,
      "iAddedToPlanningStatus":0,
      "iPlanningActionStatus":0,
      "iInterestingStatus":0,
      "iContainerActionId":0,
      "oContainerAction":null
   }
}

And there is all the stuff located like FillingDegree and DateLastEmptied… So I’m guessing I’m pretty far, only I have no idea how to scrape javascript out of an inpage tag. Using the right URL and selector is not returning anything.

I’ve also tested scraping just plain text, and that works.

Hopefully anyone can help me further.

Anyone who knows a possible solution? :slight_smile: