How to delete all videos on "Liked Videos" YouTube automatic playlist

In the recent times sneaky scripts on web pages while you are watching cats video on one tab can on the other browser's tab open turkish or korean videos in the hidden area of the page and watch it secretly and add them to liked video playlist. It's so annoying, but there is a solution. Instead of clicking manually on the page to remove all those videos from the autogenerated playlist you can use a little script too.

First, open your playlist on youtube you want to clear out. In my example you can see 2394 videos that I have no idea how were added to the playlist. I want clear this out completely. You need to open your playlist and scroll down to the bottom.

You need to right click on empty field/page and select the bottom menu "Inspect" (may be different in different languages):

You'll see a console and other tools on the right side of the window:

You need to copy the script:

function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms));}
async function deleteLikedVideos() { 'use strict'; var items = document.querySelectorAll('ytd-menu-renderer > yt-icon-button.dropdown-trigger > button[aria-label]'); var out;
for (var i = 0; i < items.length; i++) { items[i].click(); out = setTimeout(function () { if (document.querySelector('').lastElementChild) { document.querySelector(''); } }, 100); await sleep(500); // sleep cause browser can not handle the process clearTimeout(out); }}

And paste it into the bottom right window called "Console", then hit Enter.

As a result, you'll see how all your videos are being removed one by one completely automatically!