-
Notifications
You must be signed in to change notification settings - Fork 0
/
MassYoutubeUnsubscriber.js
30 lines (23 loc) · 1.02 KB
/
MassYoutubeUnsubscriber.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
(async function iife() {
var UNSUBSCRIBE_DELAY_TIME = 100;
var CONFIRM_DELAY_TIME = 100;
var runAfterDelay = (fn, delay) => new Promise((resolve, reject) => {
setTimeout(() => {
fn();
resolve();
}, delay);
});
var channels = Array.from(document.querySelectorAll(`.yt-spec-button-shape-next.yt-spec-button-shape-next--tonal.yt-spec-button-shape-next--mono.yt-spec-button-shape-next--size-m.yt-spec-button-shape-next--icon-leading-trailing`));
console.log(`${channels.length} channels found.`);
for (const channel of channels) {
channel.click();
await runAfterDelay(() => {
var dis = Array.from(document.querySelectorAll(".style-scope.ytd-menu-popup-renderer"));
dis[4].click();
}, UNSUBSCRIBE_DELAY_TIME);
await runAfterDelay(() => {}, CONFIRM_DELAY_TIME);
await runAfterDelay(() => {
document.getElementById('confirm-button').getElementsByTagName('button')[0].click();
}, 0);
}
})();