M
M
Maxim Kuprashevich2015-02-13 23:25:57
JavaScript
Maxim Kuprashevich, 2015-02-13 23:25:57

How to scroll through the autoloading page as fast as possible?

Hi all. I've been struggling for a long time and can't come up with an elegant solution.
It is necessary to count all friends, for example (the same for search results and other things), on Facebook. Let's say through the mob. version.
Here is an example: https://m.facebook.com/anastasia.isaeva1?v=friends
There are a lot of friends there and they are autoloaded as you scroll. All I could do was scroll down until the scrollbar was stuck for a while, say 15 seconds. It is slow, it gradually starts to slow down even on powerful machines and is not elegant at all. I am writing from C++ via WebKit. That is, the source code of the page and the DOM model are available to me, but my poor knowledge of HTML and JS is not enough to understand how to do it better. Parsing then all this is not a problem, of course, but squandering is a real problem. Maybe there is some kind of signal that can be sent via HTTP requests or something else?
I would be very grateful for the sensible help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Evsign, 2015-02-14
@Evsign

I don’t sit on Facebook, so I can’t suggest a ready-made solution, but I’ll tell you in which direction to dig.
As a rule, such scrolling things are done through ajax. You need to fetch the http request that is sent every time the scroll reaches the bottom. As a rule, this is + another parameter in the uri.
Maybe something like queqe=0 on first load, then queqe=15 when the page hits the bottom for the first time, then queqe=30....etc.
To get this thing, see the network tab in the development tools, you can enable XHR filtering.
You may be lucky and you will get the uri of the desired request, which returns json.
Your scrolling options are perverted))
And even better, as you have already been advised - use api.

N
NetBear, 2015-02-13
@NetBear

Here a person solves a similar problem:
stackoverflow.com/questions/17196378/detect-scroll...
More useful:
stackoverflow.com/questions/11715646/scroll-automa...

S
Sergey Melnikov, 2015-02-13
@mlnkv

What about the Facebook API?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question