const regul =
  /^(?:https?:)?(?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube(?:\-nocookie)?\.(?:[A-Za-z]{2,4}|[A-Za-z]{2,3}\.[A-Za-z]{2})\/)(?:watch|embed\/|vi?\/)*(?:\?[\w=&]*vi?=)?([^#&\?\/]{11}).*$/;
let id = prompt('Уажите ссылку на видео YouTube');
id = id.match(regul)[1];
let youtube = `<iframe width='560' height='315' src='https://www.youtube.com/embed/${id}' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe>`;
console.log(id);
document.write(youtube);
