Merge pull request #594 from TeamNewPipe/conersions
Reduce number of type conversions
This commit is contained in:
commit
9dbc152d44
|
@ -192,19 +192,20 @@ public class YoutubeSearchExtractor extends SearchExtractor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectStreamsFrom(final InfoItemsSearchCollector collector, final JsonArray videos) throws NothingFoundException, ParsingException {
|
private void collectStreamsFrom(final InfoItemsSearchCollector collector, final JsonArray contents) throws NothingFoundException, ParsingException {
|
||||||
final TimeAgoParser timeAgoParser = getTimeAgoParser();
|
final TimeAgoParser timeAgoParser = getTimeAgoParser();
|
||||||
|
|
||||||
for (Object item : videos) {
|
for (Object content : contents) {
|
||||||
if (((JsonObject) item).has("backgroundPromoRenderer")) {
|
final JsonObject item = (JsonObject) content;
|
||||||
throw new NothingFoundException(getTextFromObject(((JsonObject) item)
|
if (item.has("backgroundPromoRenderer")) {
|
||||||
.getObject("backgroundPromoRenderer").getObject("bodyText")));
|
throw new NothingFoundException(getTextFromObject(
|
||||||
} else if (((JsonObject) item).has("videoRenderer")) {
|
item.getObject("backgroundPromoRenderer").getObject("bodyText")));
|
||||||
collector.commit(new YoutubeStreamInfoItemExtractor(((JsonObject) item).getObject("videoRenderer"), timeAgoParser));
|
} else if (item.has("videoRenderer")) {
|
||||||
} else if (((JsonObject) item).has("channelRenderer")) {
|
collector.commit(new YoutubeStreamInfoItemExtractor(item.getObject("videoRenderer"), timeAgoParser));
|
||||||
collector.commit(new YoutubeChannelInfoItemExtractor(((JsonObject) item).getObject("channelRenderer")));
|
} else if (item.has("channelRenderer")) {
|
||||||
} else if (((JsonObject) item).has("playlistRenderer")) {
|
collector.commit(new YoutubeChannelInfoItemExtractor(item.getObject("channelRenderer")));
|
||||||
collector.commit(new YoutubePlaylistInfoItemExtractor(((JsonObject) item).getObject("playlistRenderer")));
|
} else if (item.has("playlistRenderer")) {
|
||||||
|
collector.commit(new YoutubePlaylistInfoItemExtractor(item.getObject("playlistRenderer")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue