Skip to content

Instantly share code, notes, and snippets.

@ajohnclark
ajohnclark / gist:50ef0ba4b550c872170b3ef664136f5b
Last active October 14, 2025 13:20
Remove all X tweets/retweets
// Working as of 10/2025. Just go to profile page -> run in dev console. Deletes all retweets and tweets you made. May break / need to run a few times, janky but works.
// Run on profile page in dev console. Fix: avoid clicking anchors — only click button / role="button" elements.
(async function deleteAndUndoRetweets_safe({
actionDelay = 700,
scrollDelay = 1200,
maxScrolls = 800,
menuWait = 1200
} = {}) {
const sleep = ms => new Promise(r => setTimeout(r, ms));
// Unfollow all on x.com (working as of 10/2025). Run in dev console on /following page. May break / need to run a few times, janky.
(async function unfollowAll({
clickDelay = 700, // ms between individual clicks
scrollDelay = 1200, // ms to wait after scrolling to load items
max = 0 // 0 = unlimited, set >0 to stop after that many unfollows
} = {}) {
const sleep = ms => new Promise(res => setTimeout(res, ms));
// selector targets buttons that look like the "Following" buttons in the new HTML