I have these two commands:
window.scrollTo(0, 5000);
document.querySelectorAll('.components-button.components-button-size-mini.components-button-type-primary.components-button-theme-dark.desktop.components-button-inline').forEach(btn => btn.click());
I use them on this site via DevTools Console:
https://booyah.live/users/13080294/followers
But as I scroll down and load more profiles, there comes a time when Google Chrome crashes completely.
I would like to know if there is any way to automate these commands and that do not need to have the original website open so that the browser does not crash.
Purpose of the commands:
1 - Scroll to the end to load more profiles
2 - Click on the "follow" button of the available profiles
Don't simulate scroll, you will be overflow your memory very quickly. Just simulate the request instead. See more.
Example code:
var maxFolowNumber = 1000;
var userProfileID = 13080294;
var yourUserProfileID = ...; // Got on your profile url.
run = () => {
for (let i = 0; i < maxFolowNumber; i += 100)
fetch(`https://booyah.live/api/v3/users/${userProfileID}/followers?cursor=${i}&count=100`, {"method": "GET"})
.then(j => j.text())
.then(k => JSON.parse(k).follower_list.forEach(q =>
fetch(`https://booyah.live/api/v3/users/${yourUserProfileID}/followings`, {
"body": `{\"followee_uid\":${q.uid}}`,
"method": "POST",
})
));
}
run();