-
-
Save parkr/d600696478d03d6f9c32 to your computer and use it in GitHub Desktop.
// go to https://twitter.com/your-username, and enter the following into the developer console: | |
for(var i = 1; i < 500; i++){ // just do it a bunch | |
// Un retweet | |
document.getElementsByClassName("ProfileTweet-actionButtonUndo")[i].click(); | |
document.getElementsByClassName("js-close")[0].click(); | |
// Delete tweets | |
document.getElementsByClassName("js-actionDelete")[i].childNodes[1].click(); | |
document.getElementsByClassName("delete-action")[0].click() | |
} |
// Un retweet
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
for(var i = 1; i < 500; i++){
document.querySelectorAll('[data-testid="unretweet"]')[0].click()
await sleep(1000)
document.querySelectorAll('[data-testid="unretweetConfirm"]')[0].click()
await sleep(1000)
}
// Un retweet
function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } for(var i = 1; i < 500; i++){ document.querySelectorAll('[data-testid="unretweet"]')[0].click() await sleep(1000) document.querySelectorAll('[data-testid="unretweetConfirm"]')[0].click() await sleep(1000) }
Does this still work? How do I use it?
// Un retweet
function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } for(var i = 1; i < 500; i++){ document.querySelectorAll('[data-testid="unretweet"]')[0].click() await sleep(1000) document.querySelectorAll('[data-testid="unretweetConfirm"]')[0].click() await sleep(1000) }Does this still work? How do I use it?
yes it is.
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
for(var i = 1; i < 500; i++){
document.querySelectorAll('[data-testid="unretweet"]')[0].click()
await sleep(1000)
document.querySelectorAll('[data-testid="unretweetConfirm"]')[0].click()
await sleep(1000)
}
// Un retweet
function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } for(var i = 1; i < 500; i++){ document.querySelectorAll('[data-testid="unretweet"]')[0].click() await sleep(1000) document.querySelectorAll('[data-testid="unretweetConfirm"]')[0].click() await sleep(1000) }
tysm !!
This was needed for Firefox for me, 100ms :
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function unretweet() {
for(var i = 1; i < 500; i++){
document.querySelectorAll('[data-testid="unretweet"]')[0].click()
await sleep(100)
document.querySelectorAll('[data-testid="unretweetConfirm"]')[0].click()
await sleep(100)
}
}
unretweet()
bro i got 1563:5 Uncaught TypeError: Cannot read properties of undefined (reading 'click')
at :5:58
( like this what to do not working in chrome
is this code works in fire fox for sure ?
This is the code I have used today and it works perfectly fine:
(function () {
var delTweets = function () {
var tweetsRemaining = document.querySelectorAll('[role="heading"]+div')[1].textContent;
console.log('Remaining: ', tweetsRemaining);
window.scrollBy(0, 10000);
document.querySelectorAll('[aria-label="More"]').forEach(function (v, i, a) {
v.click();
document.querySelectorAll('span').forEach(function (v2, i2, a2) {
if (v2.textContent === 'Delete') {
v2.click();
document.querySelectorAll('[data-testid="confirmationSheetConfirm"]').forEach(function (v3, i3, a3) {
v3.click();
});
}
else {
document.body.click();
}
});
});
setTimeout(delTweets, 0);
};
delTweets();
})();
Credits to: g-h-0-S-t for providing the code.
^ modified the previous code to also "undo retweets"
(function () {
var delTweets = function () {
var tweetsRemaining = document.querySelectorAll('[role="heading"]+div')[1]
.textContent;
console.log("Remaining: ", tweetsRemaining);
window.scrollBy(0, 10000);
document
.querySelectorAll('[aria-label="More"]')
.forEach(function (v, _, _) {
v.click();
document.querySelectorAll("span").forEach(function (v2, i2, a2) {
if (v2.textContent === "Delete") {
v2.click();
document
.querySelectorAll('[data-testid="confirmationSheetConfirm"]')
.forEach(function (v3, i3, a3) {
v3.click();
});
} else {
document.body.click();
}
});
});
document
.querySelectorAll('[data-testid="unretweet"]')
.forEach(function (v, _, _) {
v.click();
document
.querySelectorAll('[data-testid="unretweetConfirm"]')
.forEach(function (v2, _, _) {
v2.click();
});
});
setTimeout(delTweets, 0);
};
delTweets();
})();
you may need to refresh the page and restart the script every so often since it seems twitter rate limits loading tweets
I used this script and it worked for a while, but now my twitter likes are invisible. They do not show in my likes tab. What could be the problem, and how do I fix it?
I have used this script and it has been working for a while, do you have any of yours working for it?
^ modified the previous code to also "undo retweets"
(function () { var delTweets = function () { var tweetsRemaining = document.querySelectorAll('[role="heading"]+div')[1] .textContent; console.log("Remaining: ", tweetsRemaining); window.scrollBy(0, 10000); document .querySelectorAll('[aria-label="More"]') .forEach(function (v, _, _) { v.click(); document.querySelectorAll("span").forEach(function (v2, i2, a2) { if (v2.textContent === "Delete") { v2.click(); document .querySelectorAll('[data-testid="confirmationSheetConfirm"]') .forEach(function (v3, i3, a3) { v3.click(); }); } else { document.body.click(); } }); }); document .querySelectorAll('[data-testid="unretweet"]') .forEach(function (v, _, _) { v.click(); document .querySelectorAll('[data-testid="unretweetConfirm"]') .forEach(function (v2, _, _) { v2.click(); }); }); setTimeout(delTweets, 0); }; delTweets(); })();you may need to refresh the page and restart the script every so often since it seems twitter rate limits loading tweets
now longer work for likes
I used this script over a year ago and now my twitter likes do not show in the likes tab. How do i fix this ?
setting a timeout to prevent browser to crash
(function () {
var delTweets = function () {
var tweetsRemaining = document.querySelectorAll('[role="heading"]+div')[1]
.textContent;
console.log("Remaining: ", tweetsRemaining);
var moreButtons = document.querySelectorAll('[aria-label="More"]');
var deleteCount = 0;
moreButtons.forEach(function (v) {
v.click();
var deleteButtons = document.querySelectorAll("span");
for (var i = 0; i < deleteButtons.length; i++) {
if (deleteButtons[i].textContent === "Delete") {
deleteButtons[i].click();
document
.querySelectorAll('[data-testid="confirmationSheetConfirm"]')
.forEach(function (v3) {
v3.click();
deleteCount++;
});
break;
}
}
document.body.click();
});
var unretweetButtons = document.querySelectorAll('[data-testid="unretweet"]');
unretweetButtons.forEach(function (v) {
v.click();
document
.querySelectorAll('[data-testid="unretweetConfirm"]')
.forEach(function (v2) {
v2.click();
});
});
if (deleteCount === 0) {
window.scrollBy(0, 1000);
}
setTimeout(delTweets, 2000);
};
delTweets();
})();
try https://stackoverflow.com/a/71333246/6798139