Help with scraping tide info from website

Hi,

I’ve been trying to create a couple of sensors showing the next high and low tides at my location but after a few hours trying several combinations I’m yet to succeed in scraping the correct data:

The page I’m trying to extract this from:

Carcavelos Tide Times & Tide Charts

I’m attempting to extract only the time for the next high tide and next low tide (creating 2 sensors for this).

The CSS selector for each value seems to be clearly defined - 'hightime" and “lowtime” - but I can’t get any value back:

the relevant html code:

<p class="high-tide">Next <b><span class="tide"><i class="fa fa-arrow-up"></i>high tide</span> in Sao Domingos de Rana</b> is at <b><span id="hightime" class="tide">4:54 AM</span></b>, which is in <b><span class="tide"><span id="highcountdown">11 hr 48 min 26 s</span> from now</span></b>.</p>

sensor:
  - platform: scrape
    resource: http://www.surf-forecast.com/breaks/Carcavelos/tides/latest
    name: Next High Tide
    select: "#hightime"
    scan_interval: 3600

I have tried a various combinations for the “select” value:

"#hightime.tide"
".high-tide #hightime.tide"
".high-tide b:nth-child(2) #hightime"

…and so on.

Most of the times I can’t get any value back - been at it for quite a while; debugger seems to return the entire html code of the page in the log.

Any ideas and/or help would be greatly appreciated.

I’m not a big fan of scraping data you get it working then they change the format …

There are some free tide apis you could call with a rest sensor, might be worth a look.

Search free tide api and see if there’s any that cover your area.

I guess they can change the format of an API as much as they can a website but I agree with you, I would rather use an API as well; In fact, there are a few API’s I would like to use but I have no idea how. The scraper was fairly easy to get started and I’m just intrigued why I can’t get this to work - I’ve managed to figure out a bunch of others.

Is there a guide for complete noobs on where to start in using API’s with Home assistant? I’ve had a looked at the rest sensor but the guide in the official docs is far from clear for someone who does not know where to start.

bumping it in the hope someone can help with this…