Scrape information from a website

Hi,

I know that since the update 0.86 a scrape bug was corrected and that is why the same data does not appear now.
After a week, I have not managed to recover the data that I could before.

Can someone help me?
I need the current price of light
http://www.tarifadeluz.com/

Regards

Hi,

You can try this as select: div:nth-of-type(4) td

Thanks on @LeidenSpain’s behalf.
I was wondering whether you’d also be able to also give the info when it comes to extracting data from tables?
In this specific case, there’s only one piece of text so you can use the <div> element, but I’ve not managed to extract the data when I can rely on <div> and need to use table headers.
see Help with Scrape Sensor since 0.86 changes for reference
Thanks in advance

Thanks, but don’t work
- platform: scrape
resource: http://www.tarifadeluz.com/
name: DIV00
select: ‘div:nth-of-type(4) td’

image

Please use code blocks and syntax highlighting.

sorry, I do not understand what you mean

I have looked many times at the link that you have passed before asking the question, but I can not access that particular data.

To make the code you pasted readable to other please use correct formatting of that. This greatly improves the chance that other are able to help you.

ok

  - platform: scrape
    resource: http://www.tarifadeluz.com/
    name: DIV00
    select: 'div:nth-of-type(4) td'
- platform: scrape
  resource: http://www.tarifadeluz.com/
  name: DIV00
  select: 'font[color^="white"] > b'
  value_template: '{{ value.split(" ")[0] }}'
  unit_of_measurement: '€/kWh'

I haven’t tested this and it is probably not the most professional way but maybe it gets you somewhere.

1 Like

YES YES YES

It does not matter if it’s beautiful, the important thing is that it works. And your solution works

1 Like