pytube-Youtube函数未初始化

时间:2018-11-25 22:57:39

标签: python python-3.x youtube

我已经安装了pytube,运行它时出现错误(我正在使用python 3.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]

1 个答案:

答案 0 :(得分:1)

上周我遇到了这个问题。自从我使用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函数中的模式列表。该错误已在this Github thread中进行了进一步讨论。