Skip to content

A twitter bot, that can login to a bot account, go to given url's and like tweets, and also scroll to the end of a given page

Notifications You must be signed in to change notification settings

Bhimgouda/Twitter-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

// This Code alone if pasted in developer console in browser's, can scroll to the end without any human intervention

let newScrollHeight = document.body.scrollHeight let scrollHeight = 0; let initial = true;

// To minimize window.scrollBy errors let threshold = 0;

while(true){ const loading = document.querySelector("circle")

if(!loading){
    // This is the break condition with a threshold value
    if(newScrollHeight === scrollHeight) threshold++;
    else threshold = 0;

    // If the height stays the same even after 5 attempts, then break
    if(threshold>10) break;
            
    // For running initial loop
    if(initial === true) initial = false
    else scrollHeight = newScrollHeight;
            
    // For Scrolling the window and also getting a new scrollHeight
    newScrollHeight = document.body.scrollHeight;
    window.scrollBy(0, newScrollHeight - scrollHeight);
        
    await wait(100)
}

// If the page is loading wait for 0.7 seconds before looping
else await wait(700)

}

console.log("loop exit")

function wait(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }

About

A twitter bot, that can login to a bot account, go to given url's and like tweets, and also scroll to the end of a given page

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published