Skip to content

Commit d76c8e1

Browse files
committed
Add check for subtitles in restricted videos
1 parent 239df49 commit d76c8e1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ public List<Subtitles> getSubtitlesDefault() throws IOException, ExtractionExcep
411411
@Override
412412
@Nullable
413413
public List<Subtitles> getSubtitles(SubtitlesFormat format) throws IOException, ExtractionException {
414+
if(isAgeRestricted) {
415+
// If the video is age restricted getPlayerConfig will fail
416+
return null;
417+
}
414418
JsonObject playerConfig = getPlayerConfig(getPageHtml());
415419
String playerResponse = playerConfig.getObject("args").getString("player_response");
416420

0 commit comments

Comments
 (0)