Nick Ficano
commited on
Commit
·
b65fd1b
1
Parent(s):
0b85c2d
compat file for handling py2/py3 urllib stuff
Browse files- pytube/api.py +1 -7
- pytube/compat.py +9 -0
pytube/api.py
CHANGED
@@ -5,13 +5,7 @@ import json
|
|
5 |
import logging
|
6 |
import re
|
7 |
import warnings
|
8 |
-
|
9 |
-
from urllib2 import urlopen
|
10 |
-
from urlparse import urlparse, parse_qs, unquote
|
11 |
-
except ImportError:
|
12 |
-
from urllib.parse import urlparse, parse_qs, unquote
|
13 |
-
from urllib.request import urlopen
|
14 |
-
|
15 |
from .exceptions import MultipleObjectsReturned, PytubeError, CipherError, \
|
16 |
DoesNotExist, AgeRestricted
|
17 |
from .jsinterp import JSInterpreter
|
|
|
5 |
import logging
|
6 |
import re
|
7 |
import warnings
|
8 |
+
from .compat import urlopen, urlparse, parse_qs, unquote
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
from .exceptions import MultipleObjectsReturned, PytubeError, CipherError, \
|
10 |
DoesNotExist, AgeRestricted
|
11 |
from .jsinterp import JSInterpreter
|
pytube/compat.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# -*- coding: utf-8 -*-
|
3 |
+
# flake8: noqa
|
4 |
+
try:
|
5 |
+
from urllib2 import urlopen
|
6 |
+
from urlparse import urlparse, parse_qs, unquote
|
7 |
+
except ImportError:
|
8 |
+
from urllib.parse import urlparse, parse_qs, unquote
|
9 |
+
from urllib.request import urlopen
|