mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-18 12:14:27 -05:00
Add '/watch_videos' endpoint
This commit is contained in:
parent
bba80bc80f
commit
dbd5a222d5
@ -5256,6 +5256,19 @@ get "/vi/:id/:name" do |env|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Undocumented, creates anonymous playlist with specified `video_ids`
|
||||||
|
get "/watch_videos" do |env|
|
||||||
|
client = make_client(YT_URL)
|
||||||
|
|
||||||
|
response = client.get("#{env.request.path}?#{env.request.query}")
|
||||||
|
if url = response.headers["Location"]?
|
||||||
|
url = URI.parse(url).full_path
|
||||||
|
next env.redirect url
|
||||||
|
end
|
||||||
|
|
||||||
|
env.response.status_code = response.status_code
|
||||||
|
end
|
||||||
|
|
||||||
error 404 do |env|
|
error 404 do |env|
|
||||||
if md = env.request.path.match(/^\/(?<id>([a-zA-Z0-9_-]{11})|(\w+))$/)
|
if md = env.request.path.match(/^\/(?<id>([a-zA-Z0-9_-]{11})|(\w+))$/)
|
||||||
item = md["id"]
|
item = md["id"]
|
||||||
|
Loading…
Reference in New Issue
Block a user