Next bus leaving in x minutes sensor

The local bus company here has a system where you can make your own personal departure screen.

I made a test screen here:

https://avgangsvisning.skyss.no/board/#/?stops=12010023&viewFreq=10000&terminal=true&colors=dark&name=Test1

I think that the page gets the values from here:

https://skyss.giantleap.no/public/departures?Hours=12&StopIdentifiers=12010023&callback=angular.callbacks._1

but I’m not 100% sure as there seem to be multiple sources. I found the source by right click/inspect in Chrome.

Does anyone have an idea of how I can get the minute value for when the next bus is leaving into a Home Assistant sensor? Sometimes it only shows the time and no real time minute value, so that would have to work as well. I checked the scrape sensor but I can’t figure out the select html tag.

I got great help from a user on reddit:

It does indeed get the values from there, if you remove the callback part you’ll just get the JSON which you can put in a REST sensor.

https://skyss.giantleap.no/public/departures?Hours=1&StopIdentifiers=12010023

Template should be something along the lines of (typing this blindly) {{ value_json[“PassingTimes”][0][“DisplayTime”] }}

That will get you the displaytime (text). To get an actual number out of it you should probably use the AimedTime and do some actual date processing on it.

Hope that helps someone who has a similar problem.