mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Make itag optional under /latest_version
This commit is contained in:
parent
d6dd341594
commit
d57d278f32
1 changed files with 6 additions and 2 deletions
|
@ -256,7 +256,7 @@ module Invidious::Routes::VideoPlayback
|
||||||
return error_template(400, "Invalid video ID")
|
return error_template(400, "Invalid video ID")
|
||||||
end
|
end
|
||||||
|
|
||||||
if itag.nil? || itag <= 0 || itag >= 1000
|
if !itag.nil? && (itag <= 0 || itag >= 1000)
|
||||||
return error_template(400, "Invalid itag")
|
return error_template(400, "Invalid itag")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -277,7 +277,11 @@ module Invidious::Routes::VideoPlayback
|
||||||
return error_template(500, ex)
|
return error_template(500, ex)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if itag.nil?
|
||||||
|
fmt = video.fmt_stream[-1]
|
||||||
|
else
|
||||||
fmt = video.fmt_stream.find(nil) { |f| f["itag"].as_i == itag } || video.adaptive_fmts.find(nil) { |f| f["itag"].as_i == itag }
|
fmt = video.fmt_stream.find(nil) { |f| f["itag"].as_i == itag } || video.adaptive_fmts.find(nil) { |f| f["itag"].as_i == itag }
|
||||||
|
end
|
||||||
url = fmt.try &.["url"]?.try &.as_s
|
url = fmt.try &.["url"]?.try &.as_s
|
||||||
|
|
||||||
if !url
|
if !url
|
||||||
|
|
Loading…
Reference in a new issue