Exlude links which are not channels

This commit is contained in:
Bartosz Rumiński 2020-10-20 20:06:06 +02:00
parent e3f996e014
commit d3f80d1538
2 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,7 @@ public class YoutubeChannelLinkHandlerFactory extends ListLinkHandlerFactory {
*/
private boolean isCustomShortChannelUrl(String[] splitPath) {
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

View File

@ -47,6 +47,8 @@ public class YoutubeChannelLinkHandlerFactoryTest {
assertTrue(linkHandler.acceptUrl("https://invidio.us/channel/UClq42foiSgl7sSpLupnugGA"));
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
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/embed/jZViOEv90dI"));
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