Answer the question
In order to leave comments, you need to log in
How to parse data from any site using esp8266?
there is a website https://www.iqair.com/ru/kazakhstan/almaty-qalasy/... . I need to get the air quality index (aqi) using esp8266. how can this be implemented?
Answer the question
In order to leave comments, you need to log in
No way, because the esp8266 simply does not have enough resources to load a site weighing 300+kb into its RAM, which has only 160kb.
In theory, it is possible to do this through the API, but there are some restrictions, and https is used, which esp8266 will not export either (not exactly)
So the only option is to parse data using some other server, and send data through which some lighter protocol.
If this data is needed for some kind of air purification system, then it is better to use your own sensors, as they will give more relevant and accurate data.
You can use Micropython https://micropython.org/
Install on ESP8266 https://docs.micropython.org/en/latest/esp8266/tut...
uRequests
https://makeblock-micropython-api.readthedocs.io/e ...
Xpath did not find it, apparently too many resources are required for full-fledged parsing of the tree, so you can search by the usual search for a substring in a string, the desired fragment looks something like this
<p _ngcontent-sc202="" class="aqi-value__unit"> AQI США </p><p _ngcontent-sc202="" class="aqi-value__value"> 109 <!----></p>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question