[jsinterp] Handle `Date` at epoch 0
authorpukkandan <pukkandan.ytdlp@gmail.com>
Fri, 3 Mar 2023 11:18:54 +0000 (16:48 +0530)
committerdirkf <fieldhouse@gmx.net>
Fri, 3 Mar 2023 15:02:15 +0000 (15:02 +0000)
See yt-dlp/yt_dlp#6400

test/test_youtube_signature.py
youtube_dl/jsinterp.py

index ac37ffa4533cee4fe42353a3f1c2ffb1e9a01ffd..decf7ee38ee6755f75451f8e02867f54d9df4f6f 100644 (file)
@@ -67,6 +67,10 @@ _SIG_TESTS = [
 ]
 
 _NSIG_TESTS = [
+    (
+        'https://www.youtube.com/s/player/7862ca1f/player_ias.vflset/en_US/base.js',
+        'X_LCxVDjAavgE5t', 'yxJ1dM6iz5ogUg',
+    ),
     (
         'https://www.youtube.com/s/player/9216d1f7/player_ias.vflset/en_US/base.js',
         'SLp9F5bwjAdhE9F-', 'gWnb9IK2DJ8Q1w',
index a3bc42a61634569c7d4b49639d71e4476076a0e0..e28670a3f3de2bcc4c093ec8164de4909b5653fa 100644 (file)
@@ -405,7 +405,7 @@ class JSInterpreter(object):
                 left, right = self._separate_at_paren(obj[len(klass):])
                 argvals = self.interpret_iter(left, local_vars, allow_recursion)
                 expr = konstr(*argvals)
-                if not expr:
+                if expr is None:
                     raise self.Exception('Failed to parse {klass} {left!r:.100}'.format(**locals()), expr=expr)
                 expr = self._dump(expr, local_vars) + right
                 break