-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunfollow_users.js
50 lines (42 loc) · 1.45 KB
/
unfollow_users.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// start - app settings
// check this setting before run this script
/**
* Timeout
* this timeout is in seconds, if you set this to 5,
* every 5 second, this script will run
*
* NOTE:
* increase timeout if any suspend or rate limit happens
*/
var timeout = 3;
// end - app settings
// app variables
// Don't change this
timeout = timeout * 1000
let unfollowedUsers = 0
var unfollowUsersWhoDontFollowBackToYou = function () {
document.querySelectorAll('[data-testid="UserCell"]').forEach(function (v, i, a) {
let follows = false
v.querySelectorAll('[data-testid="userFollowIndicator"]').forEach(function (v2) {
follows = true
})
if (!follows) {
v.querySelectorAll('div[data-testid$="-unfollow"]').forEach(function (btn) {
try {
btn.click();
} catch (error) {
console.error(error)
}
});
document.querySelectorAll('div[data-testid="confirmationSheetConfirm"]').forEach(function (v3, i3, a3) {
v3.click();
unfollowedUsers++
});
console.log(unfollowedUsers + ' users are unfollow')
}
});
// scroll down to load more users
window.scrollBy(0, 10000);
}
setInterval(unfollowUsersWhoDontFollowBackToYou, timeout); // run script multipile times
unfollowUsersWhoDontFollowBackToYou(); // run for the first time