[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
No known key found for this signature in database
GPG Key ID: F200BFD6F29DDD85
1 changed files with 2 additions and 1 deletions

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