Class StreamingService

    • Constructor Detail

      • StreamingService

        public StreamingService​(int id,
                                java.lang.String name,
                                java.util.List<StreamingService.ServiceInfo.MediaCapability> capabilities)
        Creates a new Streaming service. If you Implement one do not set id within your implementation of this extractor, instead set the id when you put the extractor into ServiceList All other parameters can be set directly from the overriding constructor.
        Parameters:
        id - the number of the service to identify him within the NewPipe frontend
        name - the name of the service
        capabilities - the type of media this service can handle
    • Method Detail

      • getServiceId

        public final int getServiceId()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getBaseUrl

        public abstract java.lang.String getBaseUrl()
      • getStreamLHFactory

        public abstract LinkHandlerFactory getStreamLHFactory()
        Must return a new instance of an implementation of LinkHandlerFactory for streams.
        Returns:
        an instance of a LinkHandlerFactory for streams
      • getChannelLHFactory

        public abstract ListLinkHandlerFactory getChannelLHFactory()
        Must return a new instance of an implementation of ListLinkHandlerFactory for channels. If support for channels is not given null must be returned.
        Returns:
        an instance of a ListLinkHandlerFactory for channels or null
      • getChannelTabLHFactory

        public abstract ListLinkHandlerFactory getChannelTabLHFactory()
        Must return a new instance of an implementation of ListLinkHandlerFactory for channel tabs. If support for channel tabs is not given null must be returned.
        Returns:
        an instance of a ListLinkHandlerFactory for channels or null
      • getPlaylistLHFactory

        public abstract ListLinkHandlerFactory getPlaylistLHFactory()
        Must return a new instance of an implementation of ListLinkHandlerFactory for playlists. If support for playlists is not given null must be returned.
        Returns:
        an instance of a ListLinkHandlerFactory for playlists or null
      • getSearchQHFactory

        public abstract SearchQueryHandlerFactory getSearchQHFactory()
        Must return an instance of an implementation of SearchQueryHandlerFactory.
        Returns:
        an instance of a SearchQueryHandlerFactory
      • getSearchExtractor

        public abstract SearchExtractor getSearchExtractor​(SearchQueryHandler queryHandler)
        Must create a new instance of a SearchExtractor implementation.
        Parameters:
        queryHandler - specifies the keyword lock for, and the filters which should be applied.
        Returns:
        a new SearchExtractor instance
      • getSuggestionExtractor

        public abstract SuggestionExtractor getSuggestionExtractor()
        Must create a new instance of a SuggestionExtractor implementation.
        Returns:
        a new SuggestionExtractor instance
      • getSubscriptionExtractor

        public abstract SubscriptionExtractor getSubscriptionExtractor()
        Outdated or obsolete. null can be returned.
        Returns:
        just null
      • getFeedExtractor

        @Nullable
        public FeedExtractor getFeedExtractor​(java.lang.String url)
                                       throws ExtractionException
        This method decides which strategy will be chosen to fetch the feed. In YouTube, for example, a separate feed exists which is lightweight and made specifically to be used like this.

        In services which there's no other way to retrieve them, null should be returned.

        Returns:
        a FeedExtractor instance or null.
        Throws:
        ExtractionException
      • getChannelExtractor

        public abstract ChannelExtractor getChannelExtractor​(ListLinkHandler linkHandler)
                                                      throws ExtractionException
        Must create a new instance of a ChannelExtractor implementation.
        Parameters:
        linkHandler - is pointing to the channel which should be handled by this new instance.
        Returns:
        a new ChannelExtractor
        Throws:
        ExtractionException
      • getChannelTabExtractor

        public abstract ChannelTabExtractor getChannelTabExtractor​(ListLinkHandler linkHandler)
                                                            throws ExtractionException
        Must create a new instance of a ChannelTabExtractor implementation.
        Parameters:
        linkHandler - is pointing to the channel which should be handled by this new instance.
        Returns:
        a new ChannelTabExtractor
        Throws:
        ExtractionException
      • getPlaylistExtractor

        public abstract PlaylistExtractor getPlaylistExtractor​(ListLinkHandler linkHandler)
                                                        throws ExtractionException
        Must crete a new instance of a PlaylistExtractor implementation.
        Parameters:
        linkHandler - is pointing to the playlist which should be handled by this new instance.
        Returns:
        a new PlaylistExtractor
        Throws:
        ExtractionException
      • getStreamExtractor

        public abstract StreamExtractor getStreamExtractor​(LinkHandler linkHandler)
                                                    throws ExtractionException
        Must create a new instance of a StreamExtractor implementation.
        Parameters:
        linkHandler - is pointing to the stream which should be handled by this new instance.
        Returns:
        a new StreamExtractor
        Throws:
        ExtractionException
      • getLinkTypeByUrl

        public final StreamingService.LinkType getLinkTypeByUrl​(java.lang.String url)
                                                         throws ParsingException
        Figures out where the link is pointing to (a channel, a video, a playlist, etc.)
        Parameters:
        url - the url on which it should be decided of which link type it is
        Returns:
        the link type of url
        Throws:
        ParsingException
      • getSupportedLocalizations

        public java.util.List<Localization> getSupportedLocalizations()
        Returns a list of localizations that this service supports.
      • getSupportedCountries

        public java.util.List<ContentCountry> getSupportedCountries()
        Returns a list of countries that this service supports.
      • getLocalization

        public Localization getLocalization()
        Returns the localization that should be used in this service. It will get which localization the user prefer (using NewPipe.getPreferredLocalization()), then it will:
        • Check if the exactly localization is supported by this service.
        • If not, check if a less specific localization is available, using only the language code.
        • Fallback to the default localization.
      • getContentCountry

        public ContentCountry getContentCountry()
        Returns the country that should be used to fetch content in this service. It will get which country the user prefer (using NewPipe.getPreferredContentCountry()), then it will:
        • Check if the country is supported by this service.
        • If not, fallback to the default country.
      • getTimeAgoParser

        public TimeAgoParser getTimeAgoParser​(Localization localization)
        Get an instance of the time ago parser using the patterns related to the passed localization.

        Just like getLocalization(), it will also try to fallback to a less specific localization if the exact one is not available/supported.
        Throws:
        java.lang.IllegalArgumentException - if the localization is not supported (parsing patterns are not present).