mirror of
https://github.com/TeamNewPipe/NewPipeExtractor
synced 2024-12-12 11:59:45 +01:00
removed more nextStreams keywords
This commit is contained in:
parent
dc0ef3b89a
commit
5e34556ac3
@ -65,7 +65,7 @@ public abstract class ListExtractor extends Extractor {
|
||||
return nextPageUrl != null && !nextPageUrl.isEmpty();
|
||||
}
|
||||
|
||||
public List<InfoItem> getNextItemsList() {
|
||||
public List<InfoItem> getItemsList() {
|
||||
return infoItemList;
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,7 @@ import java.util.List;
|
||||
|
||||
public abstract class ListInfo extends Info {
|
||||
public List<InfoItem> related_streams;
|
||||
public boolean has_more_streams;
|
||||
public String next_streams_url;
|
||||
public String nextPageUrl = null;
|
||||
|
||||
public ListInfo(int serviceId, String id, String url, String name) {
|
||||
super(serviceId, id, url, name);
|
||||
@ -20,18 +19,14 @@ public abstract class ListInfo extends Info {
|
||||
}
|
||||
|
||||
public boolean hasNextPage() {
|
||||
return has_more_streams;
|
||||
}
|
||||
|
||||
public void setHasMoreStreams(boolean has_more_streams) {
|
||||
this.has_more_streams = has_more_streams;
|
||||
return nextPageUrl != null && !nextPageUrl.isEmpty();
|
||||
}
|
||||
|
||||
public String getNextPageUrl() {
|
||||
return next_streams_url;
|
||||
return nextPageUrl;
|
||||
}
|
||||
|
||||
public void setNextStreamsUrl(String next_streams_url) {
|
||||
this.next_streams_url = next_streams_url;
|
||||
public void setNextPageUrl(String pageUrl) {
|
||||
this.nextPageUrl = pageUrl;
|
||||
}
|
||||
}
|
||||
|
@ -92,8 +92,7 @@ public class ChannelInfo extends ListInfo {
|
||||
info.addError(e);
|
||||
}
|
||||
|
||||
info.setHasMoreStreams(extractor.hasNextPage());
|
||||
info.setNextStreamsUrl(extractor.getNextPageUrl());
|
||||
info.setNextPageUrl(extractor.getNextPageUrl());
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -75,8 +75,7 @@ public class PlaylistInfo extends ListInfo {
|
||||
}
|
||||
|
||||
info.setRelatedStreams(getInfoItemsOrLogError(info, extractor));
|
||||
info.setHasMoreStreams(extractor.hasNextPage());
|
||||
info.setNextStreamsUrl(extractor.getNextPageUrl());
|
||||
info.setNextPageUrl(extractor.getNextPageUrl());
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -47,18 +47,6 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
||||
private static final String CHANNEL_URL_PARAMETERS = "/videos?view=0&flow=list&sort=dd&live_view=10000";
|
||||
|
||||
private Document doc;
|
||||
/**
|
||||
* It's lazily initialized (when getInfoItemPage is called)
|
||||
*/
|
||||
// private Document nextStreamsAjax;
|
||||
|
||||
/**
|
||||
* Unfortunately, we have to fetch the page even if we are only getting next streams,
|
||||
* as they don't deliver enough information on their own (the channel name, for example).
|
||||
* <br/>
|
||||
* This help us to keep track on what are we fetching.
|
||||
*/
|
||||
//private boolean fetchingNextStreams;
|
||||
|
||||
public YoutubeChannelExtractor(StreamingService service, String url) {
|
||||
super(service, url);
|
||||
@ -70,7 +58,6 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
||||
String pageContent = downloader.download(channelUrl);
|
||||
doc = Jsoup.parse(pageContent, channelUrl);
|
||||
|
||||
//nextStreamsAjax = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,7 +70,12 @@ public class SoundcloudChannelExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNextStreams() throws Exception {
|
||||
public void testGetNextPageUrl() throws Exception {
|
||||
assertTrue(extractor.hasNextPage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPage() throws Exception {
|
||||
// Setup the streams
|
||||
extractor.getStreams();
|
||||
ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl());
|
||||
|
@ -74,7 +74,12 @@ public class SoundcloudChartsExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNextStreams() throws Exception {
|
||||
public void testGetNextPageUrl() throws Exception {
|
||||
assertTrue(extractor.hasNextPage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNextPage() throws Exception {
|
||||
extractor.getInfoItems();
|
||||
assertFalse("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null
|
||||
|| extractor.getPage(extractor.getNextPageUrl()).infoItemList.isEmpty());
|
||||
|
@ -85,7 +85,7 @@ public class SoundcloudPlaylistExtractorTest {
|
||||
}
|
||||
|
||||
@Test(expected = ExtractionException.class)
|
||||
public void testGetNextStreamsNonExistent() throws Exception {
|
||||
public void testGetNextPageNonExistent() throws Exception {
|
||||
// Setup the streams
|
||||
extractor.getStreams();
|
||||
|
||||
|
@ -109,7 +109,12 @@ public class YoutubeChannelExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNextStreams() throws Exception {
|
||||
public void testGetNextPageUrl() throws Exception {
|
||||
assertTrue(extractor.hasNextPage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPage() throws Exception {
|
||||
// Setup the streams
|
||||
extractor.getStreams();
|
||||
ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl());
|
||||
|
@ -84,13 +84,13 @@ public class YoutubeTrendingExtractorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetNextStreams() throws Exception {
|
||||
public void testGetNextPage() {
|
||||
assertTrue("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null
|
||||
|| extractor.getPage(extractor.getNextPageUrl()).getNextItemsList().isEmpty());
|
||||
|| extractor.getPage(extractor.getNextPageUrl()).getItemsList().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCleanUrl() throws Exception {
|
||||
public void testGetCleanUrl() {
|
||||
assertEquals(extractor.getCleanUrl(), extractor.getCleanUrl(), "https://www.youtube.com/feed/trending");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user