Skip to content

Commit

Permalink
[JSInterp] Fix bit-shift coercion for player 9c6dfc4a
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkf committed Feb 6, 2025
1 parent c866c83 commit 004a07f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/test_jsinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ def test_bitwise_operators_typecast(self):
self._test('function f(){return undefined >> 5}', 0)
self._test('function f(){return 42 << NaN}', 42)
self._test('function f(){return 42 << Infinity}', 42)
self._test('function f(){return 0.0 << null}', 0)
self._test('function f(){return NaN << 42}', 0)
self._test('function f(){return "21.9" << 1}', 42)
self._test('function f(){return 21 << 4294967297}', 42)

def test_negative(self):
self._test('function f(){return 2 * -2.0 ;}', -4)
Expand Down
4 changes: 4 additions & 0 deletions test/test_youtube_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@
'https://www.youtube.com/s/player/2f1832d2/player_ias.vflset/en_US/base.js',
'YWt1qdbe8SAfkoPHW5d', 'RrRjWQOJmBiP',
),
(
'https://www.youtube.com/s/player/9c6dfc4a/player_ias.vflset/en_US/base.js',
'jbu7ylIosQHyJyJV', 'uwI0ESiynAmhNg',
),
]


Expand Down
5 changes: 5 additions & 0 deletions youtube_dl/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3116,17 +3116,21 @@ def compat_kwargs(kwargs):
compat_kwargs = lambda kwargs: kwargs


# compat_numeric_types
try:
compat_numeric_types = (int, float, long, complex)
except NameError: # Python 3
compat_numeric_types = (int, float, complex)


# compat_integer_types
try:
compat_integer_types = (int, long)
except NameError: # Python 3
compat_integer_types = (int, )

# compat_int
compat_int = compat_integer_types[-1]

if sys.version_info < (2, 7):
def compat_socket_create_connection(address, timeout, source_address=None):
Expand Down Expand Up @@ -3532,6 +3536,7 @@ def compat_datetime_timedelta_total_seconds(td):
'compat_http_client',
'compat_http_server',
'compat_input',
'compat_int',
'compat_integer_types',
'compat_itertools_count',
'compat_itertools_zip_longest',
Expand Down

0 comments on commit 004a07f

Please sign in to comment.