Merge pull request #980 from TeamNewPipe/fix/yt/unavailable

[YouTube] Fix extracting the detailed error message for unavailable streams
This commit is contained in:
Tobi 2022-11-28 10:07:34 +01:00 committed by GitHub
commit 1da0190056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -943,7 +943,8 @@ public class YoutubeStreamExtractor extends StreamExtractor {
}
}
if (status.equalsIgnoreCase("unplayable") && reason != null) {
if ((status.equalsIgnoreCase("unplayable") || status.equalsIgnoreCase("error"))
&& reason != null) {
if (reason.contains("Music Premium")) {
throw new YoutubeMusicPremiumContentException();
}
@ -963,6 +964,10 @@ public class YoutubeStreamExtractor extends StreamExtractor {
if (detailedErrorMessage != null && detailedErrorMessage.contains("country")) {
throw new GeographicRestrictionException(
"This video is not available in client's country.");
} else if (detailedErrorMessage != null) {
throw new ContentNotAvailableException(detailedErrorMessage);
} else {
throw new ContentNotAvailableException(reason);
}
}
}