Youtube Deleted/Private video unliker/remover

removes videos named [Private video] or [Deleted video] if they have no timestamp from playlists you edit, including your Liked videos list.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Youtube Deleted/Private video unliker/remover
// @namespace    whatever
// @version      1
// @description  removes videos named [Private video] or [Deleted video] if they have no timestamp from playlists you edit, including your Liked videos list.
// @author       <[email protected]>
// @match        https://www.youtube.com/playlist?list=*
// @grant        none
// @homepage     https://github.com/nazgand/userscripts
// ==/UserScript==


function trydelete() {
    const badVideo=document.querySelector('tr.pl-video[data-title="[Private video]"],tr.pl-video[data-title="[Deleted video]"]');
    if (badVideo !== null) {
        if (badVideo.querySelector('div.timestamp')===null) {
            badVideo.querySelector('button.pl-video-edit-remove-liked-video,button.pl-video-edit-remove').click();
            setTimeout(trydelete, 200);
        } else {
            //The scripter was too lazy to deal with this unlikely error.
        }
    } else {
        tryload();
    }
}
function tryload() {
    const btnLoadMore = document.querySelector('button.load-more-button');
    if (btnLoadMore !== null) {
        btnLoadMore.click();
        setTimeout(trydelete, 900);
    }
}
trydelete();