forked from midou/invidious
Add note for livestreams that haven't started
This commit is contained in:
parent
1611ee83a6
commit
55f8fd0b58
@ -279,6 +279,12 @@ get "/watch" do |env|
|
||||
rating = video.info["avg_rating"].to_f64
|
||||
engagement = ((video.dislikes.to_f + video.likes.to_f)/video.views * 100)
|
||||
|
||||
playability_status = video.player_response["playabilityStatus"]?
|
||||
if playability_status && playability_status["status"] == "LIVE_STREAM_OFFLINE"
|
||||
reason = playability_status["reason"]?.try &.as_s
|
||||
end
|
||||
reason ||= ""
|
||||
|
||||
templated "watch"
|
||||
end
|
||||
|
||||
|
@ -228,6 +228,8 @@ VIDEO_FORMATS = {
|
||||
}
|
||||
|
||||
class Video
|
||||
property player_json : JSON::Any?
|
||||
|
||||
module HTTPParamConverter
|
||||
def self.from_rs(rs)
|
||||
HTTP::Params.parse(rs.read(String))
|
||||
@ -287,9 +289,15 @@ class Video
|
||||
return audio_streams
|
||||
end
|
||||
|
||||
def captions
|
||||
player_response = JSON.parse(self.info["player_response"])
|
||||
def player_response
|
||||
if !@player_json
|
||||
@player_json = JSON.parse(@info["player_response"])
|
||||
end
|
||||
|
||||
return @player_json.not_nil!
|
||||
end
|
||||
|
||||
def captions
|
||||
captions = [] of Caption
|
||||
if player_response["captions"]?
|
||||
caption_list = player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"]?.try &.as_a
|
||||
|
@ -196,6 +196,9 @@ get_youtube_comments();
|
||||
</a>
|
||||
<% end %>
|
||||
</h1>
|
||||
<% if !reason.empty? %>
|
||||
<h3><%= reason %></h3>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="pure-g">
|
||||
|
Loading…
Reference in New Issue
Block a user