Euribor values scrape

Hello. I am trying to make scrape sensors for current Euribor values, but I can’t get the selector right.

- platform: scrape
  resource: https://www.euribor-rates.eu/pt/
  name: Euribor (3 meses)
  select: "#mm-1 > div.Site.js-stickybit-parent > div.Site-container > div.Site-body > div > div:nth-child(1) > div > div.card-body > table > tbody > tr:nth-child(3) > td.text-right"
  unit_of_measurement: 'EUR'
  scan_interval: 7200
  value_template: '{{ value.replace(",", ".") }}'

I copied the selector from Google Chrome, but all I get is “unknown” value".

Can someone help, please? Thanks in advance :slight_smile:

Well, I managed to get the correct selector using Firefox, so for anyone that is interested in this, here goes:

sensor:
  - platform: scrape
    resource: https://www.euribor-rates.eu/pt/
    name: Euribor (1 week)
    select: ".table > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2)"
    unit_of_measurement: '%'
    scan_interval: 7200
    value_template: '{{ value.split(" ")[0].replace(",", ".") }}'
    unique_id: euribor_1week
    
  - platform: scrape
    resource: https://www.euribor-rates.eu/pt/
    name: Euribor (1 month)
    select: ".table > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(2)"
    unit_of_measurement: '%'
    scan_interval: 7200
    value_template: '{{ value.split(" ")[0].replace(",", ".") }}'
    unique_id: euribor_1month
    
  - platform: scrape
    resource: https://www.euribor-rates.eu/pt/
    name: Euribor (3 months)
    select: ".table > tbody:nth-child(1) > tr:nth-child(3) > td:nth-child(2)"
    unit_of_measurement: '%'
    scan_interval: 7200
    value_template: '{{ value.split(" ")[0].replace(",", ".") }}'
    unique_id: euribor_3months
    
  - platform: scrape
    resource: https://www.euribor-rates.eu/pt/
    name: Euribor (6 months)
    select: ".table > tbody:nth-child(1) > tr:nth-child(4) > td:nth-child(2)"
    unit_of_measurement: '%'
    scan_interval: 7200
    value_template: '{{ value.split(" ")[0].replace(",", ".") }}'
    unique_id: euribor_6months
    
  - platform: scrape
    resource: https://www.euribor-rates.eu/pt/
    name: Euribor (12 months)
    select: ".table > tbody:nth-child(1) > tr:nth-child(5) > td:nth-child(2)"
    unit_of_measurement: '%'
    scan_interval: 7200
    value_template: '{{ value.split(" ")[0].replace(",", ".") }}'
    unique_id: euribor_12months

Good scrapping! :slight_smile:

2 Likes

That is very useful. I was looking for that.
Thanks from PT

1 Like

If you donot want to scrape then you could also do a REST with this api
Interest Rate API - API Ninjas (api-ninjas.com)
EDIT: I forgot to mention that this is NOT for free ( I paid this once a while back as it has some funny API)

Can you help with configuring the new version of homeasssistant ?

This one works for me, in this case, Euribor 6 months.
You can adapt from the code above, in the solution, to the rate you want.