|
|
@ -422,6 +422,13 @@ get "/embed/:id" do |env|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
listen ||= false
|
|
|
|
listen ||= false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
raw = env.params.query["raw"]? && env.params.query["raw"].to_i
|
|
|
|
|
|
|
|
raw ||= 0
|
|
|
|
|
|
|
|
raw = raw == 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
quality = env.params.query["quality"]? && env.params.query["quality"]
|
|
|
|
|
|
|
|
quality ||= "hd720"
|
|
|
|
|
|
|
|
|
|
|
|
autoplay = env.params.query["autoplay"]?.try &.to_i
|
|
|
|
autoplay = env.params.query["autoplay"]?.try &.to_i
|
|
|
|
autoplay ||= 0
|
|
|
|
autoplay ||= 0
|
|
|
|
|
|
|
|
|
|
|
@ -472,6 +479,18 @@ get "/embed/:id" do |env|
|
|
|
|
stream["bitrate"] = (stream["bitrate"].to_f64/1000).to_i.to_s
|
|
|
|
stream["bitrate"] = (stream["bitrate"].to_f64/1000).to_i.to_s
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if raw
|
|
|
|
|
|
|
|
url = fmt_stream[0]["url"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fmt_stream.each do |fmt|
|
|
|
|
|
|
|
|
if fmt["label"].split(" - ")[0] == quality
|
|
|
|
|
|
|
|
url = fmt["url"]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
next env.redirect url
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
thumbnail = "https://i.ytimg.com/vi/#{id}/mqdefault.jpg"
|
|
|
|
thumbnail = "https://i.ytimg.com/vi/#{id}/mqdefault.jpg"
|
|
|
|
|
|
|
|
|
|
|
|
rendered "embed"
|
|
|
|
rendered "embed"
|
|
|
|