Invidious is an alternative front-end to YouTube
Add '/watch_videos' endpoint
Omar Rothdbd5a222d582
diff --git a/src/invidious.cr b/src/invidious.crindex 1603f4e6..4e70220c 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -5256,6 +5256,19 @@ get "/vi/:id/:name" do |env|endend+# 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"]