[YouTube] Do not crash if there is no next stream, but return null
Like every other extractor does if there is no next stream
This commit is contained in:
parent
6446abc6d1
commit
325a51f73a
|
@ -523,10 +523,18 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
if (getAgeLimit() != NO_AGE_LIMIT) return null;
|
||||
|
||||
try {
|
||||
final JsonObject videoInfo = initialData.getObject("contents").getObject("twoColumnWatchNextResults")
|
||||
.getObject("secondaryResults").getObject("secondaryResults").getArray("results")
|
||||
.getObject(0).getObject("compactAutoplayRenderer").getArray("contents")
|
||||
.getObject(0).getObject("compactVideoRenderer");
|
||||
final JsonObject firstWatchNextItem = initialData.getObject("contents")
|
||||
.getObject("twoColumnWatchNextResults").getObject("secondaryResults")
|
||||
.getObject("secondaryResults").getArray("results").getObject(0);
|
||||
|
||||
if (!firstWatchNextItem.has("compactAutoplayRenderer")) {
|
||||
// there is no "next" stream
|
||||
return null;
|
||||
}
|
||||
|
||||
final JsonObject videoInfo = firstWatchNextItem.getObject("compactAutoplayRenderer")
|
||||
.getArray("contents").getObject(0).getObject("compactVideoRenderer");
|
||||
|
||||
final TimeAgoParser timeAgoParser = getTimeAgoParser();
|
||||
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
|
||||
|
||||
|
|
Loading…
Reference in New Issue