There is a task of parsing data from the site Yandex-metrics.
The trouble is that almost all data is loaded using AJAX with the "show more" buttons. How can this be done? What to use. The code will be in php.
There is a task of parsing data from the site Yandex-metrics.
The trouble is that almost all data is loaded using AJAX with the "show more" buttons. How can this be done? What to use. The code will be in php.
The correct option: see which AJAX requests are executed, with which parameters and from them to get all the necessary information. It takes time to research the API to understand the format of the data and their interaction with the page.
If laziness or it takes an unreasonable amount of time for the current project on the first version, then use parsing through a real browser (for example using Selenium) or a reduced version of a browser with Javascript support, which works on the command line (for PHP there is a PHP library PhantomJS , which similar based on the original PhantomJs)
take api and parse https://tech.yandex.ru/metrika/
without problems
You need to use a bunch like Selenium + PhantomJS. Read the documentation, there is how to emulate button presses and everything else. Most importantly, set the delay to ten seconds so that the Ajax elements have time to load. And then you can drag the data
Source: https://ru.stackoverflow.com/questions/552629/
All Articles