我在过去的10年里订阅了300多个Youtube频道,现在我必须清理我的Youtube,逐个取消订阅需要一段时间,有没有办法一次性取消所有频道的订阅?
发布于 2018-02-20 05:30:35
步骤1:转到https://www.youtube.com/feed/channels并滚动到页面底部,将所有项目填充到屏幕上。
步骤2:右键单击页面上的任意位置,单击"Inspect Element“(或仅单击"Inspect"),然后单击"Console",然后复制粘贴以下脚本,然后点击return。
步骤3:
var i = 0;
var myVar = setInterval(myTimer, 3000);
function myTimer () {
var els = document.getElementById("grid-container").getElementsByClassName("ytd-expanded-shelf-contents-renderer");
if (i < els.length) {
els[i].querySelector("[aria-label^='Unsubscribe from']").click();
setTimeout(function () {
var unSubBtn = document.getElementById("confirm-button").click();
}, 2000);
setTimeout(function () {
els[i].parentNode.removeChild(els[i]);
}, 2000);
}
i++;
console.log(i + " unsubscribed by YOGIE");
console.log(els.length + " remaining");
}
第四步:坐下来看魔术!
尽情享受吧!!
注意:如果脚本在某处停止,请刷新页面并再次执行所有四个步骤。
发布于 2019-06-26 16:37:43
更新其他人提供的答案(因为最新更新对我不起作用):
var i = 0;
var count = document.querySelectorAll("ytd-channel-renderer:not(.ytd-item-section-renderer)").length;
myTimer();
function myTimer () {
if (count == 0) return;
el = document.querySelector('.ytd-subscribe-button-renderer');
el.click();
setTimeout(function () {
var unSubBtn = document.getElementById("confirm-button").click();
i++;
count--;
console.log(i + " unsubscribed");
console.log(count + " remaining");
setTimeout(function () {
el = document.querySelector("ytd-channel-renderer");
el.parentNode.removeChild(el);
myTimer();
}, 250);
}, 250);
}
对我来说,这确实起到了作用。
发布于 2020-05-03 00:12:00
Youtube频道退订(2020年4月至2020年)
访问链接:https://www.youtube.com/feed/channels
按F12
在控制台中插入以下代码
function youtubeUnsubscriber() {
var count = document.querySelectorAll("ytd-channel-renderer:not(.ytd-item-section-renderer)").length;
var randomDelay = 500;
if(count == 0) return false;
function unsubscribeVisible(randomDelay) {
if (count == 0) {
window.scrollTo(0,document.body.scrollHeight);
setTimeout(function() {
youtubeUnsubscriber();
}, 10000)
}
unsubscribeButton = document.querySelector('.ytd-subscribe-button-renderer');
unsubscribeButton.click();
setTimeout(function () {
document.getElementById("confirm-button").click()
count--;
console.log("Remaining: ", count);
setTimeout(function () {
unsubscribedElement = document.querySelector("ytd-channel-renderer");
unsubscribedElement.parentNode.removeChild(unsubscribedElement);
unsubscribeVisible(randomDelay)
}, randomDelay);
}, randomDelay);
}
unsubscribeVisible(randomDelay);
}
参考文献
https://github.com/vinnyfs89/youtube-unsubscriber
https://stackoverflow.com/questions/48874382
复制相似问题