Go through all badges when checking if a StreamInfoItem is a live stream

This commit is contained in:
TobiGr 2020-03-01 12:52:37 +01:00
parent 830b7d3dbd
commit 35252235b0
1 changed files with 6 additions and 2 deletions

View File

@ -55,9 +55,13 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
@Override
public StreamType getStreamType() {
try {
if (videoInfo.getArray("badges").getObject(0).getObject("metadataBadgeRenderer").getString("label").equals("LIVE NOW")) {
return StreamType.LIVE_STREAM;
JsonArray badges = videoInfo.getArray("badges");
for (Object badge : badges) {
if (((JsonObject) badge).getObject("metadataBadgeRenderer").getString("label").equals("LIVE NOW")) {
return StreamType.LIVE_STREAM;
}
}
} catch (Exception ignored) {}
return StreamType.VIDEO_STREAM;
}