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 b3a47a65..9f3d4fbb 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 @@ -29,7 +29,8 @@ public class DefaultYoutubeLinkRouter implements YoutubeLinkRouter { new Extractor(Pattern.compile("^" + PROTOCOL_REGEX + DOMAIN_REGEX + "/.*"), this::routeFromMainDomain), 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 + "/shorts/.*"), this::routeFromShorts), + new Extractor(Pattern.compile("^" + PROTOCOL_REGEX + DOMAIN_REGEX + "/live/.*"), this::routeFromShortPath) }; @Override @@ -118,6 +119,12 @@ protected T routeFromShorts(Routes routes, String url) { return routeFromUrlWithVideoId(routes, urlInfo.path.substring(8), urlInfo); } + protected T routeFromShortPath(Routes routes, String url) { + UrlInfo urlInfo = getUrlInfo(url, true); + String[] pathParts = urlInfo.path.split("/"); + return routeFromUrlWithVideoId(routes, pathParts[pathParts.length - 1], urlInfo); + } + private static UrlInfo getUrlInfo(String url, boolean retryValidPart) { try { if (!url.startsWith("http://") && !url.startsWith("https://")) {