public abstract class SubscriptionExtractor extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SubscriptionExtractor.ContentSource |
static class |
SubscriptionExtractor.InvalidSourceException
Exception that should be thrown when the input do not contain valid content that the
extractor can parse (e.g.
|
Modifier and Type | Field and Description |
---|---|
protected StreamingService |
service |
Constructor and Description |
---|
SubscriptionExtractor(StreamingService service,
List<SubscriptionExtractor.ContentSource> supportedSources) |
Modifier and Type | Method and Description |
---|---|
List<SubscriptionItem> |
fromChannelUrl(String channelUrl)
Reads and parse a list of
SubscriptionItem from the given channel url. |
List<SubscriptionItem> |
fromInputStream(InputStream contentInputStream)
Reads and parse a list of
SubscriptionItem from the given InputStream. |
List<SubscriptionItem> |
fromInputStream(InputStream contentInputStream,
String contentType)
Reads and parse a list of
SubscriptionItem from the given InputStream. |
abstract String |
getRelatedUrl()
Returns an url that can help/guide the user to the file (or channel url) to extract the
subscriptions.
|
List<SubscriptionExtractor.ContentSource> |
getSupportedSources() |
protected final StreamingService service
public SubscriptionExtractor(StreamingService service, List<SubscriptionExtractor.ContentSource> supportedSources)
public List<SubscriptionExtractor.ContentSource> getSupportedSources()
@Nullable public abstract String getRelatedUrl()
For example, in YouTube, the export subscriptions url is a good choice to return here.
public List<SubscriptionItem> fromChannelUrl(String channelUrl) throws IOException, ExtractionException
SubscriptionItem
from the given channel url.SubscriptionExtractor.InvalidSourceException
- when the channelUrl doesn't exist or is invalidIOException
ExtractionException
public List<SubscriptionItem> fromInputStream(@Nonnull InputStream contentInputStream) throws ExtractionException
SubscriptionItem
from the given InputStream.SubscriptionExtractor.InvalidSourceException
- when the content read from the InputStream is invalid and can
not be parsedExtractionException
public List<SubscriptionItem> fromInputStream(@Nonnull InputStream contentInputStream, @Nonnull String contentType) throws ExtractionException
SubscriptionItem
from the given InputStream.SubscriptionExtractor.InvalidSourceException
- when the content read from the InputStream is invalid and can
not be parsedExtractionException