Add check for subtitles in restricted videos
This commit is contained in:
parent
239df49df3
commit
d76c8e1773
|
@ -411,6 +411,10 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public List<Subtitles> getSubtitles(SubtitlesFormat format) throws IOException, ExtractionException {
|
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());
|
JsonObject playerConfig = getPlayerConfig(getPageHtml());
|
||||||
String playerResponse = playerConfig.getObject("args").getString("player_response");
|
String playerResponse = playerConfig.getObject("args").getString("player_response");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue