Skip to content

Instantly share code, notes, and snippets.

@ktaragorn
Last active August 30, 2017 03:16
Show Gist options
  • Save ktaragorn/9c0d8fd8feffa73a4d6de4ee09c917d6 to your computer and use it in GitHub Desktop.
Save ktaragorn/9c0d8fd8feffa73a4d6de4ee09c917d6 to your computer and use it in GitHub Desktop.
Copy Video Links from Youtube Watch Later
// ==UserScript==
// @name Copy Video Links from Youtube Watch Later
// @namespace ktaragorn
// @description Copy Video Links from Youtube Watch Later for later downloading
// @include https://www.youtube.com/playlist?list=WL
// @version 2
// @grant none
// ==/UserScript==
function getUrls(){
return JSON.stringify(Array.prototype.slice.call(document.querySelectorAll("a.ytd-playlist-video-renderer")).map(function(a){return a.href.replace(/&list=.*/g,'').replace(/&index=.*/g,'')}))
}
window.linkClick= function(){
if(confirm("Have you revealed all videos(click show more at the bottom)??")){
prompt("Copy to clipboard", getUrls());
alert("Now copy these videos to another playlist, delete from WL, delete the other playlist")
}
}
function createLink(){
document.getElementById("title").innerHTML += '<a href="javascript:window.linkClick();">'+"Click to get all urls"+'</a>'
}
createLink();
@ktaragorn
Copy link
Author

@ktaragorn
Copy link
Author

Updated to new version of youtube UI

@ktaragorn
Copy link
Author

"Polymer version" version 1 can be used by adding &disable_polymer=true to the url

@ktaragorn
Copy link
Author

This file is redundant. It is far simpler to move Watch later videos to a public playlist and directly download that via youtube-dl since it handles playlists natively

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment