Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 16, 2022 04:33 pm GMT

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.

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.


Original Link: https://dev.to/frankalvarez/automate-the-removal-of-likes-in-tiktok-4oic

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To