Skip to content

Commit 75a4ccb

Browse files
G-flatTobiGr
authored andcommitted
Add tests for newly supported channel URLs and fix regression
1 parent 345c7f4 commit 75a4ccb

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubeChannelLinkHandlerFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public String getUrl(final String id,
7171
* @return whether the value conform to short channel URLs
7272
*/
7373
private boolean isCustomShortChannelUrl(@Nonnull final String[] splitPath) {
74-
return splitPath.length == 1 && !EXCLUDED_SEGMENTS.matcher(splitPath[0]).matches();
74+
return splitPath.length == 1 && !splitPath[0].isEmpty()
75+
&& !EXCLUDED_SEGMENTS.matcher(splitPath[0]).matches();
7576
}
7677

7778
/**

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelLinkHandlerFactoryTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,8 @@ void getIdFromUrl() throws ParsingException {
8888

8989
assertEquals("@Gronkh", linkHandler.fromUrl("https://www.youtube.com/@Gronkh?ucbcb=1").getId());
9090
assertEquals("@YouTubeCreators", linkHandler.fromUrl("https://www.youtube.com/@YouTubeCreators/shorts").getId());
91+
92+
assertEquals("PewDiePie", linkHandler.fromUrl("https://www.youtube.com/PewDiePie").getId());
93+
assertEquals("DreamTraps", linkHandler.fromUrl("https://www.youtube.com/DreamTraps").getId());
9194
}
9295
}

0 commit comments

Comments
 (0)