Class Stream
- java.lang.Object
-
- org.schabi.newpipe.extractor.stream.Stream
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
AudioStream,SubtitlesStream,VideoStream
public abstract class Stream extends java.lang.Object implements java.io.SerializableAbstract class which represents streams in the extractor.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intFORMAT_ID_UNKNOWNstatic java.lang.StringID_UNKNOWNstatic intITAG_NOT_AVAILABLE_OR_NOT_APPLICABLEAn integer to represent that the itag ID returned is not available (only for YouTube; this should never happen) or not applicable (for other services than YouTube).
-
Constructor Summary
Constructors Constructor Description Stream(java.lang.String id, java.lang.String content, boolean isUrl, MediaFormat format, DeliveryMethod deliveryMethod, java.lang.String manifestUrl)Instantiates a newStreamobject.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleancontainSimilarStream(Stream stream, java.util.List<? extends Stream> streamList)Checks if the list already contains a stream with the same statistics.booleanequalStats(Stream other)Reveals whether two streams have the same statistics (media formatanddelivery method).java.lang.StringgetContent()Gets the content or URL.DeliveryMethodgetDeliveryMethod()Gets theDeliveryMethod.MediaFormatgetFormat()Gets theMediaFormat, which can be null.intgetFormatId()Gets the format ID, which can be unknown.java.lang.StringgetId()Gets the identifier of this stream, e.g.abstract ItagItemgetItagItem()Gets theItagItemof a stream.java.lang.StringgetManifestUrl()Gets the URL of the manifest this stream comes from (if applicable, otherwise null).java.lang.StringgetUrl()Deprecated.UsegetContent()instead.booleanisUrl()Returns whether the content is a URL or not.
-
-
-
Field Detail
-
FORMAT_ID_UNKNOWN
public static final int FORMAT_ID_UNKNOWN
- See Also:
- Constant Field Values
-
ID_UNKNOWN
public static final java.lang.String ID_UNKNOWN
- See Also:
- Constant Field Values
-
ITAG_NOT_AVAILABLE_OR_NOT_APPLICABLE
public static final int ITAG_NOT_AVAILABLE_OR_NOT_APPLICABLE
An integer to represent that the itag ID returned is not available (only for YouTube; this should never happen) or not applicable (for other services than YouTube).An itag should not have a negative value, so
-1is used for this constant.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Stream
public Stream(java.lang.String id, java.lang.String content, boolean isUrl, @Nullable MediaFormat format, DeliveryMethod deliveryMethod, @Nullable java.lang.String manifestUrl)Instantiates a newStreamobject.- Parameters:
id- the identifier which uniquely identifies the file, e.g. for YouTube this would be the itagcontent- the content or URL, depending on whether isUrl is trueisUrl- whether content is the URL or the actual content of e.g. a DASH manifestformat- theMediaFormat, which can be nulldeliveryMethod- the delivery method of the streammanifestUrl- the URL of the manifest this stream comes from (if applicable, otherwise null)
-
-
Method Detail
-
containSimilarStream
public static boolean containSimilarStream(Stream stream, java.util.List<? extends Stream> streamList)
Checks if the list already contains a stream with the same statistics.- Parameters:
stream- the stream to be compared against the streams in the stream liststreamList- the list ofStreams which will be compared- Returns:
- whether the list already contains one stream with equals stats
-
equalStats
public boolean equalStats(@Nullable Stream other)Reveals whether two streams have the same statistics (media formatanddelivery method).If the
media formatof the stream is unknown, the streams are compared by using only thedelivery methodand their ID.Note: This method always returns false if the stream passed is null.
- Parameters:
other- the stream object to be compared to this stream object- Returns:
- whether the stream have the same stats or not, based on the criteria above
-
getId
public java.lang.String getId()
Gets the identifier of this stream, e.g. the itag for YouTube.It should normally be unique, but
ID_UNKNOWNmay be returned as the identifier if the one used by the stream extractor cannot be extracted, which could happen if the extractor uses a value from a streaming service.- Returns:
- the identifier (which may be
ID_UNKNOWN)
-
getUrl
@Deprecated @Nullable public java.lang.String getUrl()
Deprecated.UsegetContent()instead.Gets the URL of this stream if the content is a URL, ornullotherwise.- Returns:
- the URL if the content is a URL,
nullotherwise
-
getContent
public java.lang.String getContent()
Gets the content or URL.- Returns:
- the content or URL
-
isUrl
public boolean isUrl()
Returns whether the content is a URL or not.- Returns:
trueif the content of this stream is a URL,falseif it's the actual content
-
getFormat
@Nullable public MediaFormat getFormat()
Gets theMediaFormat, which can be null.- Returns:
- the format
-
getFormatId
public int getFormatId()
Gets the format ID, which can be unknown.- Returns:
- the format ID or
FORMAT_ID_UNKNOWN
-
getDeliveryMethod
@Nonnull public DeliveryMethod getDeliveryMethod()
Gets theDeliveryMethod.- Returns:
- the delivery method
-
getManifestUrl
@Nullable public java.lang.String getManifestUrl()
Gets the URL of the manifest this stream comes from (if applicable, otherwise null).- Returns:
- the URL of the manifest this stream comes from or
null
-
-