fix N.pointer exception for getUploaderName()

This commit is contained in:
Christian Schabesberger 2017-10-31 14:10:52 +01:00
parent 8baeb3dcae
commit b9d0941411
4 changed files with 10 additions and 3 deletions

View File

@ -737,7 +737,8 @@ public class YoutubeStreamExtractor extends StreamExtractor {
@Override
public String getUploaderName() throws ParsingException {
return li.select("span.g-hovercard").first().text();
return li.select("span[class*=\"attribution\"").first()
.select("span").first().text();
}
@Override

View File

@ -53,6 +53,6 @@ public class YoutubeServiceTest {
@Test
public void testGetDefaultKiosk() throws Exception {
assertEquals(kioskList.getDefaultKioskExtractor(null).getName(), "Trending");
assertEquals(kioskList.getDefaultKioskExtractor(null).getId(), "Trending");
}
}

View File

@ -140,6 +140,12 @@ public class YoutubeStreamExtractorDefaultTest {
public void testGetRelatedVideos() throws ExtractionException, IOException {
StreamInfoItemCollector relatedVideos = extractor.getRelatedVideos();
assertFalse(relatedVideos.getItemList().isEmpty());
if(!relatedVideos.getErrors().isEmpty()) {
for(Throwable e : relatedVideos.getErrors()) {
e.printStackTrace();
System.err.println("----------------------");
}
}
assertTrue(relatedVideos.getErrors().isEmpty());
}
}

View File

@ -36,10 +36,10 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube;
* <p>
* WARNING: Deactivate this Test Case before uploading it to Github, otherwise CI will fail.
*/
@Ignore
public class YoutubeStreamExtractorGemaTest {
@Test
@Ignore
public void testGemaError() throws IOException, ExtractionException {
try {
NewPipe.init(Downloader.getInstance());