Youtube I could embed as video. The problem is more with links to random servers that could track users IP addresses and user agents.

Reply to this note

Please Login to reply.

Discussion

Hmm, good point.

Github Copilot wrote me code to embed youtube videos. Let's deploy.

```

const youtubeRegex = /(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w-]{11})(?:\S+)?/g;

replacedText = reactStringReplace(replacedText, youtubeRegex, (match, i) => {

return (

key={match + i}

width="560"

height="315"

src={`https://www.youtube.com/embed/${match}`}

frameBorder="0"

allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"

allowFullScreen

/>

);

});

```

Sweet!