Class YoutubeStreamExtractor

    • Method Detail

      • getViewCount

        public long getViewCount()
                          throws ParsingException
        Description copied from class: StreamExtractor
        The count of how many people have watched the video/listened to the audio stream. If the current stream has no view count or its not available simply return -1
        Overrides:
        getViewCount in class StreamExtractor
        Returns:
        amount of views or -1 if not available.
        Throws:
        ParsingException
      • getLikeCount

        public long getLikeCount()
                          throws ParsingException
        Description copied from class: StreamExtractor
        The amount of likes a video/audio stream got. If the current stream has no likes or its not available simply return -1
        Overrides:
        getLikeCount in class StreamExtractor
        Returns:
        the amount of likes the stream got or -1 if not available.
        Throws:
        ParsingException
      • getUploaderUrl

        @Nonnull
        public java.lang.String getUploaderUrl()
                                        throws ParsingException
        Description copied from class: StreamExtractor
        The Url to the page of the creator/uploader of the stream. This must not be a homepage, but the page offered by the service the extractor handles. This url will be handled by the ChannelExtractor, so be sure to implement that one before you return a value here, otherwise NewPipe will crash if one selects this url.
        Specified by:
        getUploaderUrl in class StreamExtractor
        Returns:
        the url to the page of the creator/uploader of the stream or an empty string
        Throws:
        ParsingException
      • getUploaderName

        @Nonnull
        public java.lang.String getUploaderName()
                                         throws ParsingException
        Description copied from class: StreamExtractor
        The name of the creator/uploader of the stream. If the name is not available you can simply return an empty string.
        Specified by:
        getUploaderName in class StreamExtractor
        Returns:
        the name of the creator/uploader of the stream or an empty tring
        Throws:
        ParsingException
      • isUploaderVerified

        public boolean isUploaderVerified()
                                   throws ParsingException
        Description copied from class: StreamExtractor
        Whether the uploader has been verified by the service's provider. If there is no verification implemented, return false.
        Overrides:
        isUploaderVerified in class StreamExtractor
        Returns:
        whether the uploader has been verified by the service's provider
        Throws:
        ParsingException
      • getUploaderAvatars

        @Nonnull
        public java.util.List<Image> getUploaderAvatars()
                                                 throws ParsingException
        Description copied from class: StreamExtractor
        The image files/profile pictures/avatars of the creator/uploader of the stream.

        If they are not available in the stream on specific cases, you must return an empty list for these ones, like it is made by default.

        Overrides:
        getUploaderAvatars in class StreamExtractor
        Returns:
        the avatars of the sub-channel of the stream or an empty list (default)
        Throws:
        ParsingException
      • getDashMpdUrl

        @Nonnull
        public java.lang.String getDashMpdUrl()
                                       throws ParsingException
        Description copied from class: StreamExtractor
        Get the dash mpd url. If you don't know what a dash MPD is you can read about it here.
        Overrides:
        getDashMpdUrl in class StreamExtractor
        Returns:
        the url as a string or an empty string or an empty string if not available
        Throws:
        ParsingException - if an error occurs while reading
      • getHlsUrl

        @Nonnull
        public java.lang.String getHlsUrl()
                                   throws ParsingException
        Description copied from class: StreamExtractor
        I am not sure if this is in use, and how this is used. However the frontend is missing support for HLS streams. Prove me if I am wrong. Please open an issue, or fix this description if you know whats up with this.
        Overrides:
        getHlsUrl in class StreamExtractor
        Returns:
        The Url to the hls stream or an empty string if not available.
        Throws:
        ParsingException
      • getAudioStreams

        public java.util.List<AudioStream> getAudioStreams()
                                                    throws ExtractionException
        Description copied from class: StreamExtractor
        This should return a list of available AudioStreams. You can also return null or an empty list, however be aware that if you don't return anything in getVideoStreams(), getVideoOnlyStreams() and getDashMpdUrl() either the Collector will handle this as a failed extraction procedure.
        Specified by:
        getAudioStreams in class StreamExtractor
        Returns:
        a list of audio only streams in the format of AudioStream
        Throws:
        ExtractionException
      • getVideoStreams

        public java.util.List<VideoStream> getVideoStreams()
                                                    throws ExtractionException
        Description copied from class: StreamExtractor
        This should return a list of available VideoStreams. Be aware this is the list of video streams which do contain an audio stream. You can also return null or an empty list, however be aware that if you don't return anything in getAudioStreams(), getVideoOnlyStreams() and getDashMpdUrl() either the Collector will handle this as a failed extraction procedure.
        Specified by:
        getVideoStreams in class StreamExtractor
        Returns:
        a list of combined video and streams in the format of AudioStream
        Throws:
        ExtractionException
      • getVideoOnlyStreams

        public java.util.List<VideoStream> getVideoOnlyStreams()
                                                        throws ExtractionException
        Description copied from class: StreamExtractor
        This should return a list of available VideoStreams. Be aware this is the list of video streams which do NOT contain an audio stream. You can also return null or an empty list, however be aware that if you don't return anything in getAudioStreams(), getVideoStreams() and getDashMpdUrl() either the Collector will handle this as a failed extraction procedure.
        Specified by:
        getVideoOnlyStreams in class StreamExtractor
        Returns:
        a list of video and streams in the format of AudioStream
        Throws:
        ExtractionException
      • getRelatedItems

        @Nullable
        public MultiInfoItemsCollector getRelatedItems()
                                                throws ExtractionException
        Description copied from class: StreamExtractor
        Should return a list of streams related to the current handled. Many services show suggested streams. If you don't like suggested streams you should implement them anyway since they can be disabled by the user later in the frontend. The first related stream might be what was previously known as a next stream. If related streams aren't available simply return null.
        Overrides:
        getRelatedItems in class StreamExtractor
        Returns:
        a list of InfoItems showing the related videos/streams
        Throws:
        ExtractionException
      • getErrorMessage

        public java.lang.String getErrorMessage()
        Should analyse the webpage's document and extracts any error message there might be.
        Overrides:
        getErrorMessage in class StreamExtractor
        Returns:
        Error message; null if there is no error message.
      • onFetchPage

        public void onFetchPage​(@Nonnull
                                Downloader downloader)
                         throws java.io.IOException,
                                ExtractionException
        Description copied from class: Extractor
        Fetch the current page.
        Specified by:
        onFetchPage in class Extractor
        Parameters:
        downloader - the downloader to use
        Throws:
        java.io.IOException - if the page can not be loaded
        ExtractionException - if the pages content is not understood
      • getFrames

        @Nonnull
        public java.util.List<Frameset> getFrames()
                                           throws ExtractionException
        Should return a list of Frameset object that contains preview of stream frames Should return a list of Frameset object that contains preview of stream frames

        Warning: When using this method be aware that the YouTube API very rarely returns framesets, that are slightly too small e.g. framesPerPageX = 5, frameWidth = 160, but the url contains a storyboard that is only 795 pixels wide (5*160 > 795). You will need to handle this "manually" to avoid errors.

        Overrides:
        getFrames in class StreamExtractor
        Returns:
        list of preview frames or empty list if frames preview is not supported or not found for specified stream
        Throws:
        ExtractionException
        See Also:
        TeamNewPipe/NewPipe#11596
      • getCategory

        @Nonnull
        public java.lang.String getCategory()
        Description copied from class: StreamExtractor
        The name of the category of the stream. If the category is not available you can simply return an empty string.
        Overrides:
        getCategory in class StreamExtractor
        Returns:
        the category of the stream or an empty string.
      • getLicence

        @Nonnull
        public java.lang.String getLicence()
                                    throws ParsingException
        Description copied from class: StreamExtractor
        The name of the licence of the stream. If the licence is not available you can simply return an empty string.
        Overrides:
        getLicence in class StreamExtractor
        Returns:
        the licence of the stream or an empty String.
        Throws:
        ParsingException
      • getLanguageInfo

        public java.util.Locale getLanguageInfo()
        Description copied from class: StreamExtractor
        The locale language of the stream. If the language is not available you can simply return null. If the language is provided by a language code, you can return new Locale(language_code);
        Overrides:
        getLanguageInfo in class StreamExtractor
        Returns:
        the locale language of the stream or null.
      • getTags

        @Nonnull
        public java.util.List<java.lang.String> getTags()
        Description copied from class: StreamExtractor
        The list of tags of the stream. If the tag list is not available you can simply return an empty list.
        Overrides:
        getTags in class StreamExtractor
        Returns:
        the list of tags of the stream or Collections.emptyList().
      • getMetaInfo

        @Nonnull
        public java.util.List<MetaInfo> getMetaInfo()
                                             throws ParsingException
        Description copied from class: StreamExtractor
        Meta information about the stream.

        This can be information about the stream creator (e.g. if the creator is a public broadcaster) or further information on the topic (e.g. hints that the video might contain conspiracy theories or contains information about a current health situation like the Covid-19 pandemic).

        The meta information often contains links to external sources like Wikipedia or the WHO.
        Overrides:
        getMetaInfo in class StreamExtractor
        Returns:
        The meta info of the stream or an empty list if not provided.
        Throws:
        ParsingException
      • setPoTokenProvider

        public static void setPoTokenProvider​(@Nullable
                                              PoTokenProvider poTokenProvider)
        Set the PoTokenProvider instance to be used for fetching poTokens.

        This method allows setting an implementation of PoTokenProvider which will be used to obtain poTokens required for YouTube player requests and streaming URLs. These tokens are used by YouTube to verify the integrity of the user's device or browser and are required for playback with several clients.

        Without a PoTokenProvider, the extractor makes its best effort to fetch as many streams as possible, but without poTokens, some formats may be not available or fetching may be slower due to additional requests done to get streams.

        Note that any provider change will be only applied on the next Extractor.fetchPage() request.

        Parameters:
        poTokenProvider - the PoTokenProvider instance to set, which can be null to remove a provider already passed
        See Also:
        PoTokenProvider
      • setFetchIosClient

        public static void setFetchIosClient​(boolean fetchIosClient)
        Set whether to fetch the iOS player responses.

        This method allows fetching the iOS player response, which can be useful in scenarios where streams from the iOS player response are needed, especially HLS manifests.

        Note that at the time of writing, YouTube is rolling out a poToken requirement on this client, formats from HLS manifests do not seem to be affected.

        Parameters:
        fetchIosClient - whether to fetch the iOS client