diff --git a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/DefaultYoutubeLinkRouter.java b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/DefaultYoutubeLinkRouter.java index e5f42a33..b4f82de1 100644 --- a/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/DefaultYoutubeLinkRouter.java +++ b/main/src/main/java/com/sedmelluq/discord/lavaplayer/source/youtube/DefaultYoutubeLinkRouter.java @@ -30,7 +30,7 @@ public class DefaultYoutubeLinkRouter implements YoutubeLinkRouter { new Extractor(Pattern.compile("^" + PROTOCOL_REGEX + SHORT_DOMAIN_REGEX + "/.*"), this::routeFromShortDomain), new Extractor(Pattern.compile("^" + PROTOCOL_REGEX + DOMAIN_REGEX + "/embed/.*"), this::routeFromEmbed), new Extractor(Pattern.compile("^" + PROTOCOL_REGEX + DOMAIN_REGEX + "/shorts/.*"), this::routeFromShorts), - new Extractor(Pattern.compile("^" + PROTOCOL_REGEX + DOMAIN_REGEX + "/live/.*"), this::routeFromShortPath) + new Extractor(Pattern.compile("^" + PROTOCOL_REGEX + DOMAIN_REGEX + "/live/.*"), this::routeFromLivePath) }; @Override @@ -119,10 +119,9 @@ protected T routeFromShorts(Routes routes, String url) { return routeFromUrlWithVideoId(routes, urlInfo.path.substring(8), urlInfo); } - protected T routeFromShortPath(Routes routes, String url) { + protected T routeFromLivePath(Routes routes, String url) { UrlInfo urlInfo = getUrlInfo(url, true); - String[] pathParts = urlInfo.path.split("/"); - return routeFromUrlWithVideoId(routes, pathParts[pathParts.length - 1], urlInfo); + return routeFromUrlWithVideoId(routes, urlInfo.path.substring(6), urlInfo); } private static UrlInfo getUrlInfo(String url, boolean retryValidPart) {