compat issues
Browse files- pytube/compat.py +10 -9
pytube/compat.py
CHANGED
@@ -27,14 +27,6 @@ if PY2:
|
|
27 |
"""Encode a string to utf-8."""
|
28 |
return s.encode('utf-8')
|
29 |
|
30 |
-
elif PY33:
|
31 |
-
from html.parser import HTMLParser
|
32 |
-
|
33 |
-
def unescape(s):
|
34 |
-
"""Strip HTML entries from a string."""
|
35 |
-
html_parser = HTMLParser()
|
36 |
-
return html_parser.unescape(s)
|
37 |
-
|
38 |
elif PY3:
|
39 |
from urllib.error import URLError
|
40 |
from urllib.parse import parse_qsl
|
@@ -42,8 +34,17 @@ elif PY3:
|
|
42 |
from urllib.parse import unquote
|
43 |
from urllib.parse import urlencode
|
44 |
from urllib.request import urlopen
|
45 |
-
from html import unescape
|
46 |
|
47 |
def unicode(s):
|
48 |
"""No-op."""
|
49 |
return s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
"""Encode a string to utf-8."""
|
28 |
return s.encode('utf-8')
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
elif PY3:
|
31 |
from urllib.error import URLError
|
32 |
from urllib.parse import parse_qsl
|
|
|
34 |
from urllib.parse import unquote
|
35 |
from urllib.parse import urlencode
|
36 |
from urllib.request import urlopen
|
|
|
37 |
|
38 |
def unicode(s):
|
39 |
"""No-op."""
|
40 |
return s
|
41 |
+
|
42 |
+
if PY33:
|
43 |
+
from html.parser import HTMLParser
|
44 |
+
|
45 |
+
def unescape(s):
|
46 |
+
"""Strip HTML entries from a string."""
|
47 |
+
html_parser = HTMLParser()
|
48 |
+
return html_parser.unescape(s)
|
49 |
+
else:
|
50 |
+
from html import unescape
|