mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-15 06:40:33 +05:30
[YouTube] Fail-fast if status exist and is anything other than "OK"
This commit is contained in:
parent
65f0ec6057
commit
cfc278317d
@ -623,7 +623,8 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||||||
|
|
||||||
final JsonObject playabilityStatus = playerResponse.getObject("playabilityStatus", JsonUtils.DEFAULT_EMPTY);
|
final JsonObject playabilityStatus = playerResponse.getObject("playabilityStatus", JsonUtils.DEFAULT_EMPTY);
|
||||||
final String status = playabilityStatus.getString("status");
|
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");
|
final String reason = playabilityStatus.getString("reason");
|
||||||
throw new ContentNotAvailableException("Got error: \"" + reason + "\"");
|
throw new ContentNotAvailableException("Got error: \"" + reason + "\"");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user