昨天这个程序运行得很好,但今天我却出了那个错误
这就是程序:
from pytube import YouTube
url = input("Give link: ")
video = YouTube(url)
video_audio = video.streams.get_audio_only()
video_audio.download(filename_prefix="Audio ")
这是错误的:
Traceback (most recent call last):
File "C:\Users\Admin\Desktop\Python\YTDowlander.py", line 8, in <module>
video_audio = video.streams.get_audio_only()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytube\__main__.py", line 296, in streams
return StreamQuery(self.fmt_streams)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytube\extract.py", line 414, in apply_signature
cipher = Cipher(js=js)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytube\cipher.py", line 44, in __init__
self.throttling_plan = get_throttling_plan(js)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\pytube\cipher.py", line 412, in get_throttling_plan
transform_plan_raw = find_object_from_startpoint(raw_code, match.span()[1] - 1)
AttributeError: 'NoneType' object has no attribute 'span'
我只更新了pytube中的cipher.py,因为新的youtube链接
1条答案
按热度按时间vyu0f0g11#
代码运行正常,但由于YouTube经常更改其格式,因此PyTube不是最新的。
您可以使用以下命令进行更新: