Skip to content

Commit

Permalink
🔨chore: updates youtube regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Adebesin-Cell committed Nov 22, 2024
1 parent b8d5fa4 commit 3ae2dd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/itchy-tigers-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@everipedia/iq-utils": minor
---

updates youtube regex pattern to match multiple youtube links
2 changes: 1 addition & 1 deletion src/lib/wiki-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function isMediaContentValid(media: Media[]): boolean {

if (item.source === MediaSource.Enum.YOUTUBE) {
const youtubePattern =
/^.*(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/|watch\?v=)([^#&?]*).*/;
/^.*(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/|watch\?v=)([^#&?]*)(?:\?si=[^#&?]*)?(?:\?v=[^#&?]*)?(?:[#&].*)?$/;
return (
item.id === `https://www.youtube.com/watch?v=${item.name}` &&
youtubePattern.test(item.id)
Expand Down

0 comments on commit 3ae2dd9

Please sign in to comment.