DEV Community

Cover image for Automate the removal of likes in TikTok
Frank Alvarez
Frank Alvarez

Posted on

Automate the removal of likes in TikTok

If you have ever tried to delete your likes on TikTok you would have realized that there are too many videos, then it becomes more tedious and time consuming to scroll and delete likes manually.

Remove likes with a JavaScript code

The idea is simple, place the like button and the arrow button to scroll to the next video, then make a loop to intersperse the clicks of the like button and then the scroll button.

Writing the code

For this case we will use an anonymous function that receives two parameters, one is the waiting time to go to the next video and the second is a number that will indicate how many videos the like will be removed, by default this is -1 which is equal to infinity.

The code would look like this:

((timeout, limit = -1) => {
    const likeButton = document.querySelector('span[data-e2e="browse-like-icon"]').parentElement
    const scrollButton = document.querySelector('button[data-e2e="arrow-right"]')
    if (likeButton && scrollButton) {
        let i = 1, interval = setInterval(() => {
            likeButton.click()
            setTimeout(() => scrollButton.click(), 300)
            if (i++ === limit) clearInterval(interval)
        }, timeout * 1000)
    }
})(1) // parameters are passed here, which are the timeout and the likes limit, which by default is infinite.
Enter fullscreen mode Exit fullscreen mode

Executing the code

You will need to have a computer or laptop nearby, as it is necessary to use the browser console to run the script.

To remove multiple likes on TikTok quickly and automatically follow the steps below:

  1. First open tiktok.com and log in.
  2. Then open your profile page and go to the "Liked" tab. Liked preview tab
  3. Open the developer console with "Ctrl +Shift +J" or by right clicking and selecting "inspect" or by pressing "F12". (Remember to go to the "console" tab). browser console
  4. Copy and paste the code into the console and press enter.

    ((timeout, limit = -1) => {
        const likeButton = document.querySelector('span[data-e2e="browse-like-icon"]').parentElement
        const scrollButton = document.querySelector('button[data-e2e="arrow-right"]')
        if (likeButton && scrollButton) {
            let i = 1, interval = setInterval(() => {
                likeButton.click()
                setTimeout(() => scrollButton.click(), 300)
                if (i++ === limit) clearInterval(interval)
            }, timeout * 1000)
        }
    })(1) // -> (timeout in seconds, limit)
    

    Example:
    Example console text

  5. Done πŸ₯³, now you just have to wait for the likes to be removed without doing anything.

Conclusion

This code works as of today and maybe in a next update of the TikTok web application it will break, but you can leave it in the comments if that happens, I will try to update this article.

Although if you have knowledge you can change and practice how to get the element of both buttons from the html, if you fix that then everything will work perfect.

And remember that the timeout cannot be less than one second. πŸ‘€

Top comments (5)

Collapse
 
aarone4 profile image
Aaron Reese

As a general observation, please don't copy code from a blog and paste it into console when logged in to a secure site, unless you REALLY understand what the code is doing.

Collapse
 
imelseda profile image
Imel Seda

Bit confused here. Why would you want to delete your TikTok likes? There's literally 1000s of influencers out there looking to buy TikTok followers and likes so where does the deleting ones own likes come from? and why?

Collapse
 
emmaemmlang profile image
emmaemm-lang • Edited

Can You Unlike All Of Your TikTok Videos At Once? Unfortunately, there is currently no built-in feature to unlike all of your TikTok videos, short of deleting your account and starting a new one.
On the other hand, you can go and consider to buy TikTok Likes from a trusted site.

Collapse
 
geffories profile image
Steve • Edited

thanks for this. it isnt working now, could you update please.

edit - also, could you do one to delete comments please?

Collapse
 
instapowerful profile image
Insta Powerful

If you want to buy Instagram followers with PayPal, please visit InstaPowerful.com