mirror of
https://github.com/iv-org/invidious.git
synced 2024-10-01 01:25:56 -04:00
Fix parsing live_now and premiere_timestamp
This commit is contained in:
parent
a021b93063
commit
b2a83991d1
@ -224,8 +224,17 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
|
|||||||
premiere_timestamp = microformat.dig?("liveBroadcastDetails", "startTimestamp")
|
premiere_timestamp = microformat.dig?("liveBroadcastDetails", "startTimestamp")
|
||||||
.try { |t| Time.parse_rfc3339(t.as_s) }
|
.try { |t| Time.parse_rfc3339(t.as_s) }
|
||||||
|
|
||||||
|
premiere_timestamp ||= player_response.dig?(
|
||||||
|
"playabilityStatus", "liveStreamability",
|
||||||
|
"liveStreamabilityRenderer", "offlineSlate",
|
||||||
|
"liveStreamOfflineSlateRenderer", "scheduledStartTime"
|
||||||
|
)
|
||||||
|
.try &.as_s.to_i64
|
||||||
|
.try { |t| Time.unix(t) }
|
||||||
|
|
||||||
live_now = microformat.dig?("liveBroadcastDetails", "isLiveNow")
|
live_now = microformat.dig?("liveBroadcastDetails", "isLiveNow")
|
||||||
.try &.as_bool || false
|
.try &.as_bool
|
||||||
|
live_now ||= video_details.dig?("isLive").try &.as_bool || false
|
||||||
|
|
||||||
post_live_dvr = video_details.dig?("isPostLiveDvr")
|
post_live_dvr = video_details.dig?("isPostLiveDvr")
|
||||||
.try &.as_bool || false
|
.try &.as_bool || false
|
||||||
|
Loading…
Reference in New Issue
Block a user