Answer the question
In order to leave comments, you need to log in
How to properly parse a dynamically paginated site?
Hello. I'm trying to parse data from one store, where products are loaded dynamically using ajax on scroll. The number of goods on the page is not shown, the data is loaded asynchronously via xhr (when making requests, the parameter &page = i is simply added to the main url, where i is the number of the next page, and then the resulting content is appended to the main page).
The parsing breakpoint is the presence on the page of a certain selector (if the value of i goes beyond the maximum value of pagination), in which a message is displayed that the product was not found.
Please tell me how to correctly organize the parsing cycle using jQuery.ajax () so that, firstly, they all work asynchronously and deliver data in parallel, and on the other hand, so that as soon as the above selector pops up in the first request, then stop all subsequent requests and parsing.
If the number of pages were known, then it would be possible to simply run queries with the async = true parameter in the form of a for jQuery.ajax() loop and add the parsed data to the global variable in the success block.
In the case of an unknown number of pages in dynamic pagination, on the one hand, I want to get the data asynchronously, on the other hand, I don’t want to parse extra pages.
Now there is a limit on parsing-1000 positions. this is about 40 requests (i = 1..40), each request lasts about 3-4 seconds. But there can really be 10 products in a category, and parsing of 1 page is enough (on the parsing of the second page, a selector will appear in the response, by which we could stop parsing)
Thanks in advance for the advice.
Answer the question
In order to leave comments, you need to log in
GET requests go to ?page=xxx?
So contact them with a curl or whatever the work is going on there :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question