diff options
Diffstat (limited to 'popup.js')
-rw-r--r-- | popup.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -919,8 +919,9 @@ function sendRequestToServer(type, address, callback) { xmlhttp.send(); } -function getYouTubeVideoID(url) { // Return video id or false +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; } |