Skip to content

Instantly share code, notes, and snippets.

@luzfcb
Last active March 8, 2022 09:47
Show Gist options
  • Save luzfcb/af156e643aa97106d4ef2ac39fc55143 to your computer and use it in GitHub Desktop.
Save luzfcb/af156e643aa97106d4ef2ac39fc55143 to your computer and use it in GitHub Desktop.
Dismiss all twitter topics
// Dismiss all topics listed on https://twitter.com/YOUR_USERNAME/topics
// 1 - open the https://twitter.com/YOUR_USERNAME/topics
// 2 - open the browser console (Press Command + Option + J (Mac) or Control + Shift + J (Windows and Linux))
// 3 - copy this code
// 4 - paste the code on the console to run
// 5 - reload the page and run step 4 and 5 again until you no longer see "Dismiss" messages
function dismiss_all_topics() {
var toQuery = [
'Dismiss', // en
'Descartar' // pt-BR
];
for (const toQueryKey in toQuery) {
var timer = 100;
my_selector = "[aria-label^='" + toQuery[toQueryKey] + "']";
document.querySelectorAll(my_selector).forEach(
(interest) => {
setTimeout(function () {
console.log(interest.ariaLabel);
interest.click()
}, timer);
timer += 2000;
});
}
}
dismiss_all_topics();
@vitordino
Copy link

tried with 100 ms it worked fine (with my average internet connection)
2 seconds is basically slower than what a user would do

neat script nonetheless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment