Merge pull request #658 from TeamNewPipe/revert-651-fix/streamType
[YouTube] Fix getting stream type of live streams
This commit is contained in:
commit
65fd8740aa
|
@ -63,18 +63,17 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
|
||||||
|
|
||||||
final JsonArray badges = videoInfo.getArray("badges");
|
final JsonArray badges = videoInfo.getArray("badges");
|
||||||
for (final Object badge : badges) {
|
for (final Object badge : badges) {
|
||||||
if (((JsonObject) badge).getObject("metadataBadgeRenderer")
|
final JsonObject badgeRenderer = ((JsonObject) badge).getObject("metadataBadgeRenderer");
|
||||||
.getString("label", EMPTY_STRING).equals("LIVE NOW")) {
|
if (badgeRenderer.getString("style", EMPTY_STRING).equals("BADGE_STYLE_TYPE_LIVE_NOW") ||
|
||||||
|
badgeRenderer.getString("label", EMPTY_STRING).equals("LIVE NOW")) {
|
||||||
return cachedStreamType = StreamType.LIVE_STREAM;
|
return cachedStreamType = StreamType.LIVE_STREAM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final JsonArray thumbnailOverlays = videoInfo.getArray("thumbnailOverlays");
|
for (final Object overlay : videoInfo.getArray("thumbnailOverlays")) {
|
||||||
for (final Object object : thumbnailOverlays) {
|
final String style = ((JsonObject) overlay)
|
||||||
final JsonObject thumbnailOverlay = (JsonObject) object;
|
.getObject("thumbnailOverlayTimeStatusRenderer").getString("style", EMPTY_STRING);
|
||||||
if (thumbnailOverlay.has("thumbnailOverlayNowPlayingRenderer")
|
if (style.equalsIgnoreCase("LIVE")) {
|
||||||
|| thumbnailOverlay.getObject("thumbnailOverlayTimeStatusRenderer")
|
|
||||||
.getString("style", EMPTY_STRING).equalsIgnoreCase("LIVE")) {
|
|
||||||
return cachedStreamType = StreamType.LIVE_STREAM;
|
return cachedStreamType = StreamType.LIVE_STREAM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue