当前位置: 首页 > 工具软件 > pytube > 使用案例 >

pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W

农英杰
2023-12-01

使用pytube库python下载油管视频出错

Traceback (most recent call last):
  File "D:\WORK\pythonfile\PythonFinal\T1\venv\lib\site-packages\pytube\__main__.py", line 181, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "D:\WORK\pythonfile\PythonFinal\T1\venv\lib\site-packages\pytube\extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "D:\WORK\pythonfile\PythonFinal\T1\venv\lib\site-packages\pytube\cipher.py", line 33, in __init__
    raise RegexMatchError(
pytube.exceptions.RegexMatchError: __init__: could not find match for ^\w+\W

解决方法:

进入cipher.py文件把第30行替换为

var_regex = re.compile(r"^\$*\w+\W")

 类似资料: