seregazhuk / php-pinterest-bot

This PHP library will help you to work with your Pinterest account without using any API account credentials.
MIT License
413 stars 129 forks source link

Pagination is extremely slow for a profile with a lot of followers #422

Closed vladoa closed 5 years ago

vladoa commented 5 years ago

If I take a profile like this:

$id = '470555998474494414';

$limit = 500;

$offset = 2000;

$followers = $bot->pinners->followers($id, $limit)->skip($offset)->get();

which has like 59k followers, it takes around 2 minutes to execute

whereas by using $limit = 500 and $offset = 0 it takes around 30 seconds. So if the user has 59k followers, and I put $offset = 58500; the script takes forever to execute.

Any ideas how to deal with profiles with many followers?

seregazhuk commented 5 years ago

Hi. You are right. Unfortunately, under the hood, the bot has to loop through all previous followers. Pinterest doesn't provide explicit API for it. So, the bot behaves exactly like the site.

vladoa commented 5 years ago

I thought so. I think I will just write some javascript that will scroll down and grab the usernames. Still, I really like your project and I appreciate your answer!