Skip to content

Commit 5e34556

Browse files
theScrabimauriciocolli
authored andcommitted
removed more nextStreams keywords
1 parent dc0ef3b commit 5e34556

10 files changed

Lines changed: 30 additions & 35 deletions

File tree

src/main/java/org/schabi/newpipe/extractor/ListExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public boolean hasNextPage() {
6565
return nextPageUrl != null && !nextPageUrl.isEmpty();
6666
}
6767

68-
public List<InfoItem> getNextItemsList() {
68+
public List<InfoItem> getItemsList() {
6969
return infoItemList;
7070
}
7171

src/main/java/org/schabi/newpipe/extractor/ListInfo.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
public abstract class ListInfo extends Info {
66
public List<InfoItem> related_streams;
7-
public boolean has_more_streams;
8-
public String next_streams_url;
7+
public String nextPageUrl = null;
98

109
public ListInfo(int serviceId, String id, String url, String name) {
1110
super(serviceId, id, url, name);
@@ -20,18 +19,14 @@ public void setRelatedStreams(List<InfoItem> related_streams) {
2019
}
2120

2221
public boolean hasNextPage() {
23-
return has_more_streams;
24-
}
25-
26-
public void setHasMoreStreams(boolean has_more_streams) {
27-
this.has_more_streams = has_more_streams;
22+
return nextPageUrl != null && !nextPageUrl.isEmpty();
2823
}
2924

3025
public String getNextPageUrl() {
31-
return next_streams_url;
26+
return nextPageUrl;
3227
}
3328

34-
public void setNextStreamsUrl(String next_streams_url) {
35-
this.next_streams_url = next_streams_url;
29+
public void setNextPageUrl(String pageUrl) {
30+
this.nextPageUrl = pageUrl;
3631
}
3732
}

src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException
9292
info.addError(e);
9393
}
9494

95-
info.setHasMoreStreams(extractor.hasNextPage());
96-
info.setNextStreamsUrl(extractor.getNextPageUrl());
95+
info.setNextPageUrl(extractor.getNextPageUrl());
9796
return info;
9897
}
9998

src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ public static PlaylistInfo getInfo(PlaylistExtractor extractor) throws IOExcepti
7575
}
7676

7777
info.setRelatedStreams(getInfoItemsOrLogError(info, extractor));
78-
info.setHasMoreStreams(extractor.hasNextPage());
79-
info.setNextStreamsUrl(extractor.getNextPageUrl());
78+
info.setNextPageUrl(extractor.getNextPageUrl());
8079
return info;
8180
}
8281

src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractor.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,6 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
4747
private static final String CHANNEL_URL_PARAMETERS = "/videos?view=0&flow=list&sort=dd&live_view=10000";
4848

4949
private Document doc;
50-
/**
51-
* It's lazily initialized (when getInfoItemPage is called)
52-
*/
53-
// private Document nextStreamsAjax;
54-
55-
/**
56-
* Unfortunately, we have to fetch the page even if we are only getting next streams,
57-
* as they don't deliver enough information on their own (the channel name, for example).
58-
* <br/>
59-
* This help us to keep track on what are we fetching.
60-
*/
61-
//private boolean fetchingNextStreams;
6250

6351
public YoutubeChannelExtractor(StreamingService service, String url) {
6452
super(service, url);
@@ -70,7 +58,6 @@ public void onFetchPage(@Nonnull Downloader downloader) throws IOException, Extr
7058
String pageContent = downloader.download(channelUrl);
7159
doc = Jsoup.parse(pageContent, channelUrl);
7260

73-
//nextStreamsAjax = null;
7461
}
7562

7663
@Override

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChannelExtractorTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ public void testGetSubscriberCount() throws Exception {
7070
}
7171

7272
@Test
73-
public void testGetNextStreams() throws Exception {
73+
public void testGetNextPageUrl() throws Exception {
74+
assertTrue(extractor.hasNextPage());
75+
}
76+
77+
@Test
78+
public void testGetPage() throws Exception {
7479
// Setup the streams
7580
extractor.getStreams();
7681
ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl());

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudChartsExtractorTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ public void testHasMoreStreams() throws Exception {
7474
}
7575

7676
@Test
77-
public void testGetNextStreams() throws Exception {
77+
public void testGetNextPageUrl() throws Exception {
78+
assertTrue(extractor.hasNextPage());
79+
}
80+
81+
@Test
82+
public void testGetNextPage() throws Exception {
7883
extractor.getInfoItems();
7984
assertFalse("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null
8085
|| extractor.getPage(extractor.getNextPageUrl()).infoItemList.isEmpty());

src/test/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudPlaylistExtractorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void testHasMoreStreams() throws Exception {
8585
}
8686

8787
@Test(expected = ExtractionException.class)
88-
public void testGetNextStreamsNonExistent() throws Exception {
88+
public void testGetNextPageNonExistent() throws Exception {
8989
// Setup the streams
9090
extractor.getStreams();
9191

src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeChannelExtractorTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,12 @@ public void testGetSubscriberCount() throws Exception {
109109
}
110110

111111
@Test
112-
public void testGetNextStreams() throws Exception {
112+
public void testGetNextPageUrl() throws Exception {
113+
assertTrue(extractor.hasNextPage());
114+
}
115+
116+
@Test
117+
public void testGetPage() throws Exception {
113118
// Setup the streams
114119
extractor.getStreams();
115120
ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl());

src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeTrendingExtractorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ public void testHasMoreStreams() throws Exception {
8484
}
8585

8686
@Test
87-
public void testGetNextStreams() throws Exception {
87+
public void testGetNextPage() {
8888
assertTrue("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null
89-
|| extractor.getPage(extractor.getNextPageUrl()).getNextItemsList().isEmpty());
89+
|| extractor.getPage(extractor.getNextPageUrl()).getItemsList().isEmpty());
9090
}
9191

9292
@Test
93-
public void testGetCleanUrl() throws Exception {
93+
public void testGetCleanUrl() {
9494
assertEquals(extractor.getCleanUrl(), extractor.getCleanUrl(), "https://www.youtube.com/feed/trending");
9595
}
9696
}

0 commit comments

Comments
 (0)