[YouTube] Directly use playlist collector in channel tabs wrapper
Note that this introduces a "Raw use of parameterized class 'InfoItemsPage'" warning, but it can be ignored since the type missing would be <InfoItem>, and StreamInfoItem extends InfoItem
This commit is contained in:
parent
e34b4f1978
commit
9d3761a371
|
@ -1,6 +1,7 @@
|
|||
package org.schabi.newpipe.extractor.services.youtube.extractors;
|
||||
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
|
||||
|
||||
import org.schabi.newpipe.extractor.Page;
|
||||
import org.schabi.newpipe.extractor.StreamingService;
|
||||
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabExtractor;
|
||||
|
@ -12,14 +13,11 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|||
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
|
||||
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
|
||||
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubePlaylistLinkHandlerFactory;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A {@link ChannelTabExtractor} for YouTube system playlists using a
|
||||
|
@ -74,35 +72,19 @@ public class YoutubeChannelTabPlaylistExtractor extends ChannelTabExtractor {
|
|||
|
||||
@Nonnull
|
||||
@Override
|
||||
public InfoItemsPage<InfoItem> getInitialPage() throws IOException, ExtractionException {
|
||||
public InfoItemsPage getInitialPage() throws IOException, ExtractionException {
|
||||
if (!playlistExisting) {
|
||||
return InfoItemsPage.emptyPage();
|
||||
}
|
||||
|
||||
final InfoItemsPage<StreamInfoItem> playlistInitialPage =
|
||||
playlistExtractorInstance.getInitialPage();
|
||||
|
||||
// We can't provide the playlist page as it is due to a type conflict, we need to wrap the
|
||||
// page items and provide a new InfoItemsPage
|
||||
final List<InfoItem> infoItems = new ArrayList<>(playlistInitialPage.getItems());
|
||||
return new InfoItemsPage<>(infoItems, playlistInitialPage.getNextPage(),
|
||||
playlistInitialPage.getErrors());
|
||||
return playlistExtractorInstance.getInitialPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfoItemsPage<InfoItem> getPage(final Page page)
|
||||
throws IOException, ExtractionException {
|
||||
public InfoItemsPage getPage(final Page page) throws IOException, ExtractionException {
|
||||
if (!playlistExisting) {
|
||||
return InfoItemsPage.emptyPage();
|
||||
}
|
||||
|
||||
final InfoItemsPage<StreamInfoItem> playlistPage = playlistExtractorInstance.getPage(page);
|
||||
|
||||
// We can't provide the playlist page as it is due to a type conflict, we need to wrap the
|
||||
// page items and provide a new InfoItemsPage
|
||||
final List<InfoItem> infoItems = new ArrayList<>(playlistPage.getItems());
|
||||
return new InfoItemsPage<>(infoItems, playlistPage.getNextPage(),
|
||||
playlistPage.getErrors());
|
||||
return playlistExtractorInstance.getPage(page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue