Help with scrape of Air Quality Index

I am trying to scrape the Air Quality Index (div class=“aq-number”) from the following url:
https://www.accuweather.com/en/es/almuñécar/301862/air-quality-index/301862

but it seems whatever I try as “Selector” only returns ‘unavailable’ or ‘unknown’.

Unfortunately none of the readily available health integrations seem to have data for Almuñécar in Spain.

Could anybody help?

Thanks

Why don’t you use the HA integration ?
AccuWeather - Home Assistant (home-assistant.io)

EDIT: ah…you want the figure, not the labelling

Assuming you have the SSL/Terminal add on installed or access to curl/wget from some other command line, you’d see that this website is returning a 403: Forbidden error for this URL. This is because they are blocking bots using user-agent strings. You can get around this by specifying a user agent string that a regular browser would use. In your scrape config add User-Agent (case matters) to the headers:

  headers:
    User-Agent: "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0"
2 Likes

I am using the HA AccuWeather integration, but it doesn’t have any Air Quality sensor.

That is truly awesome, worked like a charm!