mirror of
https://github.com/iv-org/invidious.git
synced 2024-10-01 01:25:56 -04:00
Merge changes
This commit is contained in:
commit
daba77d665
@ -121,20 +121,30 @@ get "/watch" do |env|
|
|||||||
next templated "error"
|
next templated "error"
|
||||||
end
|
end
|
||||||
|
|
||||||
player_response = JSON.parse(video.info["player_response"])
|
|
||||||
|
|
||||||
fmt_stream = [] of HTTP::Params
|
fmt_stream = [] of HTTP::Params
|
||||||
video.info["url_encoded_fmt_stream_map"].split(",") do |string|
|
video.info["url_encoded_fmt_stream_map"].split(",") do |string|
|
||||||
fmt_stream << HTTP::Params.parse(string)
|
fmt_stream << HTTP::Params.parse(string)
|
||||||
end
|
end
|
||||||
|
|
||||||
fmt_stream.reverse! # We want lowest quality first
|
fmt_stream.reverse! # We want lowest quality first
|
||||||
|
|
||||||
adaptive_fmts = [] of HTTP::Params
|
adaptive_fmts = [] of HTTP::Params
|
||||||
video.info["adaptive_fmts"].split(",") do |string|
|
if video.info.has_key?("adaptive_fmts")
|
||||||
adaptive_fmts << HTTP::Params.parse(string)
|
video.info["adaptive_fmts"].split(",") do |string|
|
||||||
|
adaptive_fmts << HTTP::Params.parse(string)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rvs = [] of Hash(String, String)
|
||||||
|
if video.info.has_key?("rvs")
|
||||||
|
video.info["rvs"].split(",").each do |rv|
|
||||||
|
rvs << HTTP::Params.parse(rv).to_h
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
player_response = JSON.parse(video.info["player_response"])
|
||||||
|
|
||||||
likes = video.html.xpath_node(%q(//button[@title="I like this"]/span))
|
likes = video.html.xpath_node(%q(//button[@title="I like this"]/span))
|
||||||
likes = likes ? likes.content.delete(",").to_i : 1
|
likes = likes ? likes.content.delete(",").to_i : 1
|
||||||
|
|
||||||
@ -150,11 +160,6 @@ get "/watch" do |env|
|
|||||||
engagement = ((dislikes.to_f + likes.to_f)/views * 100)
|
engagement = ((dislikes.to_f + likes.to_f)/views * 100)
|
||||||
calculated_rating = (likes.to_f/(likes.to_f + dislikes.to_f) * 4 + 1)
|
calculated_rating = (likes.to_f/(likes.to_f + dislikes.to_f) * 4 + 1)
|
||||||
|
|
||||||
rvs = [] of Hash(String, String)
|
|
||||||
video.info["rvs"].split(",").each do |rv|
|
|
||||||
rvs << HTTP::Params.parse(rv).to_h
|
|
||||||
end
|
|
||||||
|
|
||||||
templated "watch"
|
templated "watch"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user