|
1 | 1 | package org.schabi.newpipe.extractor.services.youtube.extractors; |
2 | 2 |
|
3 | | -import org.schabi.newpipe.extractor.InfoItem; |
| 3 | +import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty; |
| 4 | + |
4 | 5 | import org.schabi.newpipe.extractor.Page; |
5 | 6 | import org.schabi.newpipe.extractor.StreamingService; |
6 | 7 | import org.schabi.newpipe.extractor.channel.tabs.ChannelTabExtractor; |
|
12 | 13 | import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler; |
13 | 14 | import org.schabi.newpipe.extractor.playlist.PlaylistExtractor; |
14 | 15 | import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubePlaylistLinkHandlerFactory; |
15 | | -import org.schabi.newpipe.extractor.stream.StreamInfoItem; |
16 | 16 |
|
17 | | -import javax.annotation.Nonnull; |
18 | 17 | import java.io.IOException; |
19 | | -import java.util.ArrayList; |
20 | 18 | import java.util.List; |
21 | 19 |
|
22 | | -import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty; |
| 20 | +import javax.annotation.Nonnull; |
23 | 21 |
|
24 | 22 | /** |
25 | 23 | * A {@link ChannelTabExtractor} for YouTube system playlists using a |
@@ -74,35 +72,19 @@ public void onFetchPage(@Nonnull final Downloader downloader) |
74 | 72 |
|
75 | 73 | @Nonnull |
76 | 74 | @Override |
77 | | - public InfoItemsPage<InfoItem> getInitialPage() throws IOException, ExtractionException { |
| 75 | + public InfoItemsPage getInitialPage() throws IOException, ExtractionException { |
78 | 76 | if (!playlistExisting) { |
79 | 77 | return InfoItemsPage.emptyPage(); |
80 | 78 | } |
81 | | - |
82 | | - final InfoItemsPage<StreamInfoItem> playlistInitialPage = |
83 | | - playlistExtractorInstance.getInitialPage(); |
84 | | - |
85 | | - // We can't provide the playlist page as it is due to a type conflict, we need to wrap the |
86 | | - // page items and provide a new InfoItemsPage |
87 | | - final List<InfoItem> infoItems = new ArrayList<>(playlistInitialPage.getItems()); |
88 | | - return new InfoItemsPage<>(infoItems, playlistInitialPage.getNextPage(), |
89 | | - playlistInitialPage.getErrors()); |
| 79 | + return playlistExtractorInstance.getInitialPage(); |
90 | 80 | } |
91 | 81 |
|
92 | 82 | @Override |
93 | | - public InfoItemsPage<InfoItem> getPage(final Page page) |
94 | | - throws IOException, ExtractionException { |
| 83 | + public InfoItemsPage getPage(final Page page) throws IOException, ExtractionException { |
95 | 84 | if (!playlistExisting) { |
96 | 85 | return InfoItemsPage.emptyPage(); |
97 | 86 | } |
98 | | - |
99 | | - final InfoItemsPage<StreamInfoItem> playlistPage = playlistExtractorInstance.getPage(page); |
100 | | - |
101 | | - // We can't provide the playlist page as it is due to a type conflict, we need to wrap the |
102 | | - // page items and provide a new InfoItemsPage |
103 | | - final List<InfoItem> infoItems = new ArrayList<>(playlistPage.getItems()); |
104 | | - return new InfoItemsPage<>(infoItems, playlistPage.getNextPage(), |
105 | | - playlistPage.getErrors()); |
| 87 | + return playlistExtractorInstance.getPage(page); |
106 | 88 | } |
107 | 89 |
|
108 | 90 | /** |
|
0 commit comments