[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;
|
if (getAgeLimit() != NO_AGE_LIMIT) return null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final JsonObject videoInfo = initialData.getObject("contents").getObject("twoColumnWatchNextResults")
|
final JsonObject firstWatchNextItem = initialData.getObject("contents")
|
||||||
.getObject("secondaryResults").getObject("secondaryResults").getArray("results")
|
.getObject("twoColumnWatchNextResults").getObject("secondaryResults")
|
||||||
.getObject(0).getObject("compactAutoplayRenderer").getArray("contents")
|
.getObject("secondaryResults").getArray("results").getObject(0);
|
||||||
.getObject(0).getObject("compactVideoRenderer");
|
|
||||||
|
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();
|
final TimeAgoParser timeAgoParser = getTimeAgoParser();
|
||||||
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
|
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue