Skip to content

Instantly share code, notes, and snippets.

@aymericbeaumet
Last active January 29, 2026 15:35
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)
@cerohazuri
Copy link

cerohazuri commented Jul 11, 2025 via email

@iamxeeshankhan
Copy link

Try this one 👇 in case the above methods don't work

setInterval(() => {
  for (const button of document.querySelectorAll(
    'button[data-testid="unlike"], button[aria-label*="Liked"]'
  )) {
    button.click();
  }
  window.scrollTo(0, document.body.scrollHeight);
}, 1000);

@levifasten
Copy link

I want to delete likes from a suspended account, and also from an account that is private (likes don't show up on my likes page, but count as number of likes I have, BTW I can see the links to those tweets in my likes.js of my archive data).

Will any script delete those??

@jconnnewby
Copy link

Is there a code to get rid of all bookmarks?

@jconnnewby
Copy link

I am aware that this is turning into the programmer's version of playing Stairway to Heaven.

But here's mine

  • rather than estimating a scroll offset, it simply uses focus() to scroll the next item into view
  • has a backoff every 50 unlikes to prevent HTTP 429: Too Many Requests
function nextUnlike() {
  return document.querySelector('[data-testid="unlike"]')
}

function wait(ms) {
  return new Promise(resolve => setTimeout(resolve, ms))
}

async function removeAll() {
  let count = 0
  let next = nextUnlike()
  while (next && count < 500) {
    next.focus()
    next.click()
    console.log(`Unliked ${++count} tweets`)
    await wait(count % 50 === 0 ? 30000 : 2000)
    next = nextUnlike()
  }
  console.log('Out of unlikes, count =', count)
}

removeAll() 

At time of writing this is printing Unliked 1506 tweets

stops at 10 tweets

@enzoysss
Copy link

enzoysss commented Dec 6, 2025

Is there a code to get rid of all bookmarks?

setInterval(() => {
  const d = document.querySelector('button[data-testid="removeBookmark"]')
  if(d) {
    d.click()
  } else {
    window.scrollTo(0, document.body.scrollHeight)
  }
}, 1000)

This worked for me. It cleared all my bookmarks.

@londonjab
Copy link

Is there a way to use this to delete likes on Bluesky?

@londonjab
Copy link

londonjab commented Dec 21, 2025 via email

@jcoding09
Copy link

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
Copy link

Scoubi-7 commented Jan 27, 2026

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?

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