15

YouTube maintains an automatic playlist on my channel, called "Liked videos", with all the videos I have clicked the thumbs-up button.

For personal reasons, I want to clean up this list. (Deleting my YouTube account is not an option.)

I know I can delete the videos one by one, but that wouldn't fit my December, 2025 deadline. Is there a way (or a user script) to delete them all at once?

2
  • 1
    Login to your google account. go to this link (myactivity.google.com/…) on the left side of the page you will find an option called delete all. Commented Jan 16, 2021 at 19:13
  • don't have to use scripts, google provides direct delete all UI now xD Commented Jan 16, 2021 at 19:14

4 Answers 4

16

Go to the Liked playlist, open a console in the browser and write this:

var items = $('body').getElementsByClassName("pl-video-edit-remove-liked-video"); 
    for(var i = 0; i < items.length; i++){
        items[i].click();
            }

After this just hit the refresh button.

3
  • this worked a charm - no need for a bookmarklet since it's not something one does on a daily basis :)
    – RozzA
    Commented Jul 6, 2017 at 8:25
  • 1
    I did it this way: document.querySelectorAll('.pl-video-edit-options > button').forEach(b => b.click()) since there was a child button for removing videos Commented Sep 21, 2018 at 19:48
  • 2
    Unfortunately, this answer is outdated and doesnt work anymore.
    – phil294
    Commented Oct 6, 2020 at 21:00
10

Here is the JavaScript code to make it in just a minute.

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

async function deleteLikedVideos() {
    'use strict';
    var items = document.querySelectorAll('#primary ytd-playlist-video-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('tp-yt-paper-listbox.style-scope.ytd-menu-popup-renderer').lastElementChild) {
                document.querySelector('tp-yt-paper-listbox.style-scope.ytd-menu-popup-renderer').lastElementChild.click();
            }
        }, 100);
        await sleep(500); // sleep cause browser can not handle the process
        clearTimeout(out);
    }
}

deleteLikedVideos();

Tried it and it works, as it deleted all of my 200+ videos.
Last Edited: December 2021

5
  • 1
    Thank you! Removed 900 videos with likes. btw your script does not delete private and deleted videos. Commented Feb 23, 2020 at 16:43
  • 2
    Works great! But you need to load all entries into view beforehand, because the endless scroll feature of YT playlist view messes this script up.
    – phil294
    Commented Oct 6, 2020 at 22:12
  • @ArtemIllarionov yes, but you also cannot delete them manually :-/
    – phil294
    Commented Oct 6, 2020 at 22:12
  • 1
    Would suggest keeping the current version only and marking it with "last tested Dec. 2021". Commented Dec 13, 2021 at 12:14
  • Just make sure before running the script you are on the page of the liked videos (obviously) and scroll down as much as you can because by default only 100 videos are loaded and so only 100 will be deleted. I kept scrolling till 1K videos were loaded and then ran the script. Commented Aug 13, 2023 at 7:56
2

You can make the list private your privacy settings. I don't think it is possible to automate the process without making some sort of script for it (which I do not have the knowledge to be able to code one).

This might seem mundane, but the easiest way I can see of selectively removing videos from the playlist would be by going to "My Liked Videos" and clicking x on each one. Again, there might be a script that would make this easier, but my knowledge of scripting is extremely limited.

1

You can use a bookmarklet to remove videos from a playlist. Still, the process will be removing one by one. But at least you don't have to do it and faster than you manually removing it.

javascript:
function d(){
   var el = document.getElementsByClassName('pl-video-edit-remove');
   if (el.length > 0) {
      el[el.length-1].click();
      setTimeout(d,300);
   }
}
d();

Copy this code. On your bookmark bar, right-click → New Bookmark → Paste this code into the location. Then go to you "Liked videos" videos page and click on this bookmark. It will start to remove the videos from the bottom to top order.

1
  • pl-video-edit-remove should now be pl-video-edit-remove-liked-video, they renamed the class. It works better in the browser console (without javascript:) than in a bookmarklet.
    – comp500
    Commented Nov 25, 2018 at 16:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.