2
0
mirror of https://github.com/TeamNewPipe/NewPipeExtractor synced 2025-08-31 06:15:37 +00:00

Don't assume which channel tab is videos

This commit is contained in:
wb9688
2020-02-23 14:18:21 +01:00
committed by TobiGr
parent 316fe0109d
commit 7442f91aa6

View File

@@ -248,9 +248,22 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
final String uploaderUrl = getUrl();
final TimeAgoParser timeAgoParser = getTimeAgoParser();
JsonArray videos = initialData.getObject("contents").getObject("twoColumnBrowseResultsRenderer")
.getArray("tabs").getObject(1).getObject("tabRenderer").getObject("content")
.getObject("sectionListRenderer").getArray("contents");
JsonArray tabs = initialData.getObject("contents").getObject("twoColumnBrowseResultsRenderer")
.getArray("tabs");
JsonArray videos = null;
for (Object tab : tabs) {
if (((JsonObject) tab).getObject("tabRenderer") != null) {
if (((JsonObject) tab).getObject("tabRenderer").getString("title").equals("Videos")) {
videos = ((JsonObject) tab).getObject("tabRenderer").getObject("content")
.getObject("sectionListRenderer").getArray("contents");
}
}
}
if (videos == null) {
throw new ParsingException("Could not find Videos tab");
}
for (Object video : videos) {
JsonObject videoInfo = ((JsonObject) video).getObject("itemSectionRenderer")