|
1 | 1 | package org.schabi.newpipe.extractor; |
2 | 2 |
|
3 | 3 | import org.schabi.newpipe.extractor.exceptions.ExtractionException; |
4 | | -import org.schabi.newpipe.extractor.stream.StreamInfoItemCollector; |
5 | 4 |
|
6 | 5 | import javax.annotation.Nonnull; |
7 | 6 | import java.io.IOException; |
|
11 | 10 | * Base class to extractors that have a list (e.g. playlists, users). |
12 | 11 | */ |
13 | 12 | public abstract class ListExtractor extends Extractor { |
14 | | - protected String nextStreamsUrl; |
| 13 | + protected String nextPageUrl; |
15 | 14 |
|
16 | 15 | /** |
17 | | - * Get a new ListExtractor with the given nextStreamsUrl set. |
| 16 | + * Get a new ListExtractor with the given nextPageUrl set. |
18 | 17 | */ |
19 | | - public ListExtractor(StreamingService service, String url, String nextStreamsUrl) throws ExtractionException { |
| 18 | + public ListExtractor(StreamingService service, String url, String nextPageUrl) throws ExtractionException { |
20 | 19 | super(service, url); |
21 | | - setNextStreamsUrl(nextStreamsUrl); |
| 20 | + setNextPageUrl(nextPageUrl); |
22 | 21 | } |
23 | 22 |
|
24 | 23 | @Nonnull |
25 | | - public abstract StreamInfoItemCollector getStreams() throws IOException, ExtractionException; |
| 24 | + public abstract InfoItemsCollector getInfoItems() throws IOException, ExtractionException; |
26 | 25 |
|
27 | | - public abstract NextItemsResult getNextStreams() throws IOException, ExtractionException; |
| 26 | + public abstract InfoItemPage getInfoItemPage() throws IOException, ExtractionException; |
28 | 27 |
|
29 | | - public boolean hasMoreStreams() { |
30 | | - return nextStreamsUrl != null && !nextStreamsUrl.isEmpty(); |
| 28 | + public boolean hasNextPage() { |
| 29 | + return nextPageUrl != null && !nextPageUrl.isEmpty(); |
31 | 30 | } |
32 | 31 |
|
33 | | - public String getNextStreamsUrl() { |
34 | | - return nextStreamsUrl; |
| 32 | + public String getNextPageUrl() { |
| 33 | + return nextPageUrl; |
35 | 34 | } |
36 | 35 |
|
37 | | - public void setNextStreamsUrl(String nextStreamsUrl) { |
38 | | - this.nextStreamsUrl = nextStreamsUrl; |
| 36 | + public void setNextPageUrl(String nextPageUrl) { |
| 37 | + this.nextPageUrl = nextPageUrl; |
39 | 38 | } |
40 | 39 |
|
41 | 40 | /*////////////////////////////////////////////////////////////////////////// |
42 | 41 | // Inner |
43 | 42 | //////////////////////////////////////////////////////////////////////////*/ |
44 | 43 |
|
45 | | - public static class NextItemsResult { |
| 44 | + public static class InfoItemPage { |
46 | 45 | /** |
47 | 46 | * The current list of items to this result |
48 | 47 | */ |
49 | | - public final List<InfoItem> nextItemsList; |
| 48 | + public final List<InfoItem> infoItemList; |
50 | 49 |
|
51 | 50 | /** |
52 | 51 | * Next url to fetch more items |
53 | 52 | */ |
54 | | - public final String nextItemsUrl; |
| 53 | + public final String nextPageUrl; |
55 | 54 |
|
56 | 55 | /** |
57 | 56 | * Errors that happened during the extraction |
58 | 57 | */ |
59 | 58 | public final List<Throwable> errors; |
60 | 59 |
|
61 | | - public NextItemsResult(InfoItemCollector collector, String nextItemsUrl) { |
62 | | - this(collector.getItemList(), nextItemsUrl, collector.getErrors()); |
| 60 | + public InfoItemPage(InfoItemsCollector collector, String nextPageUrl) { |
| 61 | + this(collector.getItemList(), nextPageUrl, collector.getErrors()); |
63 | 62 | } |
64 | 63 |
|
65 | | - public NextItemsResult(List<InfoItem> nextItemsList, String nextItemsUrl, List<Throwable> errors) { |
66 | | - this.nextItemsList = nextItemsList; |
67 | | - this.nextItemsUrl = nextItemsUrl; |
| 64 | + public InfoItemPage(List<InfoItem> infoItemList, String nextPageUrl, List<Throwable> errors) { |
| 65 | + this.infoItemList = infoItemList; |
| 66 | + this.nextPageUrl = nextPageUrl; |
68 | 67 | this.errors = errors; |
69 | 68 | } |
70 | 69 |
|
71 | | - public boolean hasMoreStreams() { |
72 | | - return nextItemsUrl != null && !nextItemsUrl.isEmpty(); |
| 70 | + public boolean hasNextPage() { |
| 71 | + return nextPageUrl != null && !nextPageUrl.isEmpty(); |
73 | 72 | } |
74 | 73 |
|
75 | 74 | public List<InfoItem> getNextItemsList() { |
76 | | - return nextItemsList; |
| 75 | + return infoItemList; |
77 | 76 | } |
78 | 77 |
|
79 | | - public String getNextItemsUrl() { |
80 | | - return nextItemsUrl; |
| 78 | + public String getNextPageUrl() { |
| 79 | + return nextPageUrl; |
81 | 80 | } |
82 | 81 |
|
83 | 82 | public List<Throwable> getErrors() { |
|
0 commit comments