<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>YTDL</title> <script> function retrieve_link(){ var link=document.getElementById("inputlink").value; var xhr=new XMLHttpRequest(); xhr.addEventListener("readystatechange",function(){ if(xhr.readyState<4){ show_output(["(waiting to send)","(request opened)","(headers received)","(loading)"][xhr.readyState]); } if(xhr.readyState!=4)return; var response; if(xhr.responseText==null)response="(null)"; else response=xhr.responseText; show_output(response,/^https?:\/\//.test(response)); }); xhr.open("GET","/ytdl/"+encodeURIComponent(link)); xhr.send(); } function show_output(text,link){ var output=document.getElementById("output"); if(output.firstChild)output.removeChild(output.firstChild); var e; if(link){ e=document.createElement("a"); e.href=text; e.appendChild(document.createTextNode(text)); } else e=document.createTextNode(text); output.appendChild(e); } </script> </head> <body> <h1>YTDL</h1> <p>This page uses the <code>youtube-dl</code> utility to provide a download link for a given youtube video. It just selects whatever format <code>youtube-dl</code> considers "best"; this is normally video+audio, in the highest quality provided by YouTube. Enter a link or a video id below:</p> <input type="text" id="inputlink" size="100"><br> <input type="button" value="Retrieve link" onclick="retrieve_link()"><br> <pre id="output" style="width:100%;word-wrap:break-word;"></pre> </body> </html>