-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
259 lines (232 loc) · 9.34 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="YTube is a free YouTube video downloader that offers a range of options, including downloading videos in various formats such as MP4 and converting them to MP3. You can download videos in the highest or lowest resolution available on YouTube, and it offers various features. ">
<meta name="keywords" content="Youtube,YTube,ytube,youtube,youtube video downloader,free downloader,free youtube video downloader">
<meta name="author" content="AsTechpro20">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google-site-verification" content="9Si0y6EZfAGGnLDqOYCsFzgDyrf5IZU1Rqxr6lIqXsE" />
<title>YTube</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"/>
<link rel="stylesheet" href="./css/style.css">
<script src="https://unpkg.com/[email protected]/dist/typed.umd.js"></script>
<link rel="icon" type="image/x-icon" href="./Images/YTube.png">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4268618488442500"
crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<header>
<nav>
<input type="checkbox" id="check">
<label for="check" class="checkbtn">
<i class="fas fa-bars"></i>
</label>
<label class="logo" onclick="redirectToHome()">YTube</label>
<ul>
<li><a class="active" href="#">Home</a></li>
<li><a href="./about.html">About</a></li>
<li><a href="./contact.html">Contact Us</a></li>
</ul>
</nav>
</header>
<section class="space">
<h1>YTube <span class="text"></span></h1>
</section>
<div>
<span class="space"></span>
<div id="main">
<form>
<br>
<label for="url">Video URL:</label>
<input type="text" name="url" id="url" required oninput="showIframe()" placeholder="Paste your video link here" ><br><br>
<span id="error-message"></span>
<label for="format">Video Format:</label>
<select name="format" id="format">
<option value="mp4" class="option">MP4</option>
<option value="mp3" class="option">MP3</option>
</select><br><br>
<label for="quality" id="quality-label">Video Quality:</label>
<select name="quality" id="quality">
<option value="highest" class="option">Highest</option>
<option value="lowest" class="option">Lowest</option>
</select><br><br>
<button type="submit" id="submit-btn">Download</button>
<br>
<br>
<br>
<br>
</form>
</div>
</div>
<footer>
<div class="main-content">
<div class="left box">
<h2>About us</h2>
<div class="content">
<p>YTube is a free YouTube video downloader that lets you download videos in MP4 format and convert them to MP3. You can choose to download videos in the highest or lowest resolution available on YouTube, and it offers a range of features.</p>
<div class="social">
<a href="https://github.com/AsTechpro20"><span class="fa-brands fa-github"></span></a>
<a href="https://twitter.com/AsTechpro20"><span class="fab fa-twitter"></span></a>
<a href="https://instagram.com/AsTechpro20"><span class="fab fa-instagram"></span></a>
<a href="https://www.youtube.com/channel/UCbO1IT3t9f0oE8t37ZgfB7Q"><span class="fab fa-youtube"></span></a>
<a href="#"><span class="fa-brands fa-discord"></span></a>
</div>
</div>
</div>
<div class="center box">
<h2>Pages</h2>
<div class="content">
<div class="place">
<span class="text">
<li><a href="./about.html">About Us</a></li>
<lI><a href="./faq.html">FAQ</a></lI>
<li><a href="./privacypolicy.html">Privacy Policy</a></li>
<li><a href="./contact.html">Contact Us</a></li>
<li><a href="./api.html">API</a></li>
<li><a href="./termsofservice.html">Terms of Service</a></li>
</span>
</div>
</div>
</div>
<div class="right box">
<h2>Help</h2>
<div class="content">
<div class="place">
<span class="text">
<li><a href="./privacypolicy.html">Privacy Policy</a></li>
<li><a href="./termsofservice.html">Terms of Service</a></li>
<li><a href="./contact.html">Contact Us</a></li>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="bottom">
<center>
<span class="far fa-copyright"></span><span> YTube 2023 All rights reserved |</span>
<span class="credit">Made With <i class="fas fa-heart text-danger"></i> By <a href="https://www.astechpro20.tk/">AsTechpro20</a> | </span>
</center>
</div>
</footer>
</body>
</html>
<script>
function redirectToHome() {
window.location.href = "/index.html";
}
const menuBar = document.getElementById('check');
const content = document.getElementById('main');
menuBar.addEventListener('click', function() {
if (menuBar.checked) {
content.style.display = 'none';
} else {
content.style.display = 'block';
}
});
const checkbox = document.querySelector('input[type="checkbox"]');
const footer = document.querySelector('footer');
checkbox.addEventListener('click', function() {
if (checkbox.checked) {
footer.style.display = 'none';
} else {
footer.style.display = 'block';
}
});
const check = document.getElementById('check');
const body = document.body;
check.addEventListener('click', function() {
if (check.checked) {
body.classList.add('no-scroll');
} else {
body.classList.remove('no-scroll');
}
});
var typingEffect = new Typed(".text",{
strings: ['Downloader!',"It's Free!",'With no ADS!','Supports','YouTube!','Try Out!'],
loop : true,
typeSpeed : 100,
backSpeed : 80,
backDelay : 1500,
});
function showIframe() {
const urlInput = document.querySelector('#url');
const url = urlInput.value;
const iframeContainer = document.querySelector('#iframe-container');
if (url.match(/^(https?\:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/.+$/)) {
const iframe = document.createElement('iframe');
iframe.setAttribute('src', `https://www.youtube.com/embed/${extractVideoId(url)}`);
iframe.setAttribute('width', '560');
iframe.setAttribute('height', '315');
iframe.setAttribute('allow', 'autoplay; encrypted-media');
iframeContainer.innerHTML = '';
iframeContainer.appendChild(iframe);
urlInput.setCustomValidity('');
} else {
iframeContainer.innerHTML = '';
urlInput.setCustomValidity('Invalid YouTube URL');
}
}
function extractVideoId(url) {
if (url.match(/^(https?\:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/.+$/)) {
const videoIdMatch = url.match(/(?:v=|youtu\.be\/)([\w-]+)/);
if (videoIdMatch) {
return videoIdMatch[1];
}
}
return null;
}
const urlInput = document.querySelector('#url');
urlInput.addEventListener('input', () => {
urlInput.checkValidity();
});
const form = document.querySelector('form');
const formatSelect = document.querySelector('#format');
const qualityLabel = document.querySelector('#quality-label');
const qualitySelect = document.querySelector('#quality');
const submitBtn = document.querySelector('#submit-btn');
formatSelect.addEventListener('change', (e) => {
if (e.target.value === 'mp3') {
qualityLabel.hidden = true;
qualitySelect.hidden = true;
} else {
qualityLabel.hidden = false;
qualitySelect.hidden = false;
}
});
form.addEventListener('submit', (e) => {
e.preventDefault();
const url = document.querySelector('#url').value;
const format = document.querySelector('#format').value;
let downloadUrl = `https://api.ytube.eu.org/download?url=${encodeURIComponent(url)}&format=${format}`;
if (format === 'mp4') {
const quality = document.querySelector('#quality').value;
downloadUrl += `&quality=${quality}`;
}
submitBtn.disabled = true;
window.location.href = downloadUrl;
fetch(`/download?url=${videoUrl}&format=${format}&quality=${quality}`)
.then(res => {
if (res.ok) {
return res.blob().then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = getFileName(res);
document.body.appendChild(a);
a.click();
a.remove();
});
} else {
throw new Error(res.statusText);
}
})
.catch(err => {
const errorContainer = document.querySelector('#error-message');
errorContainer.textContent = `Invalid URL: ${err.message}`;
});
});
</script>