Skip to content

Instantly share code, notes, and snippets.

@mariohmol
Last active April 5, 2021 18:43
Show Gist options
  • Save mariohmol/60ec098d5e552acd7463d2f674775a61 to your computer and use it in GitHub Desktop.
Save mariohmol/60ec098d5e552acd7463d2f674775a61 to your computer and use it in GitHub Desktop.
Twitter Scripts
function makeRandomTime(){
const x = Math.random()*2000 + 1000
console.log('Random time:',x)
return x
}
function makeDeleteLikeTimeout(){
setTimeout(() => {
runDeleteLikes();
makeDeleteLikeTimeout()
}, makeRandomTime())
}
function runDeleteLikesWhile(){
console.log('Starting loop delete like')
d = document.querySelector('div[data-testid="unlike"]')
let max = 0
while(d){
console.log('Clicking')
d.click()
d = document.querySelector('div[data-testid="unlike"]')
max++
if(max>100){
break
}
}
window.scrollTo(0, document.body.scrollHeight)
}
function runDeleteLikes(){
console.log('Starting loop delete like')
for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
let max = 0
console.log('Clicking')
d.click()
max++
if(max>100){
break
}
}
window.scrollTo(0, document.body.scrollHeight)
}
function makeDeleteTweetTimeout(){
setTimeout(() => {
runDeleteTweet()
makeDeleteTweetTimeout();
}, makeRandomTime())
}
function runDeleteTweet(){
console.log('Starting loop delete tweet')
for (const d of document.querySelectorAll('div[data-testid="tweet"] div[data-testid="caret"]')) {
console.log(d)
d.click()
menus = document.querySelectorAll('div[role="menuitem"]')
if(menus && menus[0] && menus[0].innerHTML.indexOf('Delete')>0){
document.querySelectorAll('div[role="menuitem"]')[0].click()
document.querySelectorAll('div[data-testid="confirmationSheetConfirm"]')[0].click()
}
d.click()
}
window.scrollTo(0, document.body.scrollHeight)
}
// makeDeleteLikeTimeout()
//makeDeleteTweetTimeout()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment