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
|
rating = video.info["avg_rating"].to_f64
|
||||||
engagement = ((video.dislikes.to_f + video.likes.to_f)/video.views * 100)
|
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"
|
templated "watch"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -228,6 +228,8 @@ VIDEO_FORMATS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Video
|
class Video
|
||||||
|
property player_json : JSON::Any?
|
||||||
|
|
||||||
module HTTPParamConverter
|
module HTTPParamConverter
|
||||||
def self.from_rs(rs)
|
def self.from_rs(rs)
|
||||||
HTTP::Params.parse(rs.read(String))
|
HTTP::Params.parse(rs.read(String))
|
||||||
@ -287,9 +289,15 @@ class Video
|
|||||||
return audio_streams
|
return audio_streams
|
||||||
end
|
end
|
||||||
|
|
||||||
def captions
|
def player_response
|
||||||
player_response = JSON.parse(self.info["player_response"])
|
if !@player_json
|
||||||
|
@player_json = JSON.parse(@info["player_response"])
|
||||||
|
end
|
||||||
|
|
||||||
|
return @player_json.not_nil!
|
||||||
|
end
|
||||||
|
|
||||||
|
def captions
|
||||||
captions = [] of Caption
|
captions = [] of Caption
|
||||||
if player_response["captions"]?
|
if player_response["captions"]?
|
||||||
caption_list = player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"]?.try &.as_a
|
caption_list = player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"]?.try &.as_a
|
||||||
|
@ -196,6 +196,9 @@ get_youtube_comments();
|
|||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</h1>
|
</h1>
|
||||||
|
<% if !reason.empty? %>
|
||||||
|
<h3><%= reason %></h3>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
|
Loading…
Reference in New Issue
Block a user