summaryrefslogtreecommitdiff
path: root/modules/ytdl/ytdl.html
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-09-13 11:43:06 +0200
committertomsmeding <tom.smeding@gmail.com>2016-09-13 11:44:11 +0200
commitf00ba92ed2cc1a9c24ad783e83525d1b5a85b857 (patch)
tree4d1c00a47c7f3842bcf3dece83d3c00ed3ae459f /modules/ytdl/ytdl.html
Initial
Diffstat (limited to 'modules/ytdl/ytdl.html')
-rw-r--r--modules/ytdl/ytdl.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/ytdl/ytdl.html b/modules/ytdl/ytdl.html
new file mode 100644
index 0000000..e054b97
--- /dev/null
+++ b/modules/ytdl/ytdl.html
@@ -0,0 +1,45 @@
+<!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>