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

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");