Skip to content

Commit 4cccd33

Browse files
committed
Implement isShortFormContent for StreamExtractor and StreamInfo
1 parent 09544ce commit 4cccd33

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,16 @@ public List<MetaInfo> getMetaInfo() throws ParsingException {
554554
return Collections.emptyList();
555555
}
556556

557+
/**
558+
* Whether the stream is a short-form content. These are content in the style of TikTok,
559+
* YouTube Shorts, or Instagram Reels videos.
560+
*
561+
* @return whether the stream is a short-form content
562+
*/
563+
public boolean isShortFormContent() throws ParsingException {
564+
return false;
565+
}
566+
557567
public enum Privacy {
558568
PUBLIC,
559569
UNLISTED,

extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamInfo.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ private static void extractOptionalData(final StreamInfo streamInfo,
342342
} catch (final Exception e) {
343343
streamInfo.addError(e);
344344
}
345+
try {
346+
streamInfo.setShortFormContent(extractor.isShortFormContent());
347+
} catch (final Exception e) {
348+
streamInfo.addError(e);
349+
}
345350

346351
streamInfo.setRelatedItems(ExtractorHelper.getRelatedItemsOrLogError(streamInfo,
347352
extractor));
@@ -389,6 +394,7 @@ private static void extractOptionalData(final StreamInfo streamInfo,
389394
private List<String> tags = new ArrayList<>();
390395
private List<StreamSegment> streamSegments = new ArrayList<>();
391396
private List<MetaInfo> metaInfo = new ArrayList<>();
397+
private boolean shortFormContent = false;
392398

393399
/**
394400
* Preview frames, e.g. for the storyboard / seekbar thumbnail preview
@@ -724,4 +730,12 @@ public void setPreviewFrames(final List<Frameset> previewFrames) {
724730
public List<MetaInfo> getMetaInfo() {
725731
return this.metaInfo;
726732
}
733+
734+
public boolean isShortFormContent() {
735+
return shortFormContent;
736+
}
737+
738+
public void setShortFormContent(final boolean isShortFormContent) {
739+
this.shortFormContent = isShortFormContent;
740+
}
727741
}

0 commit comments

Comments
 (0)