From d76c8e177383ca1635cdb58a7e78a2beaf7b59f8 Mon Sep 17 00:00:00 2001 From: Coffeemakr Date: Sat, 25 Nov 2017 03:45:03 +0100 Subject: [PATCH] Add check for subtitles in restricted videos --- .../extractor/services/youtube/YoutubeStreamExtractor.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index 0f93508e2..416881a62 100644 --- a/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -411,6 +411,10 @@ public class YoutubeStreamExtractor extends StreamExtractor { @Override @Nullable public List getSubtitles(SubtitlesFormat format) throws IOException, ExtractionException { + if(isAgeRestricted) { + // If the video is age restricted getPlayerConfig will fail + return null; + } JsonObject playerConfig = getPlayerConfig(getPageHtml()); String playerResponse = playerConfig.getObject("args").getString("player_response");