this post was submitted on 24 Jan 2021
7 points (100.0% liked)

DeGoogle Yourself

9219 readers
26 users here now

A community for those that would like to get away from Google.

Here you may post anything related to DeGoogling, why we should do it or good software alternatives!

Rules

  1. Be respectful even in disagreement

  2. No advertising unless it is very relevent and justified. Do not do this excessively.

  3. No low value posts / memes. We or you need to learn, or discuss something.

Related communities

[email protected] [email protected] [email protected] [email protected] [email protected] [email protected]

founded 5 years ago
MODERATORS
 

If you have had a youtube account for a long time, and before you became privacy conscious, you might want to delete all of your youtube likes and favourites.

I was able to find the following code to delete liked video, which needs to be executed in the console in the liked videos playlist:

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('paper-listbox.style-scope.ytd-menu-popup-renderer').lastElementChild) { 
                document.querySelector('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();

I didn't find a way to do the same for the favourites, so I came up with my own, which also needs to be run in the console from the favourites videos playlist. You might need to change the text Supprimer de Favoris to what the button in the UI says in your language.

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

async function deleteFavourites() { 
    '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 () { 
            var items2 = document.querySelectorAll('paper-listbox.style-scope.ytd-menu-popup-renderer > ytd-menu-service-item-renderer > paper-item');
            for (var j = 0; j < items2.length; j++){
                if(items2[j].textContent.includes("Supprimer de Favoris")){
                    items2[j].click();
                }
            }
        }, 100); 
        await sleep(200); // sleep cause browser can not handle the process 
        clearTimeout(out); 
    } 
} 

deleteFavourites(); 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 0 points 4 years ago

I ran this and it started flagging all videos as inappropriate.