Merge pull request #418 from Stypox/yt-shorts
[YouTube] Handle URLs for Shorts
This commit is contained in:
commit
3058af0e43
|
@ -153,7 +153,7 @@ public class YoutubeStreamLinkHandlerFactory extends LinkHandlerFactory {
|
||||||
return assertIsId(viewQueryValue);
|
return assertIsId(viewQueryValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.startsWith("embed/")) {
|
if (path.startsWith("embed/") || path.startsWith("shorts/")) {
|
||||||
String id = path.split("/")[1];
|
String id = path.split("/")[1];
|
||||||
|
|
||||||
return assertIsId(id);
|
return assertIsId(id);
|
||||||
|
|
|
@ -81,6 +81,7 @@ public class YoutubeStreamLinkHandlerFactoryTest {
|
||||||
assertEquals("jZViOEv90dI", linkHandler.fromUrl("vnd.youtube:jZViOEv90dI").getId());
|
assertEquals("jZViOEv90dI", linkHandler.fromUrl("vnd.youtube:jZViOEv90dI").getId());
|
||||||
assertEquals("n8X9_MgEdCg", linkHandler.fromUrl("vnd.youtube://n8X9_MgEdCg").getId());
|
assertEquals("n8X9_MgEdCg", linkHandler.fromUrl("vnd.youtube://n8X9_MgEdCg").getId());
|
||||||
assertEquals("O0EDx9WAelc", linkHandler.fromUrl("https://music.youtube.com/watch?v=O0EDx9WAelc").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
|
@Test
|
||||||
|
@ -101,6 +102,7 @@ public class YoutubeStreamLinkHandlerFactoryTest {
|
||||||
assertTrue(linkHandler.acceptUrl("vnd.youtube:jZViOEv90dI"));
|
assertTrue(linkHandler.acceptUrl("vnd.youtube:jZViOEv90dI"));
|
||||||
assertTrue(linkHandler.acceptUrl("vnd.youtube.launch:jZViOEv90dI"));
|
assertTrue(linkHandler.acceptUrl("vnd.youtube.launch:jZViOEv90dI"));
|
||||||
assertTrue(linkHandler.acceptUrl("https://music.youtube.com/watch?v=O0EDx9WAelc"));
|
assertTrue(linkHandler.acceptUrl("https://music.youtube.com/watch?v=O0EDx9WAelc"));
|
||||||
|
assertTrue(linkHandler.acceptUrl("https://www.youtube.com/shorts/IOS2fqxwYbA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue