[YouTube] Handle urls for Shorts

This commit is contained in:
Stypox 2020-10-18 12:03:01 +02:00
parent e945f711c1
commit 6887d59570
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 3 additions and 1 deletions

View File

@ -153,7 +153,7 @@ public class YoutubeStreamLinkHandlerFactory extends LinkHandlerFactory {
return assertIsId(viewQueryValue);
}
if (path.startsWith("embed/")) {
if (path.startsWith("embed/") || path.startsWith("shorts/")) {
String id = path.split("/")[1];
return assertIsId(id);

View File

@ -81,6 +81,7 @@ public class YoutubeStreamLinkHandlerFactoryTest {
assertEquals("jZViOEv90dI", linkHandler.fromUrl("vnd.youtube:jZViOEv90dI").getId());
assertEquals("n8X9_MgEdCg", linkHandler.fromUrl("vnd.youtube://n8X9_MgEdCg").getId());
assertEquals("O0EDx9WAelc", linkHandler.fromUrl("https://music.youtube.com/watch?v=O0EDx9WAelc").getId());
assertEquals("IOS2fqxwYbA", linkHandler.fromUrl("http://www.youtube.com/shorts/IOS2fqxwYbA").getId());
}
@Test
@ -101,6 +102,7 @@ public class YoutubeStreamLinkHandlerFactoryTest {
assertTrue(linkHandler.acceptUrl("vnd.youtube:jZViOEv90dI"));
assertTrue(linkHandler.acceptUrl("vnd.youtube.launch:jZViOEv90dI"));
assertTrue(linkHandler.acceptUrl("https://music.youtube.com/watch?v=O0EDx9WAelc"));
assertTrue(linkHandler.acceptUrl("https://www.youtube.com/shorts/IOS2fqxwYbA"));
}
@Test