This commit is contained in:
TobiGr 2019-09-23 10:44:17 +02:00 committed by Tobias Groza
parent d1cd341592
commit 0710f31a39
1 changed files with 16 additions and 11 deletions

View File

@ -575,9 +575,13 @@ public class YoutubeStreamExtractor extends StreamExtractor {
*/
@Override
public String getErrorMessage() {
String errorMessage = doc.select("h1[id=\"unavailable-message\"]").first().text();
StringBuilder errorReason;
Element errorElement = doc.select("h1[id=\"unavailable-message\"]").first();
if (errorElement == null) {
errorReason = null;
} else {
String errorMessage = errorElement.text();
if (errorMessage == null || errorMessage.isEmpty()) {
errorReason = null;
} else if (errorMessage.contains("GEMA")) {
@ -591,6 +595,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
errorReason.append(" ");
errorReason.append(doc.select("[id=\"unavailable-submessage\"]").first().text());
}
}
return errorReason != null ? errorReason.toString() : null;
}