Thursday, August 3, 2023
yt
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
text-align: center;
background-color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}
h1 {
margin-top: 0;
}
input {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#downloadLink {
margin-top: 20px;
}
document.addEventListener("DOMContentLoaded", function () {
const downloadBtn = document.getElementById("downloadBtn");
const videoUrlInput = document.getElementById("videoUrl");
const downloadLink = document.getElementById("downloadLink");
downloadBtn.addEventListener("click", function () {
const videoUrl = videoUrlInput.value;
if (videoUrl) {
const videoId = extractVideoId(videoUrl);
const downloadUrl = `https://www.youtube.com/watch?v=${videoId}`;
downloadLink.innerHTML = `Download Video`;
}
});
function extractVideoId(url) {
const regex = /[?&]v=([^]*)/;
const match = url.match(regex);
return match ? match[1] : null;
}
});
YouTube Video Downloader
No comments:
Post a Comment