mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-15 09:35:09 +00:00
API: make /api/v1/videos respect the 'local' parameter
This commit is contained in:
@@ -3,7 +3,7 @@ require "json"
|
||||
module Invidious::JSONify::APIv1
|
||||
extend self
|
||||
|
||||
def video(video : Video, json : JSON::Builder, *, locale : String?)
|
||||
def video(video : Video, json : JSON::Builder, *, locale : String?, proxy : Bool = false)
|
||||
json.object do
|
||||
json.field "type", video.video_type
|
||||
|
||||
@@ -89,7 +89,14 @@ module Invidious::JSONify::APIv1
|
||||
# Not available on MPEG-4 Timed Text (`text/mp4`) streams (livestreams only)
|
||||
json.field "bitrate", fmt["bitrate"].as_i.to_s if fmt["bitrate"]?
|
||||
|
||||
json.field "url", fmt["url"]
|
||||
if proxy
|
||||
json.field "url", Invidious::HttpServer::Utils.proxy_video_url(
|
||||
fmt["url"].to_s, absolute: true
|
||||
)
|
||||
else
|
||||
json.field "url", fmt["url"]
|
||||
end
|
||||
|
||||
json.field "itag", fmt["itag"].as_i.to_s
|
||||
json.field "type", fmt["mimeType"]
|
||||
json.field "clen", fmt["contentLength"]? || "-1"
|
||||
|
||||
Reference in New Issue
Block a user