Mass Auto Follow Suggested Friends Strava

2024.10.01 00:00

Note

Script JS

// Function to find and return all "Follow" buttons
function findFollowButtons() {
    return document.querySelectorAll('.------packages-dashboard-ui-src-components-YourSuggestedFollows-YourSuggestedFollows-module__followButton--DPkgm');
}

// Function to click a button and return a promise
function clickButton(button) {
    return new Promise((resolve) => {
        button.click();
        console.log('Clicked a Follow button');
        setTimeout(resolve, 1000); // Wait for 1 second after clicking
    });
}

// Main function to continuously find and click buttons for 10 minutes
async function clickFollowButtonsFor10Minutes() {
    const startTime = Date.now();
    const tenMinutes = 10 * 60 * 1000; // 10 minutes in milliseconds

    while (Date.now() - startTime < tenMinutes) {
        const buttons = findFollowButtons();
        if (buttons.length === 0) {
            console.log('No more Follow buttons found. Waiting for new ones...');
            await new Promise(resolve => setTimeout(resolve, 5000)); // Wait for 5 seconds before checking again
            continue;
        }

        for (const button of buttons) {
            await clickButton(button);
            if (Date.now() - startTime >= tenMinutes) {
                console.log('10 minutes have passed. Stopping.');
                return;
            }
        }

        // Wait for a short time before checking for new buttons
        await new Promise(resolve => setTimeout(resolve, 500));
    }

    console.log('10 minutes have passed. Stopping.');
}

// Start the process
clickFollowButtonsFor10Minutes().then(() => {
    console.log('Script has finished running.');
});