Skip to content

Instantly share code, notes, and snippets.

@ElfhirDev
Last active August 12, 2016 08:06
Show Gist options
  • Select an option

  • Save ElfhirDev/923d58dd70503fcb97996ddb47b9cdc9 to your computer and use it in GitHub Desktop.

Select an option

Save ElfhirDev/923d58dd70503fcb97996ddb47b9cdc9 to your computer and use it in GitHub Desktop.
Make Youtube Playlist on the Fly
// ==UserScript==
// @name yt-make-playlist
// @namespace yt-make-playlist
// @include https://www.youtube.com/*
// @version 1.1
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.6/zepto.min.js
// ==/UserScript==
$(document).ready(function () {
var ids = [];
$('.yt-lockup-video').on('click', function (e) {
// alt + click
if (e.altKey) {
e.preventDefault();
ids.push($(this).data('context-item-id'));
}
});
$(document).on('keydown', function (e) {
// alt + p
if (e.altKey && e.which == 80) {
var playlist_url = 'http://www.youtube.com/watch_videos?video_ids=' + ids.toString();
if (window.open(playlist_url) == null) {
document.location.href = playlist_url;
}
}
});
});
@ElfhirDev
Copy link
Author

ElfhirDev commented Aug 10, 2016

Use alt+ click on YouTube icon image on a List Page (Default Home page, Hot page, Subscriptions page),
in order to add videos on the playlist.

Use alt + p to open a new window (new tab or new window depends on your browser settings), or change the current url if it failed,
with the playlist you have made

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