Skip to content

Instantly share code, notes, and snippets.

@aymericbeaumet
Last active June 4, 2026 19:55
Show Gist options
  • Select an option

  • Save aymericbeaumet/d1d6799a1b765c3c8bc0b675b1a1547d to your computer and use it in GitHub Desktop.

Select an option

Save aymericbeaumet/d1d6799a1b765c3c8bc0b675b1a1547d to your computer and use it in GitHub Desktop.
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
  }
  window.scrollTo(0, document.body.scrollHeight)
}, 1000)
@londonjab

londonjab commented Dec 21, 2025 via email

Copy link
Copy Markdown

@jcoding09

Copy link
Copy Markdown

As of now Likes section of other users is not visible, is it possible to create a extension which can enable likes category of other users?

@Scoubi-7

Scoubi-7 commented Jan 27, 2026

Copy link
Copy Markdown

I want to delete my old likes.
Usually when I wanted my old likes appear, I force the update by scrolling down the page and the codes above work fine for me.
But since yesterday, the old likes no longer appear with these method (even with the @hamzah1P16 code)
I tried with Brave, google and with the application.
I have over 2800 likes but they are invisible
Do you have a solution?

@arepageek

arepageek commented Apr 11, 2026

Copy link
Copy Markdown

I created this:


// Paste this entire code in console on: https://x.com/YOURUSERNAME/likes

(() => {
  console.log('%c๐Ÿš€ Starting Ultimate X Likes Unremover v5 (2026)...', 'color: #1d9bf0; font-size: 18px; font-weight: bold;');
  console.log('%cโœ… Script loaded successfully - ignore the "undefined" below', 'color: #00c060;');

  const CONFIG = {
    maxUnlikes: 999999,
    baseDelay: 2350,
    jitter: 650,
    scrollDelay: 3000,
    batchSize: 10,
    extraBatchDelay: 14000,
    scrollAmount: 950,
    maxFailedScrolls: 8,
    rateLimitPause: 65000
  };

  let count = 0;
  let isRunning = true;
  let failedScrolls = 0;
  let startTime = Date.now();

  const wait = ms => new Promise(r => setTimeout(r, ms));

  const getUnlikeButtons = () => Array.from(document.querySelectorAll('[data-testid="unlike"]'));

  const detectRateLimit = () => {
    const alerts = document.querySelectorAll('[role="alert"], [data-testid*="toast"]');
    for (const el of alerts) {
      const txt = el.textContent.toLowerCase();
      return txt.includes("try again later") || txt.includes("rate limit") || 
             txt.includes("too many requests") || txt.includes("something went wrong");
    }
    return false;
  };

  const scrollDown = async () => {
    window.scrollBy({ left: 0, top: CONFIG.scrollAmount, behavior: "smooth" });
    await wait(CONFIG.scrollDelay);
  };

  const removeAllLikes = async () => {
    console.log('%cโน๏ธ  Controls โ†’ stopUnlikes() | resumeUnlikes()', 'color: #f5a623;');

    while (isRunning && count < CONFIG.maxUnlikes) {
      const buttons = getUnlikeButtons();

      if (buttons.length === 0) {
        failedScrolls++;
        console.log(`๐Ÿ“œ No likes visible. Scrolling... (${failedScrolls}/${CONFIG.maxFailedScrolls})`);

        if (failedScrolls >= CONFIG.maxFailedScrolls) {
          console.log('%cโœ… No more likes found. Process finished!', 'color: #00c060; font-weight: bold;');
          break;
        }
        await scrollDown();
        continue;
      }

      failedScrolls = 0;

      for (const btn of buttons) {
        if (!isRunning || count >= CONFIG.maxUnlikes) break;

        if (detectRateLimit()) {
          console.log('%cโš ๏ธ Rate limit detected! Pausing 65 seconds...', 'color: #ff9900; font-weight: bold;');
          await wait(CONFIG.rateLimitPause);
          continue;
        }

        try {
          btn.scrollIntoView({ behavior: "smooth", block: "center" });
          await wait(420);

          btn.click();
          count++;

          const elapsed = ((Date.now() - startTime) / 60000).toFixed(1);
          console.log(`๐Ÿ’” Unliked #${count}  |  Time: ${elapsed} min`);

          const randomDelay = CONFIG.baseDelay + (Math.random() * CONFIG.jitter - CONFIG.jitter / 2);
          await wait(randomDelay);

          if (count % CONFIG.batchSize === 0) {
            console.log(`โณ Safety pause after ${CONFIG.batchSize} unlikes...`);
            await wait(CONFIG.extraBatchDelay);
          }
        } catch (err) {
          console.warn('โšก Click error:', err.message);
        }
      }

      await scrollDown();
    }

    const totalMin = ((Date.now() - startTime) / 60000).toFixed(1);
    console.log('%c๐Ÿ Process completed!', 'color: #1d9bf0; font-size: 16px; font-weight: bold;');
    console.log(`Total unliked: ${count} | Duration: ${totalMin} minutes`);
  };

  window.stopUnlikes = () => { isRunning = false; console.log('%cโน๏ธ PAUSED', 'color: #ff9900;'); };
  window.resumeUnlikes = () => { isRunning = true; removeAllLikes(); console.log('%cโ–ถ๏ธ Resuming...', 'color: #00c060;'); };

  removeAllLikes();
})();

@nmdias

nmdias commented Jun 3, 2026

Copy link
Copy Markdown

Fancy! Thank you ๐Ÿ˜„

I created this:


// Paste this entire code in console on: https://x.com/YOURUSERNAME/likes

(() => {
  console.log('%c๐Ÿš€ Starting Ultimate X Likes Unremover v5 (2026)...', 'color: #1d9bf0; font-size: 18px; font-weight: bold;');
  console.log('%cโœ… Script loaded successfully - ignore the "undefined" below', 'color: #00c060;');
 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment