Skip to content

Instantly share code, notes, and snippets.

@miladrahimi
Last active November 19, 2024 17:19
Show Gist options
  • Save miladrahimi/12f24fee7de66063fd1b489f4f3f900d to your computer and use it in GitHub Desktop.
Save miladrahimi/12f24fee7de66063fd1b489f4f3f900d to your computer and use it in GitHub Desktop.
Delete all likes from X (Twitter)

To delete all your likes on X (formerly Twitter):

  1. Open your X (Twitter) profile in your browser.
  2. Navigate to the "Likes" tab.
  3. Open your browser's console:
    • Chrome (macOS): ⌥ (Option) + ⌘ (Command) + J
    • Firefox (macOS): Shift + ⌘ (Command) + J
    • Chrome/Firefox (Windows): Shift + CTRL + J
  4. Copy and paste the following code into the console, then press Enter to run it.

The script will begin deleting your likes one by one.

setInterval(() => {
    const posts = document.querySelectorAll('[data-testid="unlike"]');
    const post = Array.from(posts).find((p) => !p.dataset.processed);
    if (post) {
        post.scrollIntoView({ behavior: 'smooth', block: 'center' });
        post.click();
        post.dataset.processed = 'true';
    } else {
        console.log('No post left to unlike.')
    }
}, 1500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment