From 1a7c9fad9f89b8994911c7d83f012da5f1aef445 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 2 Sep 2022 20:41:39 +0530 Subject: [PATCH] [jsinterp] Workaround operator associativity issue https://github.com/yt-dlp/yt-dlp/issues/4635#issuecomment-1235384480 --- test/test_youtube_signature.py | 4 ++++ yt_dlp/jsinterp.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test_youtube_signature.py b/test/test_youtube_signature.py index b1c5cb2b3..c3dcb4d68 100644 --- a/test/test_youtube_signature.py +++ b/test/test_youtube_signature.py @@ -126,6 +126,10 @@ _NSIG_TESTS = [ 'https://www.youtube.com/s/player/c57c113c/player_ias.vflset/en_US/base.js', 'M92UUMHa8PdvPd3wyM', '3hPqLJsiNZx7yA', ), + ( + 'https://www.youtube.com/s/player/5a3b6271/player_ias.vflset/en_US/base.js', + 'B2j7f_UPT4rfje85Lu_e', 'm5DmNymaGQ5RdQ', + ), ] diff --git a/yt_dlp/jsinterp.py b/yt_dlp/jsinterp.py index 2bb4acf3e..4caad6f74 100644 --- a/yt_dlp/jsinterp.py +++ b/yt_dlp/jsinterp.py @@ -117,8 +117,8 @@ _OPERATORS = { # None => Defined in JSInterpreter._operator '-': _js_arith_op(operator.sub), '*': _js_arith_op(operator.mul), - '/': _js_div, '%': _js_mod, + '/': _js_div, '**': _js_exp, }