Skip to content

Instantly share code, notes, and snippets.

@sayhicoelho
Created May 26, 2018 01:35
Show Gist options
  • Save sayhicoelho/97803248a3d61f303eba21559b629b82 to your computer and use it in GitHub Desktop.
Save sayhicoelho/97803248a3d61f303eba21559b629b82 to your computer and use it in GitHub Desktop.
Twitter: Automate Removing Tweets From Browser Console
var str = 'Adicionei um vídeo a uma playlist';
function doDropdownDelete() {
var tweets = document.querySelectorAll('.js-tweet-text-container > p:first-child');
console.clear();
console.error(tweets.length);
for (var i = 0; i < tweets.length; i++) {
var text = tweets[i].textContent;
if (text.indexOf(str) != -1) {
var header = tweets[i].parentNode.parentNode.querySelector('.stream-item-header');
var btnDelete = header.querySelector('li.js-actionDelete > button');
setTimeout(function () {
btnDelete.click();
doModalDelete();
}, 1000);
break;
}
}
}
function doModalDelete() {
var modal = document.getElementById('delete-tweet-dialog');
var btnDelete = modal.querySelector('button.delete-action');
setTimeout(function () {
if (modal.style.display == 'block') {
btnDelete.click();
setTimeout(function () {
doDropdownDelete();
}, 3000);
}
}, 1000);
}
doDropdownDelete();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment