diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-08-05 14:03:13 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-08-05 14:03:13 -0500 |
| commit | 8c22c226c0e6aba62709153bbc0dc8f9bd5d4475 (patch) | |
| tree | 0d7c607bad3390b852f14d0879cfd5905c1ec29b /src | |
| parent | 61f9e8667c4857aff59a7a9b2ce595badd3d36a3 (diff) | |
| download | invidious-8c22c226c0e6aba62709153bbc0dc8f9bd5d4475.tar.gz invidious-8c22c226c0e6aba62709153bbc0dc8f9bd5d4475.tar.bz2 invidious-8c22c226c0e6aba62709153bbc0dc8f9bd5d4475.zip | |
Add 'raw=1' to '/watch' page
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 70e243a7..111f0cbf 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -193,7 +193,7 @@ get "/watch" do |env| end subscriptions ||= [] of String - autoplay, video_loop, video_start, video_end, listen = process_video_params(env.params.query, preferences) + autoplay, video_loop, video_start, video_end, listen, raw, quality, autoplay = process_video_params(env.params.query, preferences) if listen env.params.query.delete_all("listen") end @@ -228,6 +228,18 @@ get "/watch" do |env| # TODO: Find highest resolution thumbnail automatically thumbnail = "https://i.ytimg.com/vi/#{video.id}/mqdefault.jpg" + if raw + url = fmt_stream[0]["url"] + + fmt_stream.each do |fmt| + if fmt["label"].split(" - ")[0] == quality + url = fmt["url"] + end + end + + next env.redirect url + end + rvs = [] of Hash(String, String) if video.info.has_key?("rvs") video.info["rvs"].split(",").each do |rv| |
