YouTube Thumbnail Downloader Tool
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f2f2f2;
}
.container {
text-align: center;
padding: 20px;
border: 1px solid #ccc;
border-radius: 10px;
background-color: #fff;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
h1 {
color: #007bff;
}
.input-container {
margin-top: 20px;
}
input {
padding: 8px 12px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px 0 0 5px;
}
button {
padding: 8px 20px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 0 5px 5px 0;
background-color: #007bff;
color: #fff;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #0056b3;
}
.thumbnail-container {
margin-top: 20px;
}
img {
max-width: 100%;
height: auto;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 10px;
}
#error-message {
color: red;
}
const downloadButton = document.getElementById('download-button');
const videoUrlInput = document.getElementById('video-url');
const thumbnailImage = document.getElementById('thumbnail-image');
const errorMessage = document.getElementById('error-message');
downloadButton.addEventListener('click', () => {
const videoUrl = videoUrlInput.value;
if (!videoUrl) {
errorMessage.textContent = 'Please enter a valid YouTube video URL.';
thumbnailImage.src = '';
return;
}
// Replace 'YOUR_BACKEND_API_URL' with the actual backend API URL.
const backendUrl = `YOUR_BACKEND_API_URL?url=${encodeURIComponent(videoUrl)}`;
fetch(backendUrl)
.then(response => response.json())
.then(data => {
if (data.error) {
errorMessage.textContent = data.error;
thumbnailImage.src = '';
} else {
errorMessage.textContent = '';
thumbnailImage.src = data.thumbnailUrl;
}
})
.catch(error => {
errorMessage.textContent = 'Error fetching data';
thumbnailImage.src = '';
console.error(error);
});
});
Documentation
Step 1:- Open txt file from the folder for code
Step 2:- Copy all code
Step 3:- Open your website dashboard or blog
Step 4:- Add HTML element
Step 5:- Paste all code in your html element
Step 6:- Save file
Done you are successfully Pasted code in your website.
0 Comments