New Ribbon
Canva+AI創意設計與品牌應用250招:從商業技巧、社群祕技到AI圖文影音特效 快快樂樂學威力導演2024.影音剪輯與AI精彩創作 文淵閣工作室祝福大家新年快樂.龍年吉祥 Power Automate自動化超效率工作術 Midjourney AI圖像魔導書:搭配ChatGPT魔法加倍 超人氣FB+IG+LINE社群經營與行銷力(第二版) 翻倍效率工作術:不會就太可惜的 Excel × ChatGPT 自動化應用 AppInventor2零基礎入門班中文版(第六版) Python零基礎入門班(第四版) C語言學習聖經 用Canva設計超快超質感:平面、網頁、電子書、簡報、影片製作與AI繪圖最速技 PHP8/MySQL網頁程式設計自學聖經 翻倍效率工作術 - 不會就太可惜的Power BI大數據視覺圖表設計與分析(第三版) 社群經營一定要會的影音剪輯與動畫製作術 Notion高效管理250招:筆記×資料庫×團隊協作,數位生活與工作最佳幫手 Office 2021高效實用範例必修16課(附500分鐘影音教學/範例檔) Excel自學聖經(第二版):從完整入門到職場活用的技巧與實例大全 網路開店×拍賣王:蝦皮來了(第二版) 專家都在用的Google最強實戰:表單、文件、試算、簡報、遠距與線上會議 超人氣 Instagram 視覺行銷力(第二版):小編不敗,經營 IG 品牌人氣王的 120 個秘技!

 

  phthon大數據特訓班第二版8

張


更新時間:2022/5/16 下午 04:15:30

 

不好意思,我執行以下程式

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

文淵閣工作室

文淵閣工作室
更新時間:2022/5/16 下午 06:42:14

 

我剛才執行您的程式碼皆正常。
請以 pip install -U pytube 更新模組,目前最新版為 12.1.0




 

 

Re:phthon大數據特訓班第二版8

請輸入姓名。

已超出字元數目的最大值。


請輸入電子郵件。

格式無效。


請輸入內容。