mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-08-31 23:50:12 +02:00
[compat] Fix missing _asciire on python 2.6
This commit is contained in:
parent
6b19647d57
commit
3cc8b4c327
|
@ -79,6 +79,8 @@
|
|||
from urllib.parse import unquote as compat_urllib_parse_unquote
|
||||
from urllib.parse import unquote_plus as compat_urllib_parse_unquote_plus
|
||||
except ImportError: # Python 2
|
||||
_asciire = re.compile('([\x00-\x7f]+)') if sys.version_info < (2, 7) else compat_urllib_parse._asciire
|
||||
|
||||
# HACK: The following are the correct unquote_to_bytes, unquote and unquote_plus
|
||||
# implementations from cpython 3.4.3's stdlib. Python 2's version
|
||||
# is apparently broken (see https://github.com/rg3/youtube-dl/pull/6244)
|
||||
|
@ -124,7 +126,7 @@ def compat_urllib_parse_unquote(string, encoding='utf-8', errors='replace'):
|
|||
encoding = 'utf-8'
|
||||
if errors is None:
|
||||
errors = 'replace'
|
||||
bits = compat_urllib_parse._asciire.split(string)
|
||||
bits = _asciire.split(string)
|
||||
res = [bits[0]]
|
||||
append = res.append
|
||||
for i in range(1, len(bits), 2):
|
||||
|
|
Loading…
Reference in New Issue
Block a user