|
不好意思,我執行以下程式
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=27ob2G3GUCQ') print("影片名稱:" + yt.title) print("影片格式共有 " + str(len(yt.streams)) + ' 種') print("影片型態為 mp4 且影像及聲音都有的影片:") print(yt.streams.filter(subtype='mp4', progressive=True)) print('開始下載 mp4, 360p 的影片:') pathdir = 'd:\\tem' #下載資料夾 yt.streams.filter(subtype='mp4', res='360p', progressive=True).first().download(pathdir) #下載mp4,360p影片 print('下載完成! 下載檔案存於 ' + pathdir + ' 資料夾')
請問如何解決 RegexMatchError Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\pytube\__main__.py in fmt_streams(self) 180 try: --> 181 extract.apply_signature(stream_manifest, self.vid_info, self.js) 182 except exceptions.ExtractError:
C:\ProgramData\Anaconda3\lib\site-packages\pytube\extract.py in apply_signature(stream_manifest, vid_info, js) 408 """ --> 409 cipher = Cipher(js=js) 410
C:\ProgramData\Anaconda3\lib\site-packages\pytube\cipher.py in __init__(self, js) 42 ---> 43 self.throttling_plan = get_throttling_plan(js) 44 self.throttling_array = get_throttling_function_array(js)
C:\ProgramData\Anaconda3\lib\site-packages\pytube\cipher.py in get_throttling_plan(js) 404 """ --> 405 raw_code = get_throttling_function_code(js) 406
C:\ProgramData\Anaconda3\lib\site-packages\pytube\cipher.py in get_throttling_function_code(js) 310 # Begin by extracting the correct function name --> 311 name = re.escape(get_throttling_function_name(js)) 312
C:\ProgramData\Anaconda3\lib\site-packages\pytube\cipher.py in get_throttling_function_name(js) 295 --> 296 raise RegexMatchError( 297 caller="get_throttling_function_name", pattern="multiple"
RegexMatchError: get_throttling_function_name: could not find match for multiple
During handling of the above exception, another exception occurred:
RegexMatchError Traceback (most recent call last) <ipython-input-4-c231e16e4720> in <module> 3 yt = YouTube('https://www.youtube.com/watch?v=27ob2G3GUCQ') 4 print("影片名稱:" + yt.title) ----> 5 print("影片格式共有 " + str(len(yt.streams)) + ' 種') 6 print("影片型態為 mp4 且影像及聲音都有的影片:") 7 print(yt.streams.filter(subtype='mp4', progressive=True))
C:\ProgramData\Anaconda3\lib\site-packages\pytube\__main__.py in streams(self) 294 """ 295 self.check_availability() --> 296 return StreamQuery(self.fmt_streams) 297 298 @property
C:\ProgramData\Anaconda3\lib\site-packages\pytube\__main__.py in fmt_streams(self) 186 pytube.__js__ = None 187 pytube.__js_url__ = None --> 188 extract.apply_signature(stream_manifest, self.vid_info, self.js) 189 190 # build instances of :class:`Stream <Stream>`
C:\ProgramData\Anaconda3\lib\site-packages\pytube\extract.py in apply_signature(stream_manifest, vid_info, js) 407 408 """ --> 409 cipher = Cipher(js=js) 410 411 for i, stream in enumerate(stream_manifest):
C:\ProgramData\Anaconda3\lib\site-packages\pytube\cipher.py in __init__(self, js) 41 ] 42 ---> 43 self.throttling_plan = get_throttling_plan(js) 44 self.throttling_array = get_throttling_function_array(js) 45
C:\ProgramData\Anaconda3\lib\site-packages\pytube\cipher.py in get_throttling_plan(js) 403 The full function code for computing the throttlign parameter. 404 """ --> 405 raw_code = get_throttling_function_code(js) 406 407 transform_start = r"try{"
C:\ProgramData\Anaconda3\lib\site-packages\pytube\cipher.py in get_throttling_function_code(js) 309 """ 310 # Begin by extracting the correct function name --> 311 name = re.escape(get_throttling_function_name(js)) 312 313 # Identify where the function is defined
C:\ProgramData\Anaconda3\lib\site-packages\pytube\cipher.py in get_throttling_function_name(js) 294 return array[int(idx)] 295 --> 296 raise RegexMatchError( 297 caller="get_throttling_function_name", pattern="multiple" 298 )
RegexMatchError: get_throttling_function_name: could not find match for multiple |