Skip to content

Commit

Permalink
proper index endpoint for /public/
Browse files Browse the repository at this point in the history
  • Loading branch information
Athlon1600 committed Feb 10, 2020
1 parent e8f97d8 commit 0f9d930
Showing 1 changed file with 59 additions and 1 deletion.
60 changes: 59 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,59 @@
hello world!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>youtube-downloader</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>

<h1>YouTube Downloader</h1>

<p>
<a href="https://github.com/Athlon1600/youtube-downloader">https://github.com/Athlon1600/youtube-downloader</a>
</p>

<form>
<input type="text" value="https://www.youtube.com/watch?v=YSuHrTfcikU" size="80" id="txt_url">
<input type="button" id="btn_fetch" value="Fetch">
</form>

<video width="800" height="600" controls>
<source src="" type="video/mp4"/>
<em>Sorry, your browser doesn't support HTML5 video.</em>
</video>


<script>
$(function () {

$("#btn_fetch").click(function () {

var url = $("#txt_url").val();

$.get('video_info.php', {url: url}, function (data) {

console.log(data);

// first link with video
var first = data.find(function (link) {
return link['format'].indexOf('video') !== -1;
});

console.log(first);

var stream_url = 'stream.php?url=' + encodeURIComponent(first['url']);

var video = $("video");
video.attr('src', stream_url);
video[0].load();
});

});

});
</script>

</body>
</html>

0 comments on commit 0f9d930

Please sign in to comment.