X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fcompat.py;h=0c57c7aebf6bd45a8f9edfc7e1d585f1bbf2f23a;hb=40a2d17052e9b542eb3c360a0ce067d244e07fb4;hp=e950a4688f023776093f950921123b8e75cc8c7a;hpb=4d08161ac23cfdf563b5d79b9f75cde6e6e57178;p=youtube-dl diff --git a/youtube_dl/compat.py b/youtube_dl/compat.py index e950a4688..0c57c7aeb 100644 --- a/youtube_dl/compat.py +++ b/youtube_dl/compat.py @@ -79,6 +79,9 @@ try: 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 = (compat_urllib_parse._asciire if hasattr(compat_urllib_parse, '_asciire') + else re.compile('([\x00-\x7f]+)')) + # 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 +127,7 @@ except ImportError: # Python 2 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):