Add check for subtitles in restricted videos

This commit is contained in:
Coffeemakr 2017-11-25 03:45:03 +01:00
parent 239df49df3
commit d76c8e1773
No known key found for this signature in database
GPG Key ID: 3F35676D8FF6E743
1 changed files with 4 additions and 0 deletions

View File

@ -411,6 +411,10 @@ public class YoutubeStreamExtractor extends StreamExtractor {
@Override
@Nullable
public List<Subtitles> 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");