fixed tests
Browse files- pytube/extract.py +12 -9
pytube/extract.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
"""This module contains all non-cipher related data extraction logic."""
|
3 |
import json
|
|
|
4 |
|
5 |
from pytube.compat import quote
|
6 |
from pytube.compat import urlencode
|
@@ -43,15 +44,17 @@ def video_info_url(video_id, watch_url, watch_html):
|
|
43 |
# boolean.
|
44 |
pattern = r'\W[\'"]?t[\'"]?: ?[\'"](.+?)[\'"]'
|
45 |
t = regex_search(pattern, watch_html, group=0)
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
'
|
50 |
-
'
|
51 |
-
'
|
52 |
-
'
|
53 |
-
|
54 |
-
|
|
|
|
|
55 |
|
56 |
|
57 |
def js_url(watch_html):
|
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
"""This module contains all non-cipher related data extraction logic."""
|
3 |
import json
|
4 |
+
from collections import OrderedDict
|
5 |
|
6 |
from pytube.compat import quote
|
7 |
from pytube.compat import urlencode
|
|
|
44 |
# boolean.
|
45 |
pattern = r'\W[\'"]?t[\'"]?: ?[\'"](.+?)[\'"]'
|
46 |
t = regex_search(pattern, watch_html, group=0)
|
47 |
+
# Here we use ``OrderedDict`` so that the output is consistant between
|
48 |
+
# Python 2.7+.
|
49 |
+
params = OrderedDict([
|
50 |
+
('video_id', video_id),
|
51 |
+
('el', '$el'),
|
52 |
+
('ps', 'default'),
|
53 |
+
('eurl', quote(watch_url)),
|
54 |
+
('hl', 'en_US'),
|
55 |
+
('t', quote(t)),
|
56 |
+
])
|
57 |
+
return 'https://youtube.com/get_video_info?' + urlencode(params)
|
58 |
|
59 |
|
60 |
def js_url(watch_html):
|