Parse if video is post live dvr and include it in API
This commit is contained in:
parent
08390acd0c
commit
bfd9c9876e
3 changed files with 9 additions and 0 deletions
|
@ -62,6 +62,7 @@ module Invidious::JSONify::APIv1
|
||||||
json.field "rating", 0_i64
|
json.field "rating", 0_i64
|
||||||
json.field "isListed", video.is_listed
|
json.field "isListed", video.is_listed
|
||||||
json.field "liveNow", video.live_now
|
json.field "liveNow", video.live_now
|
||||||
|
json.field "isPostLiveDvr", video.post_live_dvr
|
||||||
json.field "isUpcoming", video.is_upcoming
|
json.field "isUpcoming", video.is_upcoming
|
||||||
|
|
||||||
if video.premiere_timestamp
|
if video.premiere_timestamp
|
||||||
|
|
|
@ -82,6 +82,10 @@ struct Video
|
||||||
return (self.video_type == VideoType::Livestream)
|
return (self.video_type == VideoType::Livestream)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def post_live_dvr
|
||||||
|
return info["isPostLiveDvr"].as_bool
|
||||||
|
end
|
||||||
|
|
||||||
def premiere_timestamp : Time?
|
def premiere_timestamp : Time?
|
||||||
info
|
info
|
||||||
.dig?("microformat", "playerMicroformatRenderer", "liveBroadcastDetails", "startTimestamp")
|
.dig?("microformat", "playerMicroformatRenderer", "liveBroadcastDetails", "startTimestamp")
|
||||||
|
|
|
@ -216,6 +216,9 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
|
||||||
live_now = microformat.dig?("liveBroadcastDetails", "isLiveNow")
|
live_now = microformat.dig?("liveBroadcastDetails", "isLiveNow")
|
||||||
.try &.as_bool || false
|
.try &.as_bool || false
|
||||||
|
|
||||||
|
post_live_dvr = video_details.dig?("isPostLiveDvr")
|
||||||
|
.try &.as_bool || false
|
||||||
|
|
||||||
# Extra video infos
|
# Extra video infos
|
||||||
|
|
||||||
allowed_regions = microformat["availableCountries"]?
|
allowed_regions = microformat["availableCountries"]?
|
||||||
|
@ -405,6 +408,7 @@ def parse_video_info(video_id : String, player_response : Hash(String, JSON::Any
|
||||||
"isListed" => JSON::Any.new(is_listed || false),
|
"isListed" => JSON::Any.new(is_listed || false),
|
||||||
"isUpcoming" => JSON::Any.new(is_upcoming || false),
|
"isUpcoming" => JSON::Any.new(is_upcoming || false),
|
||||||
"keywords" => JSON::Any.new(keywords.map { |v| JSON::Any.new(v) }),
|
"keywords" => JSON::Any.new(keywords.map { |v| JSON::Any.new(v) }),
|
||||||
|
"isPostLiveDvr" => JSON::Any.new(post_live_dvr),
|
||||||
# Related videos
|
# Related videos
|
||||||
"relatedVideos" => JSON::Any.new(related),
|
"relatedVideos" => JSON::Any.new(related),
|
||||||
# Description
|
# Description
|
||||||
|
|
Loading…
Reference in a new issue