diff options
| author | absidue <48293849+absidue@users.noreply.github.com> | 2024-09-20 18:46:00 +0200 |
|---|---|---|
| committer | absidue <48293849+absidue@users.noreply.github.com> | 2024-09-20 18:46:00 +0200 |
| commit | b2a83991d16cc9fa65f71309cd4a745f005cdf61 (patch) | |
| tree | bced0e4f81f754d2cb452be1b8422582e569edc7 | |
| parent | a021b93063f3956fc9bb3cce0fb56ea252422738 (diff) | |
| download | invidious-b2a83991d16cc9fa65f71309cd4a745f005cdf61.tar.gz invidious-b2a83991d16cc9fa65f71309cd4a745f005cdf61.tar.bz2 invidious-b2a83991d16cc9fa65f71309cd4a745f005cdf61.zip | |
Fix parsing live_now and premiere_timestamp
| -rw-r--r-- | src/invidious/videos/parser.cr | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/invidious/videos/parser.cr b/src/invidious/videos/parser.cr index 811a0a03..c28ba634 100644 --- a/src/invidious/videos/parser.cr +++ b/src/invidious/videos/parser.cr @@ -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 |
