Commit cb821f01 authored by Tomáš Hübelbauer's avatar Tomáš Hübelbauer

Add playlist URL generator tool

parent 23afeac4
# YouTube Playlist URL
**[Here's a tool for you!!](https://bloggo.herokuapp.com/youtube-playlist-url/tool.html)**
YouTube, for some reason, make it super hard in the UI to get a URL that leads
to a playlist without also containing a cursor video.
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8" />
<title>YouTube Playlist URL</title>
<script>
window.addEventListener('load', () => {
const urlInput = document.getElementById('urlInput');
const urlCode = document.getElementById('urlCode');
const urlA = document.getElementById('urlA');
function go() {
try {
let url = new URL(urlInput.value);
url = 'https://www.youtube.com/playlist?list=' + url.searchParams.get('list');
urlCode.textContent = url;
urlA.href = url;
} catch (error) {
urlCode.textContent = error;
urlA.href = null;
}
};
urlInput.addEventListener('click', urlInput.select);
urlInput.addEventListener('input', go);
urlInput.addEventListener('change', go);
go();
});
</script>
<style>
body { font-family: sans-serif; text-align: center; }
input { width: 90%; }
a { font-weight: bold; }
</style>
</head>
<body>
<h1>YouTube Playlist URL</h1>
<p>Past a YouTube video URL with playlist attached. E.g. <a href="https://www.youtube.com/watch?v=nCKkHqlx9dE&list=PLGnWLXjIDnpBR4xqf3FO-xFFwE-ucq4Fj"><code>https://www.youtube.com/watch?v=nCKkHqlx9dE&list=PLGnWLXjIDnpBR4xqf3FO-xFFwE-ucq4Fj</code></a></p>
<input id="urlInput" value="https://www.youtube.com/watch?v=nCKkHqlx9dE&list=PLGnWLXjIDnpBR4xqf3FO-xFFwE-ucq4Fj" />
<p>Here's your shiny playlist-only URL:</p>
<a id="urlA"><code id="urlCode"></code></a>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment