fix yt trending contains to less items
This commit is contained in:
parent
a0e5c88b13
commit
5f2d0cf6b5
|
@ -23,6 +23,7 @@ package org.schabi.newpipe.extractor.services.youtube;
|
|||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import org.schabi.newpipe.extractor.*;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||
|
@ -81,7 +82,8 @@ public class YoutubeTrendingExtractor extends KioskExtractor {
|
|||
@Override
|
||||
public StreamInfoItemCollector getStreams() throws ParsingException {
|
||||
StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId());
|
||||
Element ul = doc.select("ul[class*=\"expanded-shelf-content-list\"]").first();
|
||||
Elements uls = doc.select("ul[class*=\"expanded-shelf-content-list\"]");
|
||||
for(Element ul : uls) {
|
||||
for(final Element li : ul.children()) {
|
||||
final Element el = li.select("div[class*=\"yt-lockup-dismissable\"]").first();
|
||||
collector.commit(new YoutubeStreamInfoItemExtractor(li) {
|
||||
|
@ -152,6 +154,7 @@ public class YoutubeTrendingExtractor extends KioskExtractor {
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return collector;
|
||||
}
|
||||
|
|
|
@ -67,10 +67,10 @@ public class YoutubeTrendingExtractorTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetStreams() throws Exception {
|
||||
public void testGetStreamsQuantity() throws Exception {
|
||||
StreamInfoItemCollector collector = extractor.getStreams();
|
||||
Utils.printErrors(collector);
|
||||
assertFalse("no streams are received", collector.getItemList().isEmpty());
|
||||
assertTrue("no streams are received", collector.getItemList().size() >= 20);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue