-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.html
125 lines (113 loc) · 4.63 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web-based YouTube Downloader websites</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<style>
.container {
width: auto;
max-width: 680px;
padding: 0 15px;
}
.footer {
background-color: #f5f5f5;
}
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
<script>
$(function () {
$("#btn_fetch").click(function (e) {
e.preventDefault = false;
let url = $("#txt_url").val();
let oThis = $(this);
oThis.attr('disabled', true);
$.get('https://yt-dlp-api.peterli.website/video/?video_url=' + url, function (data) {
console.log(data);
oThis.attr('disabled', false);
let links = data['links'];
let error = data['error'];
if (error) {
alert('錯誤訊息: ' + error);
return false;
}
if (links.length === 0) {
alert('沒有找到任何的影片連結!');
return false;
}
let tbodyVideoLists = '';
let dataIndex = 1;
let downloadLink = '';
for (index in links) {
downloadLink = './download.php?video_url=' + links[index]['url'];
tbodyVideoLists += '<tr>';
tbodyVideoLists += '<th scope="row">' + dataIndex + '</th>';
tbodyVideoLists += '<td>' + links[index]['format'] + '</td>';
tbodyVideoLists += '<td>' + links[index]['itag'] + '</td>';
tbodyVideoLists += '<td><a href="' + downloadLink + '">下載</a></td>';
tbodyVideoLists += '</tr>';
dataIndex += 1;
}
$('#video-lists').html(tbodyVideoLists);
});
});
});
</script>
</head>
<body>
<main role="main" class="flex-shrink-0">
<div class="container">
<h1 class="mt-5">Web YouTube Downloader</h1>
<div class="row justify-content-left">
<div class="col-12 col-md-12 col-lg-12">
<form class="card card-sm">
<div class="card-body row no-gutters align-items-center">
<div class="col-auto">
<i class="fas fa-search h4 text-body"></i>
</div>
<!--end of col-->
<div class="col">
<input id="txt_url" class="form-control form-control-lg" type="text" placeholder="請貼上YouTube影片網址">
</div>
<!--end of col-->
<div class="col-auto">
<button id="btn_fetch" class="btn btn-lg btn-success" type="button">查詢</button>
</div>
<!--end of col-->
</div>
</form>
</div>
<!--end of col-->
</div>
<div class="row justify-content-left">
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">影片格式</th>
<th scope="col">itag</th>
<th scope="col">影片網址</th>
</tr>
</thead>
<tbody id="video-lists"></tbody>
</table>
</div>
</div>
</main>
</body>
</html>