Skip to content

Commit

Permalink
fix(web): Youtube video id extraction from url (#15911)
Browse files Browse the repository at this point in the history
* Use v parameter as a fallback

* Triple equals

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
RunarVestmann and kodiakhq[bot] authored Sep 9, 2024
1 parent c34726b commit bab1072
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libs/shared/utils/src/lib/videoEmbed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ export const getVideoEmbedProperties = (
if (match) {
let id = match[7]
if (id.startsWith('/')) id = id.slice(1)
if (id.length === 11) youtubeId = id
if (id.length === 11) {
youtubeId = id
} else {
const v = item.searchParams.get('v')
if (v && v.length === 11) {
youtubeId = v
}
}
}

if (youtubeId) {
Expand Down

0 comments on commit bab1072

Please sign in to comment.