Skip to content

Commit cfc2783

Browse files
committed
[YouTube] Fail-fast if status exist and is anything other than "OK"
1 parent 65f0ec6 commit cfc2783

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeStreamExtractor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,8 @@ public void onFetchPage(@Nonnull Downloader downloader) throws IOException, Extr
623623

624624
final JsonObject playabilityStatus = playerResponse.getObject("playabilityStatus", JsonUtils.DEFAULT_EMPTY);
625625
final String status = playabilityStatus.getString("status");
626-
if (status != null && status.toLowerCase().equals("error")) {
626+
// If status exist, and is not "OK", throw a ContentNotAvailableException with the reason.
627+
if (status != null && !status.toLowerCase().equals("ok")) {
627628
final String reason = playabilityStatus.getString("reason");
628629
throw new ContentNotAvailableException("Got error: \"" + reason + "\"");
629630
}

0 commit comments

Comments
 (0)