diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-02-03 14:41:59 -0600 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-02-03 14:41:59 -0600 |
| commit | 1e2139d78c41f4e5facb1d2b4cf9c270a96544ff (patch) | |
| tree | 2038dc88548a5981faa268aea4f4fd9b43ff0b7d /src | |
| parent | 859517e2067c4ea889d9769021de927cff9b8361 (diff) | |
| download | invidious-1e2139d78c41f4e5facb1d2b4cf9c270a96544ff.tar.gz invidious-1e2139d78c41f4e5facb1d2b4cf9c270a96544ff.tar.bz2 invidious-1e2139d78c41f4e5facb1d2b4cf9c270a96544ff.zip | |
Add ability to decrypt signature for vflxuxnEY/en_US/base.js
Diffstat (limited to 'src')
| -rw-r--r-- | src/helpers.cr | 10 | ||||
| -rw-r--r-- | src/invidious.cr | 15 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/helpers.cr b/src/helpers.cr index 1ababddf..1afe7674 100644 --- a/src/helpers.cr +++ b/src/helpers.cr @@ -163,3 +163,13 @@ def search(query, client) end end end + +def decrypt_signature(a) + a = a.split(""); + a.delete_at(0..2) + a = a.reverse + c = a[0] + a[0] = a[49 % a.size] + a[49] = c + return a.join("") +end
\ No newline at end of file diff --git a/src/invidious.cr b/src/invidious.cr index 373d224a..39587989 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -126,7 +126,14 @@ get "/watch" do |env| fmt_stream << HTTP::Params.parse(string) end - fmt_stream.reverse! # We want lowest quality first + if fmt_stream[0]["s"]? + fmt_stream.each do |fmt| + fmt["url"] = "#{fmt["url"]}&signature=#{decrypt_signature(fmt["s"])}" + end + end + + # We want lowest quality first + fmt_stream.reverse! adaptive_fmts = [] of HTTP::Params if video.info.has_key?("adaptive_fmts") @@ -135,6 +142,12 @@ get "/watch" do |env| end end + if adaptive_fmts[0]["s"]? + adaptive_fmts.each do |fmt| + fmt["url"] = "#{fmt["url"]}&signature=#{decrypt_signature(fmt["s"])}" + end + end + rvs = [] of Hash(String, String) if video.info.has_key?("rvs") video.info["rvs"].split(",").each do |rv| |
