Package org.schabi.newpipe.extractor
Class StreamingService
java.lang.Object
org.schabi.newpipe.extractor.StreamingService
- Direct Known Subclasses:
BandcampService,MediaCCCService,PeertubeService,SoundcloudService,YoutubeService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumLinkType will be used to determine which type of URL you are handling, and therefore which part of NewPipe should handle a certain URL.static classThis class holds meta information about the service implementation. -
Constructor Summary
ConstructorsConstructorDescriptionStreamingService(int id, String name, Set<StreamingService.ServiceInfo.MediaCapability> capabilities) Creates a new Streaming service. -
Method Summary
Modifier and TypeMethodDescriptionabstract StringgetChannelExtractor(String id, List<String> contentFilter, String sortFilter) abstract ChannelExtractorgetChannelExtractor(ListLinkHandler linkHandler) Must create a new instance of a ChannelExtractor implementation.abstract ListLinkHandlerFactoryMust return a new instance of an implementation of ListLinkHandlerFactory for channels.abstract ChannelTabExtractorgetChannelTabExtractor(ListLinkHandler linkHandler) Must create a new instance of a ChannelTabExtractor implementation.getChannelTabExtractorFromId(String id, String tab) getChannelTabExtractorFromIdAndBaseUrl(String id, String tab, String baseUrl) abstract ListLinkHandlerFactoryMust return a new instance of an implementation of ListLinkHandlerFactory for channel tabs.abstract CommentsExtractorgetCommentsExtractor(ListLinkHandler linkHandler) abstract ListLinkHandlerFactoryReturns the country that should be used to fetch content in this service.getFeedExtractor(String url) This method decides which strategy will be chosen to fetch the feed.abstract KioskListMust create a new instance of a KioskList implementation.getLinkTypeByUrl(String url) Figures out where the link is pointing to (a channel, a video, a playlist, etc.)Returns the localization that should be used in this service.getPlaylistExtractor(String id, List<String> contentFilter, String sortFilter) abstract PlaylistExtractorgetPlaylistExtractor(ListLinkHandler linkHandler) Must crete a new instance of a PlaylistExtractor implementation.abstract ListLinkHandlerFactoryMust return a new instance of an implementation of ListLinkHandlerFactory for playlists.getSearchExtractor(String query) getSearchExtractor(String query, List<String> contentFilter, String sortFilter) abstract SearchExtractorgetSearchExtractor(SearchQueryHandler queryHandler) Must create a new instance of a SearchExtractor implementation.abstract SearchQueryHandlerFactoryMust return an instance of an implementation of SearchQueryHandlerFactory.final intgetStreamExtractor(String url) abstract StreamExtractorgetStreamExtractor(LinkHandler linkHandler) Must create a new instance of a StreamExtractor implementation.abstract LinkHandlerFactoryMust return a new instance of an implementation of LinkHandlerFactory for streams.abstract SubscriptionExtractorOutdated or obsolete.abstract SuggestionExtractorMust create a new instance of a SuggestionExtractor implementation.Returns a list of countries that this service supports.Returns a list of localizations that this service supports.getTimeAgoParser(Localization localization) Get an instance of the time ago parser using the patterns related to the passed localization.toString()
-
Constructor Details
-
StreamingService
public StreamingService(int id, String name, Set<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 intoServiceListAll other parameters can be set directly from the overriding constructor.- Parameters:
id- the number of the service to identify him within the NewPipe frontendname- the name of the servicecapabilities- the type of media this service can handle
-
-
Method Details
-
getServiceId
public final int getServiceId() -
getServiceInfo
-
toString
-
getBaseUrl
-
getStreamLHFactory
Must return a new instance of an implementation of LinkHandlerFactory for streams.- Returns:
- an instance of a LinkHandlerFactory for streams
-
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
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 channel tabs or null
-
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
Must return an instance of an implementation of SearchQueryHandlerFactory.- Returns:
- an instance of a SearchQueryHandlerFactory
-
getCommentsLHFactory
-
getSearchExtractor
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
Must create a new instance of a SuggestionExtractor implementation.- Returns:
- a new SuggestionExtractor instance
-
getSubscriptionExtractor
Outdated or obsolete. null can be returned.- Returns:
- just null
-
getFeedExtractor
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
FeedExtractorinstance or null. - Throws:
ExtractionException
-
getKioskList
Must create a new instance of a KioskList implementation.- Returns:
- a new KioskList instance
- 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
-
getCommentsExtractor
public abstract CommentsExtractor getCommentsExtractor(ListLinkHandler linkHandler) throws ExtractionException - Throws:
ExtractionException
-
getSearchExtractor
public SearchExtractor getSearchExtractor(String query, List<String> contentFilter, String sortFilter) throws ExtractionException - Throws:
ExtractionException
-
getChannelExtractor
public ChannelExtractor getChannelExtractor(String id, List<String> contentFilter, String sortFilter) throws ExtractionException - Throws:
ExtractionException
-
getPlaylistExtractor
public PlaylistExtractor getPlaylistExtractor(String id, List<String> contentFilter, String sortFilter) throws ExtractionException - Throws:
ExtractionException
-
getSearchExtractor
- Throws:
ExtractionException
-
getChannelExtractor
- Throws:
ExtractionException
-
getChannelTabExtractorFromId
public ChannelTabExtractor getChannelTabExtractorFromId(String id, String tab) throws ExtractionException - Throws:
ExtractionException
-
getChannelTabExtractorFromIdAndBaseUrl
public ChannelTabExtractor getChannelTabExtractorFromIdAndBaseUrl(String id, String tab, String baseUrl) throws ExtractionException - Throws:
ExtractionException
-
getPlaylistExtractor
- Throws:
ExtractionException
-
getStreamExtractor
- Throws:
ExtractionException
-
getCommentsExtractor
- Throws:
ExtractionException
-
getLinkTypeByUrl
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
Returns a list of localizations that this service supports. -
getSupportedCountries
Returns a list of countries that this service supports. -
getLocalization
Returns the localization that should be used in this service. It will get which localization the user prefers (usingNewPipe.getPreferredLocalization()), then it will:- Check if the exact localization is supported by this service.
- If not, check if a less specific localization is available, using only the language code.
- Fallback to the
defaultlocalization.
-
getContentCountry
Returns the country that should be used to fetch content in this service. It will get which country the user prefer (usingNewPipe.getPreferredContentCountry()), then it will:- Check if the country is supported by this service.
- If not, fallback to the
defaultcountry.
-
getTimeAgoParser
Get an instance of the time ago parser using the patterns related to the passed localization.
Just likegetLocalization(), it will also try to fallback to a less specific localization if the exact one is not available/supported.- Throws:
IllegalArgumentException- if the localization is not supported (parsing patterns are not present).
-