Fix audio mode for raw URLs

pull/577/head
Omar Roth 6 years ago
parent 0338fd42e1
commit 8cecce7570
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

@ -470,11 +470,23 @@ get "/watch" do |env|
thumbnail = "/vi/#{video.id}/maxres.jpg" thumbnail = "/vi/#{video.id}/maxres.jpg"
if params.raw if params.raw
url = fmt_stream[0]["url"] if params.listen
url = audio_streams[0]["url"]
audio_streams.each do |fmt|
pp fmt["bitrate"]
pp params.quality.rchop("k")
if fmt["bitrate"] == params.quality.rchop("k")
url = fmt["url"]
end
end
else
url = fmt_stream[0]["url"]
fmt_stream.each do |fmt| fmt_stream.each do |fmt|
if fmt["label"].split(" - ")[0] == params.quality if fmt["label"].split(" - ")[0] == params.quality
url = fmt["url"] url = fmt["url"]
end
end end
end end

Loading…
Cancel
Save