fix N.pointer exception for getUploaderName()
This commit is contained in:
parent
8baeb3dcae
commit
b9d0941411
|
@ -737,7 +737,8 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUploaderName() throws ParsingException {
|
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
|
@Override
|
||||||
|
|
|
@ -53,6 +53,6 @@ public class YoutubeServiceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetDefaultKiosk() throws Exception {
|
public void testGetDefaultKiosk() throws Exception {
|
||||||
assertEquals(kioskList.getDefaultKioskExtractor(null).getName(), "Trending");
|
assertEquals(kioskList.getDefaultKioskExtractor(null).getId(), "Trending");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,12 @@ public class YoutubeStreamExtractorDefaultTest {
|
||||||
public void testGetRelatedVideos() throws ExtractionException, IOException {
|
public void testGetRelatedVideos() throws ExtractionException, IOException {
|
||||||
StreamInfoItemCollector relatedVideos = extractor.getRelatedVideos();
|
StreamInfoItemCollector relatedVideos = extractor.getRelatedVideos();
|
||||||
assertFalse(relatedVideos.getItemList().isEmpty());
|
assertFalse(relatedVideos.getItemList().isEmpty());
|
||||||
|
if(!relatedVideos.getErrors().isEmpty()) {
|
||||||
|
for(Throwable e : relatedVideos.getErrors()) {
|
||||||
|
e.printStackTrace();
|
||||||
|
System.err.println("----------------------");
|
||||||
|
}
|
||||||
|
}
|
||||||
assertTrue(relatedVideos.getErrors().isEmpty());
|
assertTrue(relatedVideos.getErrors().isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,10 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
||||||
* <p>
|
* <p>
|
||||||
* WARNING: Deactivate this Test Case before uploading it to Github, otherwise CI will fail.
|
* WARNING: Deactivate this Test Case before uploading it to Github, otherwise CI will fail.
|
||||||
*/
|
*/
|
||||||
@Ignore
|
|
||||||
public class YoutubeStreamExtractorGemaTest {
|
public class YoutubeStreamExtractorGemaTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testGemaError() throws IOException, ExtractionException {
|
public void testGemaError() throws IOException, ExtractionException {
|
||||||
try {
|
try {
|
||||||
NewPipe.init(Downloader.getInstance());
|
NewPipe.init(Downloader.getInstance());
|
||||||
|
|
Loading…
Reference in New Issue