Last active
August 11, 2024 03:39
-
-
Save edjw/61cda68535b237fa7fa8db23842c1b6d to your computer and use it in GitHub Desktop.
Removes inferred interests from Twitter https://twitter.com/settings/your_twitter_data/twitter_interests
This file contains 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
// // https://twitter.com/settings/your_twitter_data/twitter_interests | |
// Lots of discussion and improvement of the original script in the comments | |
// Here's the best version that works well | |
// Because Twitter stops the script working after unchecking 50 interests, so you will almost certainly have to run the script multiple times | |
function sleep(milliseconds) { | |
return new Promise(function (resolve) { | |
return setTimeout(resolve, milliseconds); | |
}); | |
}; | |
Array.from(document | |
.querySelectorAll('input[type="checkbox"]')) | |
.filter(checkbox => checkbox.checked == true) | |
.slice(0, 50) | |
.forEach((checkbox, index, array) => | |
sleep(1000).then(() => { | |
console.log(`${index + 1}/${array.length}: Unchecking "${checkbox.parentNode.parentNode.innerText}"`) | |
checkbox.click(); | |
})); | |
mirabilos
commented
Jul 9, 2021
via email
Alex Marshall dixit:
sleep(5000 * index).then(() => {
index can get into the multiple hundreds though…
bye,
//mirabilos
--
Gestern Nacht ist mein IRC-Netzwerk explodiert. Ich hatte nicht damit
gerechnet, darum bin ich blutverschmiert… wer konnte ahnen, daß SIE so
reagier’n… gestern Nacht ist mein IRC-Netzwerk explodiert~~~
(as of 2021-06-15 The MirOS Project temporarily reconvenes on OFTC)
Yes, but if you aren't doing this multiplication then every execution starts at the same time, just offset by 1000
from when the script is executed. Only with the multiplication is it delaying the same amount between each click, to simulate clicking them manually.
Alex Marshall dixit:
Yes, but if you aren't doing this multiplication then every execution
starts at the same time, just offset by `1000` from when the script is
executed. Only with the multiplication is it delaying the same amount
between each click, to simulate clicking them manually.
Ah, indeed, so they aren’t cumulative.
I had good-ish success with running the script a few times with an
hour pause or so in between, in the meantime… the crap site insists
on piling on more and more abstruse “interests” though.
bye,
//mirabilos
--
Gestern Nacht ist mein IRC-Netzwerk explodiert. Ich hatte nicht damit
gerechnet, darum bin ich blutverschmiert… wer konnte ahnen, daß SIE so
reagier’n… gestern Nacht ist mein IRC-Netzwerk explodiert~~~
(as of 2021-06-15 The MirOS Project temporarily reconvenes on OFTC)
Rewrote it to divide the checkboxes into chunks to run the script in batches to prevent hitting twitter's API rate limits.
let chunks = [];
let source = Array.from(document.querySelectorAll('input[type="checkbox"]:checked'));
while (source.length) {
chunks.push(source.splice(0, 20));
}
const event = new MouseEvent('click', {
view: window,
bubbles: true,
cancelable: true
});
let minutes = 10; // amount of time to wait between batches
let interval = setInterval(() => {
if (chunks.length === 0) {
clearInterval(interval);
return;
}
chunks.splice(0, 1)[0].forEach(i => {
i.dispatchEvent(event);
});
}, minutes * 60 * 1000);
People should realize that twitter does not remove the interests, and will continue to add/enable interests whilst using twitter.
Almost funny how this excellent gist is not the first result in Google, but it is the first result in Brave Search for "twitter clear interests"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment