From 71008319569ba94846257c11558f094f1af68b92 Mon Sep 17 00:00:00 2001 From: Official Noob <31563761+OfficialNoob@users.noreply.github.com> Date: Sat, 27 Jul 2019 22:18:43 +0100 Subject: [PATCH] getYouTubeVideoID Video ID Parser --- content.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content.js b/content.js index 522fb810..6e5d27ef 100644 --- a/content.js +++ b/content.js @@ -676,5 +676,6 @@ function sendRequestToCustomServer(type, fullAddress, callback) { function getYouTubeVideoID(url) { // Returns with video id else returns false var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; var match = url.match(regExp); - return (match && match[7].length == 11) ? match[7] : false; + var id = new URL(url).searchParams.get("v"); + return (match && match[7].length == 11) ? id : false; }