[問題] pytube無法使用

看板Python作者 (Rick)時間1月前 (2024/07/15 08:14), 編輯推噓1(102)
留言3則, 2人參與, 1月前最新討論串1/1
以下程式碼都是在google colab上運行 之前都用得好好的,我也沒有改程式碼,但最近突然出現 " get_throttling_function_name: could not find match for multiple" 我查了一下好像是正規表達式的問題,查到的資料是只要在cipher.py這個文件中把 其中一個";"刪掉就好了,只是我跑一下程式碼: """ !pip uninstall pytube -y !pip install git+https://github.com/pytube/pytube !pip install pydub !apt-get install ffmpeg import os import pytube # 修復 cipher.py 文件 cipher_path = os.path.join(os.path.dirname(pytube.__file__), 'cipher.py') # 確認 cipher_path 是否正確 print(f"Cipher file path: {cipher_path}") with open(cipher_path, 'r') as file: filedata = file.readlines() # 確認文件內容 print("Original cipher.py content:") print("".join(filedata[280:290])) # 查看原始文件的特定部分 # 修改第 287 行的程式碼 filedata[287] = " r'var {nfunc}\\s*=\\s*(\\[.+?\\])'.format(\n" # 確認修改後的文件內容 print("Modified cipher.py content:") print("".join(filedata[280:290])) # 寫回文件 with open(cipher_path, 'w') as file: file.writelines(filedata) print("cipher.py 修復完成") """ 結果出現第287行還是沒有改掉,到底是出了甚麼問題? 以下是cipher.py原始代碼,謝謝 https://reurl.cc/dnEKd2 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 117.56.22.197 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1721002443.A.CC7.html

07/15 08:14, 1月前 , 1F
抱歉忘了說查到的資料是說刪掉287行的;
07/15 08:14, 1F

07/15 08:15, 1月前 , 2F

07/16 12:39, 1月前 , 3F
pytube 滿常這樣的,看要不要換 yt-dlp 之類的
07/16 12:39, 3F
文章代碼(AID): #1cb6dBp7 (Python)
文章代碼(AID): #1cb6dBp7 (Python)