[ie/youtube] Add age-gate workaround for some embeddable videos (#11821)
[yt-dlp.git] / yt_dlp / utils / _deprecated.py
blobe4762699b792e1bf3028ecf2d1764cf8ca0ec670
1 """Deprecated - New code should avoid these"""
2 import warnings
4 from ..compat.compat_utils import passthrough_module
6 # XXX: Implement this the same way as other DeprecationWarnings without circular import
7 passthrough_module(__name__, '.._legacy', callback=lambda attr: warnings.warn(
8 DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=6))
9 del passthrough_module
12 import re
13 import struct
16 def bytes_to_intlist(bs):
17 if not bs:
18 return []
19 if isinstance(bs[0], int): # Python 3
20 return list(bs)
21 else:
22 return [ord(c) for c in bs]
25 def intlist_to_bytes(xs):
26 if not xs:
27 return b''
28 return struct.pack('%dB' % len(xs), *xs)
31 compiled_regex_type = type(re.compile(''))