我已经安装了pytube,当我运行它时会遇到一个错误(我使用的是python3.7),问题似乎在于pytube本身,我正在为这个模块使用精确的教程代码。
import pytube
link ='https://www.youtube.com/watch?v=9bZkp7q19f0'
yt = pytube.YouTube(link)
stream = yt.streams.first()
finished = stream.download()
print('Download is complete')
Traceback (most recent call last):
File "C:\automate the boring stuff\youtubetry.py", line 6, in <module>
yt = pytube.YouTube(link)
File "C:\Users\diodi\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pytube\__main__.py", line 88, in __init__
self.prefetch_init()
[Finished in 6.0s with exit code 1]发布于 2018-11-26 03:54:21
我上周有过这个问题。因为我在Ubuntu,对我起作用的是导航到:
/home/<username>/anaconda3/lib/python3.6/site-packages/pytube加上
r'\bc\s*&&\s*d\.set\([^,]+,.*?\((?P<sig>[a-zA-Z0-9$]+)\(\(0\s*,\s*window.decodeURIComponent'到get_initial_function_name()函数中cipher.py中的模式列表中。在这个Github线程中进一步讨论了该错误。
https://stackoverflow.com/questions/53472840
复制相似问题