diff options
| author | Omar Roth <omarroth@protonmail.com> | 2019-05-03 09:11:27 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@protonmail.com> | 2019-05-03 09:11:38 -0500 |
| commit | dbd5a222d5828b3b9f88cfd3d88fda34c60502cc (patch) | |
| tree | fa459d2b834ed2834c2d9e75e2254dd34c7814ec | |
| parent | bba80bc80f5408af9ab8a3708d44712b8df4d701 (diff) | |
| download | invidious-dbd5a222d5828b3b9f88cfd3d88fda34c60502cc.tar.gz invidious-dbd5a222d5828b3b9f88cfd3d88fda34c60502cc.tar.bz2 invidious-dbd5a222d5828b3b9f88cfd3d88fda34c60502cc.zip | |
Add '/watch_videos' endpoint
| -rw-r--r-- | src/invidious.cr | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 1603f4e6..4e70220c 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -5256,6 +5256,19 @@ get "/vi/:id/:name" do |env| 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| if md = env.request.path.match(/^\/(?<id>([a-zA-Z0-9_-]{11})|(\w+))$/) item = md["id"] |
