We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5d498a8 commit 1650089Copy full SHA for 1650089
js-coding-technique/getYoutubeVideoId.js
@@ -0,0 +1,7 @@
1
+const getYoutubeEmbedUrl = (url) => {
2
+ const youtubeVideoId = url.match(
3
+ /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/,
4
+ );
5
+
6
+ return `https://www.youtube.com/embed/${youtubeVideoId[1]}`;
7
+};
0 commit comments