fix rising exception for empty related videos
This commit is contained in:
parent
a63128bd45
commit
bd7077c1cf
|
@ -668,10 +668,13 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
public StreamPreviewInfoCollector getRelatedVideos() throws ParsingException {
|
public StreamPreviewInfoCollector getRelatedVideos() throws ParsingException {
|
||||||
try {
|
try {
|
||||||
StreamPreviewInfoCollector collector = getStreamPreviewInfoCollector();
|
StreamPreviewInfoCollector collector = getStreamPreviewInfoCollector();
|
||||||
for (Element li : doc.select("ul[id=\"watch-related\"]").first().children()) {
|
Element ul = doc.select("ul[id=\"watch-related\"]").first();
|
||||||
// first check if we have a playlist. If so leave them out
|
if(ul != null) {
|
||||||
if (li.select("a[class*=\"content-link\"]").first() != null) {
|
for (Element li : ul.children()) {
|
||||||
collector.commit(extractVideoPreviewInfo(li));
|
// first check if we have a playlist. If so leave them out
|
||||||
|
if (li.select("a[class*=\"content-link\"]").first() != null) {
|
||||||
|
collector.commit(extractVideoPreviewInfo(li));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return collector;
|
return collector;
|
||||||
|
|
Loading…
Reference in New Issue