How to remove (unlike) all liked videos on youtube

 


/*

* inspired by https://gist.github.com/astamicu/eb351ce10451f1a51b71a1287d36880f

* modified to remove all liked Youtube videos and to work with Youtube as of June 2023

*/



setInterval(function () {

    videos = document.getElementsByTagName('ytd-playlist-video-renderer');

  // when a video is removed, the tag gets an 'is-dimissed' attribute, which tripped the original script

    var notDismissedIndex = 0;

    video = videos[notDismissedIndex];

    while(video.hasAttribute('is-dismissed')) {

    notDismissedIndex++;

    video = videos[notDismissedIndex]

    }


    video.querySelector('#primary button[aria-label="Action menu"]').click();


    var things = document.evaluate(

        '//yt-formatted-string[contains(text(),"Remove from")]',

        document,

        null,

        XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,

        null

    );

    

    for (var i = 0; i < things.snapshotLength; i++) 

    {

        things.snapshotItem(i).click();

    }

}, 1000);



Comments

Popular Posts