From ce3ac634cbd2be28feedd5dd5a2a6c03430cf2a0 Mon Sep 17 00:00:00 2001 From: Tobias Theuer Date: Wed, 15 Mar 2017 03:55:22 +0100 Subject: [PATCH] Actually fixed regex. --- js/plugins.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/plugins.js b/js/plugins.js index e5ce676..2db0597 100644 --- a/js/plugins.js +++ b/js/plugins.js @@ -209,11 +209,11 @@ plugins.factory('userPlugins', function() { * See: https://developers.google.com/youtube/player_parameters */ var youtubePlugin = new UrlPlugin('YouTube video', function(url) { - var regex = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/i, + var regex = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i, match = url.match(regex); if (match){ - var token = match[2], + var token = match[1], embedurl = "https://www.youtube.com/embed/" + token + "?html5=1&iv_load_policy=3&modestbranding=1&rel=0", element = angular.element('') .attr('src', embedurl)