Skip to content

Instantly share code, notes, and snippets.

@AyHa1810
Last active April 10, 2024 16:40
Show Gist options
  • Save AyHa1810/258d12907b136d7542fd4665ecb17647 to your computer and use it in GitHub Desktop.
Save AyHa1810/258d12907b136d7542fd4665ecb17647 to your computer and use it in GitHub Desktop.
Save youtube links of all the videos in a terminated playlist into a text file
// Save youtube links of all the videos in a terminated playlist into a text file
// Open your playlist appeal page, go to the "Look at your content" tab, open inspect element,
// paste this code in the console and press enter.
// Gets all the videos from the video list
var list = $x("/html/body/yttou-dialog/ytcp-dialog/tp-yt-paper-dialog/div[2]/div/yttou-guided-resolution/div[2]/yttou-guided-resolution-playlist-review-step/div[2]/a/@href");
// funtion that creates a text file in memory and downloads
// source: https://stackoverflow.com/a/18197341
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
};
// does the text processing
var string = "";
for (var i in list) { string+=list[i].value + "\n" };
download("playlist.txt", string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment