0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-25 02:45:12 +00:00

[jsinterp] Handle Date at epoch 0

Closes #6400
This commit is contained in:
pukkandan 2023-03-03 16:48:54 +05:30
parent 40d77d8902
commit 9acf1ee25f
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
2 changed files with 7 additions and 3 deletions

View file

@ -66,6 +66,10 @@
] ]
_NSIG_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', 'https://www.youtube.com/s/player/9216d1f7/player_ias.vflset/en_US/base.js',
'SLp9F5bwjAdhE9F-', 'gWnb9IK2DJ8Q1w', 'SLp9F5bwjAdhE9F-', 'gWnb9IK2DJ8Q1w',

View file

@ -355,11 +355,11 @@ def interpret_statement(self, stmt, local_vars, allow_recursion=100):
obj = expr[4:] obj = expr[4:]
if obj.startswith('Date('): if obj.startswith('Date('):
left, right = self._separate_at_paren(obj[4:]) left, right = self._separate_at_paren(obj[4:])
expr = unified_timestamp( date = unified_timestamp(
self.interpret_expression(left, local_vars, allow_recursion), False) self.interpret_expression(left, local_vars, allow_recursion), False)
if not expr: if date is None:
raise self.Exception(f'Failed to parse date {left!r}', expr) raise self.Exception(f'Failed to parse date {left!r}', expr)
expr = self._dump(int(expr * 1000), local_vars) + right expr = self._dump(int(date * 1000), local_vars) + right
else: else:
raise self.Exception(f'Unsupported object {obj}', expr) raise self.Exception(f'Unsupported object {obj}', expr)