Last active
March 30, 2025 23:20
-
-
Save nghiepdev/e9df0c731012e2060b49b180000bbd98 to your computer and use it in GitHub Desktop.
Unfollow Tiktok
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function autoScrollToLastFollower() { | |
const lastFollower = document.querySelector( | |
'div[data-e2e="follow-info-popup"]>div:last-child>li:last-child' | |
); | |
if (lastFollower) { | |
lastFollower.scrollIntoView(); | |
} else { | |
console.info('No follower found. Make sure you are on the following page and opening list of followers.'); | |
} | |
} | |
function unfollowFirstMatchingUser() { | |
const targetText = 'Following'; | |
const allButtons = Array.from( | |
document.querySelectorAll('button[data-e2e="follow-button"]') | |
); | |
const matchingButtons = allButtons.filter( | |
(button) => button.textContent.trim() === targetText | |
); | |
const firstButton = matchingButtons[0]; | |
if (firstButton) { | |
firstButton.click(); | |
console.info('Unfollow success!!!'); | |
} | |
countRemainingFollowing(); | |
} | |
function countRemainingFollowing() { | |
const followingButtons = Array.from( | |
document.querySelectorAll('button[data-e2e="follow-button"]') | |
).filter((button) => button.textContent.trim() === 'Following'); | |
console.info(followingButtons.length); | |
} | |
setInterval(autoScrollToLastFollower, 3000); | |
setInterval(unfollowFirstMatchingUser, 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment