'AttributeError: 'NoneType' object has no attribute 'span'
I am trying to download a YouTube video using pytube. Here is my code:
import pytube
link = "https://www.youtube.com/watch?v=CTVd_WxblGI"
yt = pytube.YouTube(link)
stream = yt.streams.first()
stream.download()
But I am getting this error.
Traceback (most recent call last):
File "test.py", line 4, in <module>
stream = yt.streams.first()
File "/home/harsha/.local/lib/python3.8/site-packages/pytube/__main__.py", line 296, in streams
return StreamQuery(self.fmt_streams)
File "/home/harsha/.local/lib/python3.8/site-packages/pytube/__main__.py", line 181, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
File "/home/harsha/.local/lib/python3.8/site-packages/pytube/extract.py", line 409, in apply_signature
cipher = Cipher(js=js)
File "/home/harsha/.local/lib/python3.8/site-packages/pytube/cipher.py", line 43, in __init__
self.throttling_plan = get_throttling_plan(js)
File "/home/harsha/.local/lib/python3.8/site-packages/pytube/cipher.py", line 387, in get_throttling_plan
raw_code = get_throttling_function_code(js)
File "/home/harsha/.local/lib/python3.8/site-packages/pytube/cipher.py", line 301, in get_throttling_function_code
code_lines_list = find_object_from_startpoint(js, match.span()[1]).split('\n')
AttributeError: 'NoneType' object has no attribute 'span'
I installed pytube using pip. Please help me with this.
Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
