Scrape help - mortgage interest rate

Hi can someone help me with the following scape please? I’ve tried some options without success. I don’t know where to look at anymore.

It’s about this page: Hypotheekrente 30 jaar vast vergelijken?
I want to scrape the mortgage interest rate (NHG, for 30 years and then the top one (the cheapest provider)

The development view:

What I already tried:

  - resource: https://www.executiononlyhypotheek.com/hypotheek/hypotheekrente/30-jaar-vast
    sensor:
      - name: Scrape
        select: ".active"

Also things like:

  - resource: https://www.executiononlyhypotheek.com/hypotheek/hypotheekrente/30-jaar-vast
    sensor:
      - name: Scrape
        select: "#Site-Body > container > card > card-body > table table-striped table-hover > tr.text-center"

I’m missing something I guess

select: "table#nhg td.active"
index: 0

image

Because of my locale setting, I get it as “4.38%”. If you’re seeing “4,38%”, to be able to use it as a number, you probably also want:

value_template: "{{ value.replace(',','.')|select('in','.-0123456789')|join }}"

Troon this works, thanks!
May I ask how the index works? because I see a lot more “active” tables.
Why does the scrape only looks at the first?
If I want to have the second active table, can I define index 1 then?
or is it something like this ? the (1)

select: "table#nhg td.active(1)"
index: 0

The index specifies which one to use if more than one object is returned by the select. Docs here:

It’s 0 by default, but I would include it anyway, almost as a note to say “I know there’s more than one”.

You could use the nth-child() selector instead of the index if you preferred.

1 Like





#maincontent > section > table > tbody > tr:nth-child(1) > td:nth-child(2)

can sombody help me solvethis problem ?