Skip to content

Instantly share code, notes, and snippets.

@edc
edc / clone-youtube-playlist.js
Last active September 21, 2018 23:30
Add a whole Youtube playlist to watch later - so you can clone the list easily
// this script copies a youtube playlist to the "watch later" list, so you can easily clone the
// list by creating a new one off the watch later list. You must run this on a playlist overview
// page like http://www.youtube.com/playlist?list=xxxxxxxxx
// this script is meant to be converted into a bookmarklet, using something like http://mrcoles.com/bookmarklet/
// after conversion, it becomes this:
// javascript:(function()%7Bvar%20buttons%20%3D%20document.querySelectorAll(%22button.addto-watch-later-button%22)%3Bvar%20videos%20%3D%20document.querySelectorAll(%22.playlist-video-item%22)%3Bif%20(videos.length%20!%3D%20buttons.length)%20%7Balert(%22Some%20videos%20are%20already%20in%20watch%20later!%20Found%20%22%20%2B%20videos.length%20%2B%20%22%20videos%20but%20%22%20%2B%20buttons.length%20%2B%20%22%20buttons.%20Abort%20now.%22)%3B%7D%20else%20%7Bif%20(confirm(%22Add%20%22%20%2B%20buttons.length%20%2B%20%22%20videos%3F%22))%20%7Bvar%20dialog%20%3D%20document.createElement(%22h1%22)%3Bdialog.innerHTML%20%3D