First Version!
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>YouTube Video Downloader</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
margin-top: 50px;
|
||||
}
|
||||
input[type="url"] {
|
||||
width: 80%;
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
button {
|
||||
padding: 10px 20px;
|
||||
background-color: #ff0000;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #cc0000;
|
||||
}
|
||||
#status {
|
||||
margin-top: 20px;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>YouTube Video Downloader</h1>
|
||||
<form id="downloadForm">
|
||||
<input type="url" id="videoUrl" placeholder="Enter YouTube URL" required>
|
||||
<button type="submit">Download Video</button>
|
||||
</form>
|
||||
<div id="status"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('downloadForm').addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
const url = document.getElementById('videoUrl').value;
|
||||
const status = document.getElementById('status');
|
||||
|
||||
status.textContent = 'Starting download...';
|
||||
|
||||
fetch('http://localhost:5000/download?url=' + encodeURIComponent(url))
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
return response.text().then(text => {
|
||||
throw new Error(text || 'Download failed');
|
||||
});
|
||||
}
|
||||
status.textContent = 'Download completed!';
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
status.textContent = 'Error: ' + error.message;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user