首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >巨蟒中的pytube.exceptions.RegexMatchError

巨蟒中的pytube.exceptions.RegexMatchError
EN

Stack Overflow用户
提问于 2021-08-27 09:02:33
回答 1查看 589关注 0票数 0

我可以尝试找到不同格式的youtube视频。使用pytube,但是它给出了一个错误的pytube.exceptions.RegexMatchError。

代码语言:javascript
复制
from pytube import YouTube

url = input('Enter url :')

link = YouTube(url)

print(link.title)

obj = link.streams.filter(progressive="True")
print(obj)

此错误给出:

代码语言:javascript
复制
Traceback (most recent call last):
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/__main__.py", line 170, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/cipher.py", line 43, in __init__
    self.throttling_plan = get_throttling_plan(js)
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/cipher.py", line 387, in get_throttling_plan
    raw_code = get_throttling_function_code(js)
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/cipher.py", line 293, in get_throttling_function_code
    name = re.escape(get_throttling_function_name(js))
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/cipher.py", line 279, in get_throttling_function_name
    caller="get_throttling_function_name", pattern="multiple"
pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 44, in <module>
    yt = myVideo.streams.filter(type='mp4')
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/__main__.py", line 285, in streams
    return StreamQuery(self.fmt_streams)
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/__main__.py", line 177, in fmt_streams
    extract.apply_signature(stream_manifest, self.vid_info, self.js)
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/extract.py", line 409, in apply_signature
    cipher = Cipher(js=js)
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/cipher.py", line 43, in __init__
    self.throttling_plan = get_throttling_plan(js)
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/cipher.py", line 387, in get_throttling_plan
    raw_code = get_throttling_function_code(js)
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/cipher.py", line 293, in get_throttling_function_code
    name = re.escape(get_throttling_function_name(js))
  File "/home/jay/PycharmProjects/videoinfo/venv/lib/python3.7/site-packages/pytube/cipher.py", line 279, in get_throttling_function_name
    caller="get_throttling_function_name", pattern="multiple"
pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple

我还可以使用"pip install git+https://github.com/nficano/pytube.git“和"pip install pytube”重新安装pytube。但错误仍然存在。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-08-31 04:56:35

您可以安装:

代码语言:javascript
复制
pip install pytube==11.0.1 or pip install --upgrade pytube

或者你可以在pytube/cifer.py中改变:

代码语言:javascript
复制
edit line:r'a\.[A-Z]&&\(b=a\.[sg]et\("n"\)\)&&\(b=([^(]+)\(b\),a\.[sg]et\("n",b\)\)}};' 

代码语言:javascript
复制
r'a\.C&&\(b=a\.get\("n"\)\)&&\(b=([^(]+)\(b\),a\.set\("n",b\)\)}};',

def get_throttling_function_name(js: str) -> str:函数中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68950738

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档