mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-01-06 01:20:32 +05:30
Get all expandedShelfContentsRenderers in YoutubeTrendingExtractor
This commit is contained in:
parent
a2d8489e16
commit
db305408e9
@ -108,17 +108,21 @@ public class YoutubeTrendingExtractor extends KioskExtractor<StreamInfoItem> {
|
|||||||
@Override
|
@Override
|
||||||
public InfoItemsPage<StreamInfoItem> getInitialPage() {
|
public InfoItemsPage<StreamInfoItem> getInitialPage() {
|
||||||
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
|
StreamInfoItemsCollector collector = new StreamInfoItemsCollector(getServiceId());
|
||||||
JsonArray firstPageElements = initialData.getObject("contents").getObject("twoColumnBrowseResultsRenderer")
|
|
||||||
.getArray("tabs").getObject(0).getObject("tabRenderer").getObject("content")
|
|
||||||
.getObject("sectionListRenderer").getArray("contents").getObject(0).getObject("itemSectionRenderer")
|
|
||||||
.getArray("contents").getObject(0).getObject("shelfRenderer").getObject("content")
|
|
||||||
.getObject("expandedShelfContentsRenderer").getArray("items");
|
|
||||||
|
|
||||||
final TimeAgoParser timeAgoParser = getTimeAgoParser();
|
final TimeAgoParser timeAgoParser = getTimeAgoParser();
|
||||||
|
JsonArray itemSectionRenderers = initialData.getObject("contents").getObject("twoColumnBrowseResultsRenderer")
|
||||||
|
.getArray("tabs").getObject(0).getObject("tabRenderer").getObject("content")
|
||||||
|
.getObject("sectionListRenderer").getArray("contents");
|
||||||
|
|
||||||
for (Object ul : firstPageElements) {
|
for (Object itemSectionRenderer : itemSectionRenderers) {
|
||||||
final JsonObject videoInfo = ((JsonObject) ul).getObject("videoRenderer");
|
JsonObject expandedShelfContentsRenderer = ((JsonObject) itemSectionRenderer).getObject("itemSectionRenderer")
|
||||||
collector.commit(new YoutubeStreamInfoItemExtractor(videoInfo, timeAgoParser));
|
.getArray("contents").getObject(0).getObject("shelfRenderer").getObject("content")
|
||||||
|
.getObject("expandedShelfContentsRenderer");
|
||||||
|
if (expandedShelfContentsRenderer != null) {
|
||||||
|
for (Object ul : expandedShelfContentsRenderer.getArray("items")) {
|
||||||
|
final JsonObject videoInfo = ((JsonObject) ul).getObject("videoRenderer");
|
||||||
|
collector.commit(new YoutubeStreamInfoItemExtractor(videoInfo, timeAgoParser));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new InfoItemsPage<>(collector, getNextPageUrl());
|
return new InfoItemsPage<>(collector, getNextPageUrl());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user