mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
YT: handle embedded videos URIs
This commit is contained in:
@@ -493,14 +493,18 @@ function checkYouTubeUri(uri)
|
|||||||
gstUri.normalize();
|
gstUri.normalize();
|
||||||
|
|
||||||
const host = gstUri.get_host();
|
const host = gstUri.get_host();
|
||||||
|
|
||||||
let success = true;
|
|
||||||
let videoId = null;
|
let videoId = null;
|
||||||
|
|
||||||
switch(host) {
|
switch(host) {
|
||||||
case 'www.youtube.com':
|
case 'www.youtube.com':
|
||||||
case 'youtube.com':
|
case 'youtube.com':
|
||||||
videoId = gstUri.get_query_value('v');
|
videoId = gstUri.get_query_value('v');
|
||||||
|
if(!videoId) {
|
||||||
|
/* Handle embedded videos */
|
||||||
|
const segments = gstUri.get_path_segments();
|
||||||
|
if(segments && segments.length)
|
||||||
|
videoId = segments[segments.length - 1];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'youtu.be':
|
case 'youtu.be':
|
||||||
videoId = gstUri.get_path_segments()[1];
|
videoId = gstUri.get_path_segments()[1];
|
||||||
@@ -512,9 +516,10 @@ function checkYouTubeUri(uri)
|
|||||||
videoId = originalHost;
|
videoId = originalHost;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
success = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const success = (videoId != null);
|
||||||
|
|
||||||
return [success, videoId];
|
return [success, videoId];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user