mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-29 00:10:35 +05:30
Merge pull request #651 from TeamNewPipe/fix/streamType
[YouTube] Fix getting stream type of live streams
This commit is contained in:
commit
0cb48e36bd
@ -62,16 +62,21 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final JsonArray badges = videoInfo.getArray("badges");
|
final JsonArray badges = videoInfo.getArray("badges");
|
||||||
for (Object badge : badges) {
|
for (final Object badge : badges) {
|
||||||
if (((JsonObject) badge).getObject("metadataBadgeRenderer").getString("label", EMPTY_STRING).equals("LIVE NOW")) {
|
if (((JsonObject) badge).getObject("metadataBadgeRenderer")
|
||||||
|
.getString("label", EMPTY_STRING).equals("LIVE NOW")) {
|
||||||
return cachedStreamType = StreamType.LIVE_STREAM;
|
return cachedStreamType = StreamType.LIVE_STREAM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final String style = videoInfo.getArray("thumbnailOverlays").getObject(0)
|
final JsonArray thumbnailOverlays = videoInfo.getArray("thumbnailOverlays");
|
||||||
.getObject("thumbnailOverlayTimeStatusRenderer").getString("style", EMPTY_STRING);
|
for (final Object object : thumbnailOverlays) {
|
||||||
if (style.equalsIgnoreCase("LIVE")) {
|
final JsonObject thumbnailOverlay = (JsonObject) object;
|
||||||
return cachedStreamType = StreamType.LIVE_STREAM;
|
if (thumbnailOverlay.has("thumbnailOverlayNowPlayingRenderer")
|
||||||
|
|| thumbnailOverlay.getObject("thumbnailOverlayTimeStatusRenderer")
|
||||||
|
.getString("style", EMPTY_STRING).equalsIgnoreCase("LIVE")) {
|
||||||
|
return cachedStreamType = StreamType.LIVE_STREAM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cachedStreamType = StreamType.VIDEO_STREAM;
|
return cachedStreamType = StreamType.VIDEO_STREAM;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user