Skip to content

Commit eed29ea

Browse files
wb9688TobiGr
authored andcommitted
Return null for related streams at age restricted videos
1 parent 9efcc61 commit eed29ea

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ public Description getDescription() throws ParsingException {
177177
@Override
178178
public int getAgeLimit() throws ParsingException {
179179
assertPageFetched();
180-
// TODO: Find new way to get age limit
181180
if (!isAgeRestricted) {
182181
return NO_AGE_LIMIT;
183182
}
@@ -497,6 +496,9 @@ public StreamType getStreamType() throws ParsingException {
497496
@Override
498497
public StreamInfoItem getNextStream() throws ExtractionException {
499498
assertPageFetched();
499+
if (isAgeRestricted) {
500+
return null;
501+
}
500502
try {
501503
final JsonObject videoInfo = initialData.getObject("contents").getObject("twoColumnWatchNextResults")
502504
.getObject("secondaryResults").getObject("secondaryResults").getArray("results")
@@ -515,6 +517,9 @@ public StreamInfoItem getNextStream() throws ExtractionException {
515517
@Override
516518
public StreamInfoItemsCollector getRelatedStreams() throws ExtractionException {
517519
assertPageFetched();
520+
if (isAgeRestricted) {
521+
return null;
522+
}
518523
try {
519524
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
520525
JsonArray results = initialData.getObject("contents").getObject("twoColumnWatchNextResults")

0 commit comments

Comments
 (0)