diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-01-24 14:11:59 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-01-24 14:11:59 -0800 |
commit | b2a1f4ecfb47746b274481eb2c04c904fdce64f6 (patch) | |
tree | c6c4a1702f93277f7fa47f02bfcb0d078e096e98 /youtube | |
parent | c13a8f677dd0e2fe5e3ee260d51e95665d71ba36 (diff) | |
download | yt-local-b2a1f4ecfb47746b274481eb2c04c904fdce64f6.tar.lz yt-local-b2a1f4ecfb47746b274481eb2c04c904fdce64f6.tar.xz yt-local-b2a1f4ecfb47746b274481eb2c04c904fdce64f6.zip |
Fix signature decryption.
The function body regex was capturing some unrelated new code before the actual function body. Example:
`function(a){a=a.split("");var b=[function(c,d){d=(d%c.length+c.length)%c.length;c.splice(-d).reverse().forEach(function(e){return c.unshift(e)}`
If you look closely, the closing bracket doesn't match the opening one. I have added `{` to the `[^\}]+` part to make sure it only captures matching brackets. Additionally, I've added `return a\.join\(""\)` to the end for good measure.
Diffstat (limited to 'youtube')
-rw-r--r-- | youtube/yt_data_extract/watch_extraction.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/youtube/yt_data_extract/watch_extraction.py b/youtube/yt_data_extract/watch_extraction.py index 3e6dcdf..1609f8d 100644 --- a/youtube/yt_data_extract/watch_extraction.py +++ b/youtube/yt_data_extract/watch_extraction.py @@ -457,7 +457,7 @@ def requires_decryption(info): # adapted from youtube-dl and invidious: # https://github.com/omarroth/invidious/blob/master/src/invidious/helpers/signatures.cr -decrypt_function_re = re.compile(r'function\(a\)\{(a=a\.split\(""\)[^\}]+)\}') +decrypt_function_re = re.compile(r'function\(a\)\{(a=a\.split\(""\)[^\}{]+)return a\.join\(""\)\}') op_with_arg_re = re.compile(r'[^\.]+\.([^\(]+)\(a,(\d+)\)') def extract_decryption_function(info, base_js): '''Insert decryption function into info. Return error string if not successful. |