2
0
mirror of https://github.com/TeamNewPipe/NewPipeExtractor synced 2025-08-30 22:05:18 +00:00

[YouTube] Fail-fast if status exist and is anything other than "OK"

This commit is contained in:
Mauricio Colli
2020-03-01 10:13:00 -03:00
parent 65f0ec6057
commit cfc278317d

View File

@@ -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 + "\"");
}