Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save uratmangun/1c7308d3ddbd5633a1c0c231d09d21be to your computer and use it in GitHub Desktop.
Save uratmangun/1c7308d3ddbd5633a1c0c231d09d21be to your computer and use it in GitHub Desktop.
unlike twitter
var totalHeight = 0;
var distance = 100;
var timer = setInterval(() => {
var scrollHeight = document.body.scrollHeight;
window.scrollBy(0, distance);
totalHeight += distance;
document.querySelectorAll("div[data-testid='unlike']").forEach(a=>{a.click();})
if(totalHeight >= scrollHeight - window.innerHeight){
clearInterval(timer);
resolve();
}
}, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment