Taylor Fox Dahlin commited on
Commit
9c92997
·
unverified ·
1 Parent(s): a1518e7

Fix/param update (#1025)

Browse files

* Temporary workaround for get_video_info issue by adding more parameters to `get_video_info` call.

Files changed (2) hide show
  1. pytube/extract.py +4 -0
  2. tests/test_extract.py +4 -11
pytube/extract.py CHANGED
@@ -235,6 +235,8 @@ def video_info_url(video_id: str, watch_url: str) -> str:
235
  ("eurl", quote(watch_url)),
236
  ("hl", "en_US"),
237
  ("html5", "1"),
 
 
238
  ]
239
  )
240
  return _video_info_url(params)
@@ -265,6 +267,8 @@ def video_info_url_age_restricted(video_id: str, embed_html: str) -> str:
265
  ("eurl", eurl),
266
  ("sts", sts),
267
  ("html5", "1"),
 
 
268
  ]
269
  )
270
  return _video_info_url(params)
 
235
  ("eurl", quote(watch_url)),
236
  ("hl", "en_US"),
237
  ("html5", "1"),
238
+ ("c", "TVHTML5"),
239
+ ("cver", "7.20201028"),
240
  ]
241
  )
242
  return _video_info_url(params)
 
267
  ("eurl", eurl),
268
  ("sts", sts),
269
  ("html5", "1"),
270
+ ("c", "TVHTML5"),
271
+ ("cver", "7.20201028"),
272
  ]
273
  )
274
  return _video_info_url(params)
tests/test_extract.py CHANGED
@@ -16,11 +16,8 @@ def test_info_url(age_restricted):
16
  video_info_url = extract.video_info_url_age_restricted(
17
  video_id="QRS8MkLhQmM", embed_html=age_restricted["embed_html"],
18
  )
19
- expected = (
20
- "https://www.youtube.com/get_video_info?video_id=QRS8MkLhQmM&eurl"
21
- "=https%3A%2F%2Fyoutube.googleapis.com%2Fv%2FQRS8MkLhQmM&sts=&html5=1"
22
- )
23
- assert video_info_url == expected
24
 
25
 
26
  def test_info_url_age_restricted(cipher_signature):
@@ -28,12 +25,8 @@ def test_info_url_age_restricted(cipher_signature):
28
  video_id=cipher_signature.video_id,
29
  watch_url=cipher_signature.watch_url,
30
  )
31
- expected = (
32
- "https://www.youtube.com/get_video_info?video_id=2lAe1cqCOXo"
33
- "&ps=default&eurl=https%253A%2F%2Fyoutube.com%2Fwatch%253Fv%"
34
- "253D2lAe1cqCOXo&hl=en_US&html5=1"
35
- )
36
- assert video_info_url == expected
37
 
38
 
39
  def test_js_url(cipher_signature):
 
16
  video_info_url = extract.video_info_url_age_restricted(
17
  video_id="QRS8MkLhQmM", embed_html=age_restricted["embed_html"],
18
  )
19
+ assert video_info_url.startswith('https://www.youtube.com/get_video_info')
20
+ assert 'video_id=QRS8MkLhQmM' in video_info_url
 
 
 
21
 
22
 
23
  def test_info_url_age_restricted(cipher_signature):
 
25
  video_id=cipher_signature.video_id,
26
  watch_url=cipher_signature.watch_url,
27
  )
28
+ assert video_info_url.startswith('https://www.youtube.com/get_video_info')
29
+ assert 'video_id=2lAe1cqCOXo' in video_info_url
 
 
 
 
30
 
31
 
32
  def test_js_url(cipher_signature):