Skip to content

Instantly share code, notes, and snippets.

@swoorr
Last active April 2, 2023 11:50
Show Gist options
  • Save swoorr/33812c380b5b22efff27149e9223ec42 to your computer and use it in GitHub Desktop.
Save swoorr/33812c380b5b22efff27149e9223ec42 to your computer and use it in GitHub Desktop.
Auto Unfollow for who don't follow you. Please review ss : https://i.snipboard.io/gAMate.jpg
// twitter js
// Language: javascript
const function_for_auto_unfollow = () => {
const _follow_you_ = "Seni takip ediyor"; // 'Follow', Turkish
const _follow_ = "Takip ediliyor"; // 'Follow', Turkish
const _unfollow_confirm_ = "Takibi bırak"; // 'Unfollow', Turkish
const _continue_text_ = "Devam ediyor..."; // 'Continue', Turkish
const _finish_ = "Bitti ! , tekrar başlayacak inş :) ";
const _remaining_ = "Kalan : ";
// Button props started with : aria-label="Takip
const buttonSelectorString = Object.values(
document.querySelectorAll('div[role="button"]')
).filter(
(item) =>
item.innerText == _follow_ &&
!item?.parentNode?.parentNode?.innerText.includes(_follow_you_)
);
// Object.values(document.querySelectorAll('div[role="button"]')).slice(0,50).filter(item => item.innerText == 'Takip ediliyor' && !item.parentNode.parentNode.innerText.includes('Seni takip ediyor'))
if(buttonSelectorString.length == 0) {
console.log(_finish_);
setTimeout(() => window.scrollBy(0, 2000), 4000);
setTimeout(() => function_for_auto_unfollow(), 6000);
}
buttonSelectorString.forEach((item, index) => {
// 1st process starts after 2000 * 0 + 1000 = 1 second
// 2nd process starts after 2000 * 1 + 1000 = 3 seconds
// 3rd process starts after 2000 * 2 + 1000 = 5 seconds
// 4th process starts after 2000 * 3 + 1000 = 7 seconds
// 5th process starts after 2000 * 4 + 1000 = 9 seconds
setTimeout(() => item.childNodes[0].click(), 2000 * index + 1000);
// 1st process starts after 2000 * 0 + 2000 = 2 seconds
// 2nd process starts after 2000 * 1 + 2000 = 4 seconds
// 3rd process starts after 2000 * 2 + 2000 = 6 seconds
// 4th process starts after 2000 * 3 + 2000 = 8 seconds
// 5th process starts after 2000 * 4 + 2000 = 10 seconds
setTimeout(
() =>
Object.values(document.querySelectorAll("div"))
.filter((item) => item.innerText == _unfollow_confirm_)[1]
.click(),
2000 * index + 2000
);
setTimeout(() => window.scrollBy(0, 400), 2000 * index + 2000);
setTimeout(() => {
console.log(index);
if (index == buttonSelectorString.length - 1) {
console.log(_finish_);
function_for_auto_unfollow();
} else {
console.log(_continue_text_);
console.log(_remaining_, buttonSelectorString.length - index);
}
}, 2000 * index + 2250);
});
};
function_for_auto_unfollow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment