File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
extractor/src/main/java/org/schabi/newpipe/extractor
services/youtube/extractors Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1+ package org .schabi .newpipe .extractor .exceptions ;
2+
3+ public class YoutubeSignInConfirmNotBotException extends ParsingException {
4+ public YoutubeSignInConfirmNotBotException (final String message ) {
5+ super (message );
6+ }
7+ }
Original file line number Diff line number Diff line change 5353import org .schabi .newpipe .extractor .exceptions .ParsingException ;
5454import org .schabi .newpipe .extractor .exceptions .PrivateContentException ;
5555import org .schabi .newpipe .extractor .exceptions .YoutubeMusicPremiumContentException ;
56+ import org .schabi .newpipe .extractor .exceptions .YoutubeSignInConfirmNotBotException ;
5657import org .schabi .newpipe .extractor .linkhandler .LinkHandler ;
5758import org .schabi .newpipe .extractor .localization .ContentCountry ;
5859import org .schabi .newpipe .extractor .localization .DateWrapper ;
@@ -901,7 +902,13 @@ private static void checkPlayabilityStatus(@Nonnull final JsonObject playability
901902 }
902903 }
903904
904- throw new ContentNotAvailableException ("Got error: \" " + reason + "\" " );
905+ // "Sign in to confirm that you're not a bot", "Watch on the latest version"
906+ if (reason != null && (reason .contains ("a bot" ) || reason .contains ("latest" ))) {
907+ throw new YoutubeSignInConfirmNotBotException (
908+ "YouTube probably temporarily blocked this IP, got error: " + reason );
909+ }
910+
911+ throw new ContentNotAvailableException ("Got error " + status + ": \" " + reason + "\" " );
905912 }
906913
907914 private void fetchHtml5Client (@ Nonnull final Localization localization ,
You can’t perform that action at this time.
0 commit comments