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();
|
return nextPageUrl != null && !nextPageUrl.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<InfoItem> getNextItemsList() {
|
public List<InfoItem> getItemsList() {
|
||||||
return infoItemList;
|
return infoItemList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
public abstract class ListInfo extends Info {
|
public abstract class ListInfo extends Info {
|
||||||
public List<InfoItem> related_streams;
|
public List<InfoItem> related_streams;
|
||||||
public boolean has_more_streams;
|
public String nextPageUrl = null;
|
||||||
public String next_streams_url;
|
|
||||||
|
|
||||||
public ListInfo(int serviceId, String id, String url, String name) {
|
public ListInfo(int serviceId, String id, String url, String name) {
|
||||||
super(serviceId, id, url, name);
|
super(serviceId, id, url, name);
|
||||||
|
@ -20,18 +19,14 @@ public abstract class ListInfo extends Info {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasNextPage() {
|
public boolean hasNextPage() {
|
||||||
return has_more_streams;
|
return nextPageUrl != null && !nextPageUrl.isEmpty();
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasMoreStreams(boolean has_more_streams) {
|
|
||||||
this.has_more_streams = has_more_streams;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNextPageUrl() {
|
public String getNextPageUrl() {
|
||||||
return next_streams_url;
|
return nextPageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNextStreamsUrl(String next_streams_url) {
|
public void setNextPageUrl(String pageUrl) {
|
||||||
this.next_streams_url = next_streams_url;
|
this.nextPageUrl = pageUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,7 @@ public class ChannelInfo extends ListInfo {
|
||||||
info.addError(e);
|
info.addError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
info.setHasMoreStreams(extractor.hasNextPage());
|
info.setNextPageUrl(extractor.getNextPageUrl());
|
||||||
info.setNextStreamsUrl(extractor.getNextPageUrl());
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,7 @@ public class PlaylistInfo extends ListInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
info.setRelatedStreams(getInfoItemsOrLogError(info, extractor));
|
info.setRelatedStreams(getInfoItemsOrLogError(info, extractor));
|
||||||
info.setHasMoreStreams(extractor.hasNextPage());
|
info.setNextPageUrl(extractor.getNextPageUrl());
|
||||||
info.setNextStreamsUrl(extractor.getNextPageUrl());
|
|
||||||
return info;
|
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 static final String CHANNEL_URL_PARAMETERS = "/videos?view=0&flow=list&sort=dd&live_view=10000";
|
||||||
|
|
||||||
private Document doc;
|
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) {
|
public YoutubeChannelExtractor(StreamingService service, String url) {
|
||||||
super(service, url);
|
super(service, url);
|
||||||
|
@ -70,7 +58,6 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
||||||
String pageContent = downloader.download(channelUrl);
|
String pageContent = downloader.download(channelUrl);
|
||||||
doc = Jsoup.parse(pageContent, channelUrl);
|
doc = Jsoup.parse(pageContent, channelUrl);
|
||||||
|
|
||||||
//nextStreamsAjax = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -70,7 +70,12 @@ public class SoundcloudChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetNextStreams() throws Exception {
|
public void testGetNextPageUrl() throws Exception {
|
||||||
|
assertTrue(extractor.hasNextPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetPage() throws Exception {
|
||||||
// Setup the streams
|
// Setup the streams
|
||||||
extractor.getStreams();
|
extractor.getStreams();
|
||||||
ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl());
|
ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl());
|
||||||
|
|
|
@ -74,7 +74,12 @@ public class SoundcloudChartsExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetNextStreams() throws Exception {
|
public void testGetNextPageUrl() throws Exception {
|
||||||
|
assertTrue(extractor.hasNextPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetNextPage() throws Exception {
|
||||||
extractor.getInfoItems();
|
extractor.getInfoItems();
|
||||||
assertFalse("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null
|
assertFalse("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null
|
||||||
|| extractor.getPage(extractor.getNextPageUrl()).infoItemList.isEmpty());
|
|| extractor.getPage(extractor.getNextPageUrl()).infoItemList.isEmpty());
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class SoundcloudPlaylistExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ExtractionException.class)
|
@Test(expected = ExtractionException.class)
|
||||||
public void testGetNextStreamsNonExistent() throws Exception {
|
public void testGetNextPageNonExistent() throws Exception {
|
||||||
// Setup the streams
|
// Setup the streams
|
||||||
extractor.getStreams();
|
extractor.getStreams();
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,12 @@ public class YoutubeChannelExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetNextStreams() throws Exception {
|
public void testGetNextPageUrl() throws Exception {
|
||||||
|
assertTrue(extractor.hasNextPage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetPage() throws Exception {
|
||||||
// Setup the streams
|
// Setup the streams
|
||||||
extractor.getStreams();
|
extractor.getStreams();
|
||||||
ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl());
|
ListExtractor.InfoItemPage nextItemsResult = extractor.getPage(extractor.getNextPageUrl());
|
||||||
|
|
|
@ -84,13 +84,13 @@ public class YoutubeTrendingExtractorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetNextStreams() throws Exception {
|
public void testGetNextPage() {
|
||||||
assertTrue("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null
|
assertTrue("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null
|
||||||
|| extractor.getPage(extractor.getNextPageUrl()).getNextItemsList().isEmpty());
|
|| extractor.getPage(extractor.getNextPageUrl()).getItemsList().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCleanUrl() throws Exception {
|
public void testGetCleanUrl() {
|
||||||
assertEquals(extractor.getCleanUrl(), extractor.getCleanUrl(), "https://www.youtube.com/feed/trending");
|
assertEquals(extractor.getCleanUrl(), extractor.getCleanUrl(), "https://www.youtube.com/feed/trending");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue