Skip to content

Commit 90d53bb

Browse files
committed
fix broken Video
1 parent a68abf2 commit 90d53bb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apps/codingcatdev/src/lib/components/content/Video.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
export let title: string;
44
55
const youtubeParser = (url: string) => {
6-
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
6+
var regExp = /.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/;
77
var match = url.match(regExp);
8-
return match && match[7].length == 11 ? match[7] : false;
8+
return match && match[1].length == 11 ? match[1] : false;
99
};
10-
10+
console.log(src);
1111
$: finalSrc = `https://www.youtube.com/embed/${youtubeParser(src)}`;
1212
</script>
1313

0 commit comments

Comments
 (0)