Exlude links which are not channels
This commit is contained in:
parent
e3f996e014
commit
d3f80d1538
2 changed files with 5 additions and 1 deletions
|
@ -58,7 +58,7 @@ public class YoutubeChannelLinkHandlerFactory extends ListLinkHandlerFactory {
|
||||||
*/
|
*/
|
||||||
private boolean isCustomShortChannelUrl(String[] splitPath) {
|
private boolean isCustomShortChannelUrl(String[] splitPath) {
|
||||||
return splitPath.length == 1 &&
|
return splitPath.length == 1 &&
|
||||||
!splitPath[0].matches("playlist|watch|attribution_link|watch_popup|embed|feed");
|
!splitPath[0].matches("playlist|watch|attribution_link|watch_popup|embed|feed|select_site");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -47,6 +47,8 @@ public class YoutubeChannelLinkHandlerFactoryTest {
|
||||||
|
|
||||||
assertTrue(linkHandler.acceptUrl("https://invidio.us/channel/UClq42foiSgl7sSpLupnugGA"));
|
assertTrue(linkHandler.acceptUrl("https://invidio.us/channel/UClq42foiSgl7sSpLupnugGA"));
|
||||||
assertTrue(linkHandler.acceptUrl("https://invidio.us/channel/UClq42foiSgl7sSpLupnugGA/videos?disable_polymer=1"));
|
assertTrue(linkHandler.acceptUrl("https://invidio.us/channel/UClq42foiSgl7sSpLupnugGA/videos?disable_polymer=1"));
|
||||||
|
assertTrue(linkHandler.acceptUrl("https://www.youtube.com/watchismo"));
|
||||||
|
|
||||||
|
|
||||||
// do not accept URLs which are not channels
|
// do not accept URLs which are not channels
|
||||||
assertFalse(linkHandler.acceptUrl("https://www.youtube.com/watch?v=jZViOEv90dI&t=100"));
|
assertFalse(linkHandler.acceptUrl("https://www.youtube.com/watch?v=jZViOEv90dI&t=100"));
|
||||||
|
@ -55,6 +57,8 @@ public class YoutubeChannelLinkHandlerFactoryTest {
|
||||||
assertFalse(linkHandler.acceptUrl("https://www.youtube.com/playlist?list=PLW5y1tjAOzI3orQNF1yGGVL5x-pR2K1d"));
|
assertFalse(linkHandler.acceptUrl("https://www.youtube.com/playlist?list=PLW5y1tjAOzI3orQNF1yGGVL5x-pR2K1d"));
|
||||||
assertFalse(linkHandler.acceptUrl("https://www.youtube.com/embed/jZViOEv90dI"));
|
assertFalse(linkHandler.acceptUrl("https://www.youtube.com/embed/jZViOEv90dI"));
|
||||||
assertFalse(linkHandler.acceptUrl("https://www.youtube.com/feed/subscriptions?list=PLz8YL4HVC87WJQDzVoY943URKQCsHS9XV"));
|
assertFalse(linkHandler.acceptUrl("https://www.youtube.com/feed/subscriptions?list=PLz8YL4HVC87WJQDzVoY943URKQCsHS9XV"));
|
||||||
|
assertFalse(linkHandler.acceptUrl("https://www.youtube.com/?app=desktop&persist_app=1"));
|
||||||
|
assertFalse(linkHandler.acceptUrl("https://m.youtube.com/select_site"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue