Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Metalhearf/329bc997f9bb762efc0e2aec9029bdc8 to your computer and use it in GitHub Desktop.
Save Metalhearf/329bc997f9bb762efc0e2aec9029bdc8 to your computer and use it in GitHub Desktop.
Untick all Twitter (X) ad recommendations
/*
* To untick all the "personalised interests" that are used for ad targeting on twitter
* you go to this page: https://twitter.com/settings/your_twitter_data/twitter_interests
*
* Go to the inspector and run this code and it should untick all the ticked boxes
* in the list. You need a delay or the twitter API thinks you're trying to overload it.
*/
var checkboxes = [];
document.querySelectorAll('input[type="checkbox"]').forEach((c) => {
if(c.checked) {
checkboxes[checkboxes.length] = c;
}
});
var i = 0;
var loopId = setInterval(() => {
var e = checkboxes[i++];
if(i % 10 == 0) { console.log("Running... (" + i + ")")} // Should say on the Console where we're at.
if(e !== undefined) {
if(e.checked) {
console.log(e);
e.parentElement.click();
}
} else {
clearInterval(loopId);
}
}, 5000); // seems to be a good interval to not overload the API and leave it running in the background.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment