From 4d79cb85c93353cdb5ead518da63cf8f9fa71497 Mon Sep 17 00:00:00 2001 From: Arend-Jan Tetteroo Date: Fri, 29 Sep 2023 14:25:14 +0200 Subject: [PATCH] feat(extension/youtube): Allow youtube shorts urls to be embedded Youtube uses /shorts/ for their shorts video. The /embed url works with these id's, the regex did not support them though. This updates the videoId regex to also support the /shorts/ urls. --- packages/extension-youtube/src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/extension-youtube/src/utils.ts b/packages/extension-youtube/src/utils.ts index 1b0735458d1..e6eb82680da 100644 --- a/packages/extension-youtube/src/utils.ts +++ b/packages/extension-youtube/src/utils.ts @@ -67,7 +67,7 @@ export const getEmbedUrlFromYoutubeUrl = (options: GetEmbedUrlOptions) => { return `${getYoutubeEmbedUrl(nocookie)}${id}` } - const videoIdRegex = /v=([-\w]+)/gm + const videoIdRegex = /(?:v=|shorts\/)([-\w]+)/gm const matches = videoIdRegex.exec(url) if (!matches || !matches[1]) {