From f55fb79d84e19f183a257469853cdeb34cb9355e Mon Sep 17 00:00:00 2001
From: Devoxin <lukel9914@gmail.com>
Date: Mon, 25 Dec 2023 00:08:23 +0000
Subject: [PATCH] Handle youtube /live/ URLs.

---
 .../source/youtube/DefaultYoutubeLinkRouter.java         | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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> T routeFromShorts(Routes<T> routes, String url) {
         return routeFromUrlWithVideoId(routes, urlInfo.path.substring(8), urlInfo);
     }
 
+    protected <T> T routeFromShortPath(Routes<T> 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://")) {