Sensor scrape unknow

good evening guys, i’m trying to scrape from this site, specifically from this site and this pop up, i would like to get the full list, but it always returns unknown, this is my sensor conf.

thanks to those who answer me

  - platform: scrape            
    name: atm_alert
    resource: https://www.atm.it/it/Pagine/default.aspx
    select: '#Alert_m_testo'

The scrape sensor works with the actual HTML code that comes straight from the web server, not what you are looking at in the web browser.

This is what the scrape sensor sees:

<div id="Alert_m_sfondo" class="Alert_m_sfondo">
    <div class="Alert_m_Main">
        <div class="Alert_m_contenuto">
            <div id="Alert_m_chiudi">Chiudi</div>
            <h4 id="Alert_m_Titolo" class="Alert_m_Titolo"></h4>
            <hr class="Alert_m_linea" />
            <div id="Alert_m_testo" class="Alert_m_testo"></div>
            <br />
            <br />
        </div>
    </div>
</div>

There are possibly some good news: I can see that the actual data shown in that pop up is loaded as JSON from this URL: https://alert.atm.it/it

You could use the rest integration to fetch this JSON and then try to extract the data you’re interested in.

thanks buddy, i had no idea i could use his json, but since i don’t like ready-to-eat baby food, how did you know there was a json? sorry if the question is trivial but I’m a beginner

If the data is not in the HTML code coming from the server it must come from somewhere else, and nowadays the standard method is to fetch the data via JSON. In the web browsers Developer Tools you can select Network → Fetch/XHR to see that this website is indeed fetching the missing data as JSON.

thank you very much for the explanation you are really kind, however i am trying to bring home his data but nothing, i do not receive the sensor, it would seem that the template is wrong, i am using this. but according to the documentation it should be right and instead nothing, do you have any ideas?

i have tried these ways here

  - platform: rest
    resource: https://alert.atm.it/it
    name: atm alert
    value_template: "{{value_json['alert_text']}}"

  - platform: rest
    resource: https://alert.atm.it/it
    name: atm alert
    value_template: "{{value_json.alert_text}}"

---------------------------------------------------------------------------------------------

rest:
  headers:
    Content-Type: application/json  
  method: GET
  resource: https://alert.atm.it/it
  sensor:
    - name: "cambiamento_servizio"
      value_template: "{{ value_json[0]['alert_text']}}"

The text in json form comes from https://alert.atm.it/it?465
No idea what the “465” stands for or if it’s fixed.

comes from both https://alert.atm.it/it?465 and from https://alert.atm.it/it, I get the same information back, I’ll try your

same result, it does not create the sensor

Check your log. You can only put 255 characters in a state.

you are right maybe throwing in an input text would be the solution?

input_text are limited to 255 characters. Throw it in an attribute, which has no limit.

thanks petro, i try to do it because i never did, thanks again, in case i ask you for a hand

thx so much, i resolve with this

  - platform: rest
    name: comunicazione servizio
    resource: https://alert.atm.it/it
    method: GET
    value_template: >
      {{value_json[0].alert_text}}
    json_attributes:cf
      - alert_text