mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2025-08-29 21:37:39 +00:00
Merge pull request #1352 from Stypox/yt-confirm-not-bot
[YouTube] Add custom error for "Sign in to confirm ..."
This commit is contained in:
commit
0023b22095
@ -0,0 +1,11 @@
|
||||
package org.schabi.newpipe.extractor.exceptions;
|
||||
|
||||
/**
|
||||
* Content can't be extracted because the service requires logging in to confirm the user is not a
|
||||
* bot. Can usually only be solvable by changing IP (e.g. in the case of YouTube).
|
||||
*/
|
||||
public class SignInConfirmNotBotException extends ParsingException {
|
||||
public SignInConfirmNotBotException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -53,6 +53,7 @@ import org.schabi.newpipe.extractor.exceptions.PaidContentException;
|
||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||
import org.schabi.newpipe.extractor.exceptions.PrivateContentException;
|
||||
import org.schabi.newpipe.extractor.exceptions.YoutubeMusicPremiumContentException;
|
||||
import org.schabi.newpipe.extractor.exceptions.SignInConfirmNotBotException;
|
||||
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
|
||||
import org.schabi.newpipe.extractor.localization.ContentCountry;
|
||||
import org.schabi.newpipe.extractor.localization.DateWrapper;
|
||||
@ -901,7 +902,14 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||
}
|
||||
}
|
||||
|
||||
throw new ContentNotAvailableException("Got error: \"" + reason + "\"");
|
||||
// "Sign in to confirm that you're not a bot"
|
||||
if (reason != null && reason.contains("a bot")) {
|
||||
throw new SignInConfirmNotBotException(
|
||||
"YouTube probably temporarily blocked this IP, got error "
|
||||
+ status + ": \"" + reason + "\"");
|
||||
}
|
||||
|
||||
throw new ContentNotAvailableException("Got error " + status + ": \"" + reason + "\"");
|
||||
}
|
||||
|
||||
private void fetchHtml5Client(@Nonnull final Localization localization,
|
||||
|
Loading…
x
Reference in New Issue
Block a user