Last active
March 8, 2022 09:47
-
-
Save luzfcb/af156e643aa97106d4ef2ac39fc55143 to your computer and use it in GitHub Desktop.
Dismiss all twitter topics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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