Skip to content

Commit b9d0941

Browse files
committed
fix N.pointer exception for getUploaderName()
1 parent 8baeb3d commit b9d0941

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,8 @@ public String getName() throws ParsingException {
737737

738738
@Override
739739
public String getUploaderName() throws ParsingException {
740-
return li.select("span.g-hovercard").first().text();
740+
return li.select("span[class*=\"attribution\"").first()
741+
.select("span").first().text();
741742
}
742743

743744
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ public void testGetKioskAvailableKiosks() throws Exception {
5353

5454
@Test
5555
public void testGetDefaultKiosk() throws Exception {
56-
assertEquals(kioskList.getDefaultKioskExtractor(null).getName(), "Trending");
56+
assertEquals(kioskList.getDefaultKioskExtractor(null).getId(), "Trending");
5757
}
5858
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ public void testGetDashMpd() throws ParsingException {
140140
public void testGetRelatedVideos() throws ExtractionException, IOException {
141141
StreamInfoItemCollector relatedVideos = extractor.getRelatedVideos();
142142
assertFalse(relatedVideos.getItemList().isEmpty());
143+
if(!relatedVideos.getErrors().isEmpty()) {
144+
for(Throwable e : relatedVideos.getErrors()) {
145+
e.printStackTrace();
146+
System.err.println("----------------------");
147+
}
148+
}
143149
assertTrue(relatedVideos.getErrors().isEmpty());
144150
}
145151
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
* <p>
3737
* WARNING: Deactivate this Test Case before uploading it to Github, otherwise CI will fail.
3838
*/
39-
@Ignore
4039
public class YoutubeStreamExtractorGemaTest {
4140

4241
@Test
42+
@Ignore
4343
public void testGemaError() throws IOException, ExtractionException {
4444
try {
4545
NewPipe.init(Downloader.getInstance());

0 commit comments

Comments
 (0)