Skip to content

Commit

Permalink
Fix parsing live_now and premiere_timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue committed Sep 20, 2024
1 parent a021b93 commit 9b3bf67
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/invidious/videos/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,17 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
premiere_timestamp = microformat.dig?("liveBroadcastDetails", "startTimestamp")
.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")
.try &.as_bool || false
.try &.as_bool
live_now ||= video_details.dig?("isLive").try &.as_bool || false

post_live_dvr = video_details.dig?("isPostLiveDvr")
.try &.as_bool || false
Expand Down

0 comments on commit 9b3bf67

Please sign in to comment.