Overview
The PlaylistExtractor class extracts information about playlists and video collections from streaming services. It extends ListExtractor<StreamInfoItem> and provides methods to retrieve playlist metadata, uploader information, and paginated stream items.
Package: org.schabi.newpipe.extractor.playlist
Extends: ListExtractor<StreamInfoItem>
Constructor
The streaming service this extractor belongs to
The list link handler containing URL information for this playlist
getId()
public String getId() throws ParsingException
Returns the unique identifier for this playlist.
getName()
public abstract String getName() throws ParsingException
Returns the name/title of the playlist.
getUrl()
public String getUrl() throws ParsingException
Returns the cleaned URL for this playlist.
getOriginalUrl()
public String getOriginalUrl() throws ParsingException
Returns the original URL as provided by the user.
getBaseUrl()
public String getBaseUrl() throws ParsingException
Returns the base URL of the service.
fetchPage()
public void fetchPage() throws IOException, ExtractionException
Fetches the playlist page content. Must be called before accessing other data methods.
getService()
public StreamingService getService()
Returns the streaming service this extractor belongs to.
The associated streaming service
getServiceId()
public int getServiceId()
Returns the numeric ID of the streaming service.
getInitialPage()
public abstract InfoItemsPage<StreamInfoItem> getInitialPage() throws IOException, ExtractionException
Returns the first page of playlist items.
return
InfoItemsPage<StreamInfoItem>
Page object containing initial stream items and next page reference
getPage()
public abstract InfoItemsPage<StreamInfoItem> getPage(Page page) throws IOException, ExtractionException
Returns a specific page of playlist items.
The page reference obtained from a previous page’s getNextPage() method
return
InfoItemsPage<StreamInfoItem>
Page object containing stream items and next page reference
getDescription()
public abstract Description getDescription() throws ParsingException
Returns the playlist description.
The playlist description object
getThumbnails()
public List<Image> getThumbnails() throws ParsingException
Returns the playlist’s thumbnail images.
List of thumbnail images, or empty list if unavailable
getBanners()
public List<Image> getBanners() throws ParsingException
Returns the playlist’s banner images.
List of banner images, or empty list if unavailable
getStreamCount()
public abstract long getStreamCount() throws ParsingException
Returns the total number of streams in the playlist.
Total stream count, or -1 if unavailable
getPlaylistType()
public PlaylistInfo.PlaylistType getPlaylistType() throws ParsingException
Returns the type of playlist.
return
PlaylistInfo.PlaylistType
The playlist type enum value (defaults to NORMAL)
getUploaderName()
public abstract String getUploaderName() throws ParsingException
Returns the name of the playlist creator.
getUploaderUrl()
public abstract String getUploaderUrl() throws ParsingException
Returns the URL to the creator’s channel.
getUploaderAvatars()
public abstract List<Image> getUploaderAvatars() throws ParsingException
Returns the creator’s avatar images.
List of uploader avatar images
isUploaderVerified()
public abstract boolean isUploaderVerified() throws ParsingException
Returns whether the playlist creator is verified.
true if verified, false otherwise
Sub-Channel Methods
getSubChannelName()
public String getSubChannelName() throws ParsingException
Returns the name of the sub-channel (if applicable).
Sub-channel name, or empty string if not applicable
getSubChannelUrl()
public String getSubChannelUrl() throws ParsingException
Returns the URL to the sub-channel.
Sub-channel URL, or empty string if not applicable
getSubChannelAvatars()
public List<Image> getSubChannelAvatars() throws ParsingException
Returns the sub-channel’s avatar images.
List of sub-channel avatars, or empty list if not applicable
Localization Methods
forceLocalization()
public void forceLocalization(Localization localization)
Forces a specific localization for this extractor.
forceContentCountry()
public void forceContentCountry(ContentCountry contentCountry)
Forces a specific content country for this extractor.
The content country to use
Usage Example
StreamingService service = NewPipe.getService("YouTube");
PlaylistExtractor extractor = service.getPlaylistExtractor("https://youtube.com/playlist?list=PLxxxxxx");
// Fetch the page first
extractor.fetchPage();
// Get playlist information
String name = extractor.getName();
Description description = extractor.getDescription();
long streamCount = extractor.getStreamCount();
// Get uploader info
String uploaderName = extractor.getUploaderName();
boolean verified = extractor.isUploaderVerified();
// Get first page of items
InfoItemsPage<StreamInfoItem> initialPage = extractor.getInitialPage();
List<StreamInfoItem> items = initialPage.getItems();
// Paginate through all items
Page nextPage = initialPage.getNextPage();
while (nextPage != null) {
InfoItemsPage<StreamInfoItem> page = extractor.getPage(nextPage);
items.addAll(page.getItems());
nextPage = page.getNextPage();
}
InfoItemsPage Object
The InfoItemsPage returned by getInitialPage() and getPage() contains:
The list of stream items on this page
Reference to the next page, or null if this is the last page
Any errors that occurred during extraction of this page
Notes
- Always call
fetchPage() before accessing any playlist data
- Use pagination methods to retrieve all playlist items efficiently
- The
getStreamCount() method may return -1 if the service doesn’t provide the total count
- Some services may not support all features (e.g., sub-channels, banners)