From c53a0389831fbff3c08068d2417e56becb1c4d7c Mon Sep 17 00:00:00 2001 From: khalilcodes Date: Thu, 16 Jun 2022 16:41:12 +0300 Subject: [PATCH] [site/lib][xs]: add youtube id regex --- site/lib/constants.js | 1 + 1 file changed, 1 insertion(+) diff --git a/site/lib/constants.js b/site/lib/constants.js index 7df911b..5b6e54c 100644 --- a/site/lib/constants.js +++ b/site/lib/constants.js @@ -1,3 +1,4 @@ export const YOUTUBE_REGEX = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; +export const YOUTUBE_ID_REGEX = /(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:\S*&)?vi?=|(?:embed|v|vi|user|shorts)\/))([^?&\"'>\s]+)/ export const TWITTER_REGEX = /^https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(es)?\/(\d+)/;