Skip to content

Commit b8bc57c

Browse files
committed
Add tests for youtube channel urls
They have to be in the form "https://www.youtube.com/channel/ID"
1 parent 6aa69a2 commit b8bc57c

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void testGetUploadDate() throws ParsingException {
111111

112112
@Test
113113
public void testGetUploaderUrl() throws ParsingException {
114-
assertTrue(extractor.getUploaderUrl().length() > 0);
114+
assertEquals("https://www.youtube.com/channel/UCsRM0YB_dabtEPGPTKo-gcw", extractor.getUploaderUrl());
115115
}
116116

117117
@Test

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorChannelOnlyTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.schabi.newpipe.extractor.services.youtube.search;
22

3+
import org.hamcrest.CoreMatchers;
34
import org.junit.BeforeClass;
45
import org.junit.Ignore;
56
import org.junit.Test;
@@ -63,4 +64,16 @@ public void testOnlyContainChannels() {
6364
}
6465
}
6566
}
67+
68+
@Test
69+
public void testChannelUrl() {
70+
for(InfoItem item : itemsPage.getItems()) {
71+
if (item.getName().contains("PewDiePie")) {
72+
assertEquals("https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw", item.getUrl());
73+
break;
74+
} else {
75+
assertThat(item.getUrl(), CoreMatchers.startsWith("https://www.youtube.com/channel/"));
76+
}
77+
}
78+
}
6679
}

0 commit comments

Comments
 (0)