';
}
}
function getVideoId(url) {
const regex = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/.*v=|youtu\.be\/)([^&]+)/;
const match = url.match(regex);
return match ? match[1] : null;
}
function downloadThumbnail(event) {
event.preventDefault(); // Prevent the default link action
const thumbnailUrl = event.currentTarget.href; // Get the thumbnail URL
const a = document.createElement('a'); // Create a new anchor element
a.href = thumbnailUrl; // Set the URL
a.download = 'thumbnail.jpg'; // Set the download attribute
document.body.appendChild(a); // Append to the body
a.click(); // Programmatically click the anchor to trigger download
document.body.removeChild(a); // Remove the anchor from the document
}