Scrape sensor for air quality index

I’m trying to create a scrape sensor to pull the air quality index from this site.

http://www.nyaqinow.net/StationInfo6.aspx?ST_ID=63

I’ve tried #current-index > h2 > div as the select but the sensor keeps reading “Unknown”

Any ideas?

This is the HTML snippet that you are getting with that selector, and there is no data there. I assume the numeric value is injected via JavaScript, so the scrape integration won’t help you here.

        <div id="current-index">
            <h2>Current Air Quality Index</h2>
            <a href="IndexPollutionBoard.aspx?ST_ID=63" id="IndexPollutionBoardLink">
                <div id="index-gauge"></div>
            </a>
        </div>

However, you might be in luck, because it appears that the actual numeric value is stored in a hidden HTML snippet at the bottom of the page:

<div id="index">73</div>

So, maybe try #index as selector.

Awesome, by using #index as the select and adding User-Agent: Mozilla/5.0 to the header it works.

Thank you!

1 Like