added isLiveDvrEnabled to YoutubeStreamExtractor

This commit is contained in:
sunipan 2023-12-11 14:26:34 -08:00
parent 2960adb97b
commit f117c1defc
3 changed files with 28 additions and 0 deletions

View File

@ -1579,6 +1579,11 @@ public class YoutubeStreamExtractor extends StreamExtractor {
.getArray("contents"));
}
@Override
public boolean isLiveDvrEnabled() throws ParsingException {
return playerResponse.getObject("videoDetails").getBoolean("isLiveDvrEnabled");
}
/**
* Enable or disable the fetch of the Android client for all stream types.
*

View File

@ -581,6 +581,15 @@ public abstract class StreamExtractor extends Extractor {
return false;
}
/**
* Whether the stream is scrubbable backwards.
*
* @return whether the stream is scrubbable backwards
*/
public boolean isLiveDvrEnabled() throws ParsingException {
return false;
}
public enum Privacy {
PUBLIC,
UNLISTED,

View File

@ -273,6 +273,11 @@ public class StreamInfo extends Info {
} catch (final Exception e) {
streamInfo.addError(e);
}
try {
streamInfo.setLiveDvrEnabled(extractor.isLiveDvrEnabled());
} catch (final Exception e) {
streamInfo.addError(e);
}
// Additional info
try {
@ -381,6 +386,7 @@ public class StreamInfo extends Info {
private List<StreamSegment> streamSegments = List.of();
private List<MetaInfo> metaInfo = List.of();
private boolean shortFormContent = false;
private boolean isLiveDvrEnabled = false;
/**
* Preview frames, e.g. for the storyboard / seekbar thumbnail preview
@ -727,4 +733,12 @@ public class StreamInfo extends Info {
public void setShortFormContent(final boolean isShortFormContent) {
this.shortFormContent = isShortFormContent;
}
public boolean isLiveDvrEnabled() {
return isLiveDvrEnabled;
}
public void setLiveDvrEnabled(final boolean isLiveDvrEnabled) {
this.isLiveDvrEnabled = isLiveDvrEnabled;
}
}