Skip to main content

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

service
StreamingService
required
The streaming service this extractor belongs to
The list link handler containing URL information for this playlist

Base Methods (Inherited from Extractor)

getId()

public String getId() throws ParsingException
Returns the unique identifier for this playlist.
return
String
The playlist’s unique ID

getName()

public abstract String getName() throws ParsingException
Returns the name/title of the playlist.
return
String
The playlist’s title

getUrl()

public String getUrl() throws ParsingException
Returns the cleaned URL for this playlist.
return
String
The playlist’s URL

getOriginalUrl()

public String getOriginalUrl() throws ParsingException
Returns the original URL as provided by the user.
return
String
The original URL

getBaseUrl()

public String getBaseUrl() throws ParsingException
Returns the base URL of the service.
return
String
The base URL

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.
return
StreamingService
The associated streaming service

getServiceId()

public int getServiceId()
Returns the numeric ID of the streaming service.
return
int
The service ID

List Extraction Methods (Inherited from ListExtractor)

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.
page
Page
required
The page reference obtained from a previous page’s getNextPage() method
return
InfoItemsPage<StreamInfoItem>
Page object containing stream items and next page reference

Playlist Information Methods

getDescription()

public abstract Description getDescription() throws ParsingException
Returns the playlist description.
return
Description
The playlist description object

getThumbnails()

public List<Image> getThumbnails() throws ParsingException
Returns the playlist’s thumbnail images.
return
List<Image>
List of thumbnail images, or empty list if unavailable

getBanners()

public List<Image> getBanners() throws ParsingException
Returns the playlist’s banner images.
return
List<Image>
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.
return
long
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)

Uploader Information Methods

getUploaderName()

public abstract String getUploaderName() throws ParsingException
Returns the name of the playlist creator.
return
String
Creator’s name

getUploaderUrl()

public abstract String getUploaderUrl() throws ParsingException
Returns the URL to the creator’s channel.
return
String
Creator’s channel URL

getUploaderAvatars()

public abstract List<Image> getUploaderAvatars() throws ParsingException
Returns the creator’s avatar images.
return
List<Image>
List of uploader avatar images

isUploaderVerified()

public abstract boolean isUploaderVerified() throws ParsingException
Returns whether the playlist creator is verified.
return
boolean
true if verified, false otherwise

Sub-Channel Methods

getSubChannelName()

public String getSubChannelName() throws ParsingException
Returns the name of the sub-channel (if applicable).
return
String
Sub-channel name, or empty string if not applicable

getSubChannelUrl()

public String getSubChannelUrl() throws ParsingException
Returns the URL to the sub-channel.
return
String
Sub-channel URL, or empty string if not applicable

getSubChannelAvatars()

public List<Image> getSubChannelAvatars() throws ParsingException
Returns the sub-channel’s avatar images.
return
List<Image>
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.
localization
Localization
required
The localization to use

forceContentCountry()

public void forceContentCountry(ContentCountry contentCountry)
Forces a specific content country for this extractor.
contentCountry
ContentCountry
required
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:
items
List<StreamInfoItem>
The list of stream items on this page
nextPage
Page
Reference to the next page, or null if this is the last page
errors
List<Throwable>
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)

Build docs developers (and LLMs) love