const url = 'https://www.youtube.com/embed/_ebOk8C1-po';
const regex = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/;
const match = url.match(regex);
console.log('Match:', match ? match[1] : 'NO MATCH');

// Test embed fallback
if (!match) {
    const idMatch = url.match(/\/embed\/([^?&]+)/);
    console.log('Fallback match:', idMatch ? idMatch[1] : 'NO FALLBACK MATCH');
}

// Final embed URL
const videoId = match ? match[1] : (url.match(/\/embed\/([^?&]+)/) || [])[1];
console.log('Video ID:', videoId);
console.log('Final URL:', videoId ? `https://www.youtube.com/embed/${videoId}?rel=0&modestbranding=1&enablejsapi=1` : url);
