Skip to content

Commit

Permalink
Go through all badges when checking if a StreamInfoItem is a live stream
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiGr committed Mar 1, 2020
1 parent 830b7d3 commit 3525223
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ public YoutubeStreamInfoItemExtractor(JsonObject videoInfoItem, @Nullable TimeAg
@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;
}
Expand Down

0 comments on commit 3525223

Please sign in to comment.