[YouTube] Do not catch every exception on getErrorMessage

@B0pol suggestion
This commit is contained in:
Stypox 2020-04-11 17:26:31 +02:00
parent 3191bd6c70
commit 68d23defba
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 5 additions and 4 deletions

View File

@ -612,10 +612,11 @@ public class YoutubeStreamExtractor extends StreamExtractor {
@Override
public String getErrorMessage() {
try {
return getTextFromObject(initialAjaxJson.getObject(2).getObject("playerResponse").getObject("playabilityStatus")
.getObject("errorScreen").getObject("playerErrorMessageRenderer").getObject("reason"));
} catch (Exception e) {
return null;
return getTextFromObject(initialAjaxJson.getObject(2).getObject("playerResponse")
.getObject("playabilityStatus").getObject("errorScreen")
.getObject("playerErrorMessageRenderer").getObject("reason"));
} catch (ParsingException | NullPointerException e) {
return null; // no error message
}
}