From cfc278317ddf529b572632bd1f8d3214c5eeab98 Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Sun, 1 Mar 2020 10:13:00 -0300 Subject: [PATCH] [YouTube] Fail-fast if status exist and is anything other than "OK" --- .../services/youtube/extractors/YoutubeStreamExtractor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java index 13f881101..8ee502013 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java @@ -623,7 +623,8 @@ public class YoutubeStreamExtractor extends StreamExtractor { final JsonObject playabilityStatus = playerResponse.getObject("playabilityStatus", JsonUtils.DEFAULT_EMPTY); final String status = playabilityStatus.getString("status"); - if (status != null && status.toLowerCase().equals("error")) { + // If status exist, and is not "OK", throw a ContentNotAvailableException with the reason. + if (status != null && !status.toLowerCase().equals("ok")) { final String reason = playabilityStatus.getString("reason"); throw new ContentNotAvailableException("Got error: \"" + reason + "\""); }