B
B
blackgrom2021-11-01 22:07:25
Arduino
blackgrom, 2021-11-01 22:07:25

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?
61803ae8657a9234289114.jpeg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vasily Bannikov, 2021-11-02
@blackgrom

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.

S
ScriptKiddo, 2021-11-01
@ScriptKiddo

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>

T
Tony, 2021-11-01
@AntonSazonov

And how do you do it without ESP8266?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question