此 Python 腳本可讓您使用yt-dlp
從 YouTube 下載並合併最優質的影片和音訊。如果您的系統上尚未安裝yt-dlp
它會自動安裝。
ffmpeg
才能合併視訊和音訊串流。ffmpeg
ffmpeg
。bin
目錄加入系統的 PATH 環境變數。 使用 Homebrew 安裝ffmpeg
:
brew install ffmpeg
使用套件管理器安裝ffmpeg
。例如,在 Ubuntu 上:
sudo apt update
sudo apt install ffmpeg
克隆此存儲庫:
git clone https://github.com/aswinop/yt-downloader.git
cd yt-downloader
運行腳本:
python download_video.py
出現提示時選擇方法:
Methods Available:-
1) Auto Detect
2) Download Youtube Video
3) Download Youtube Music
4) Advanced Options
Your Choice:
出現提示時輸入 YouTube 影片/音樂 URL:
Enter the YouTube video URL: https://www.youtube.com/watch?v=your-video-id
或者
Enter the Youtube Music URL: https://music.youtube.com/watch?v=your-video-id
該腳本將下載最佳的可用視訊和音訊串流,合併它們,並將檔案保存在當前目錄中。
yt-dlp is not installed. Installing now...
[yt-dlp] Downloading video...
Title: Example Video Title
Download completed! File saved as Example Video Title.mp4
請隨意提交問題或拉取請求以改進腳本。
該項目根據 MIT 許可證獲得許可 - 有關詳細信息,請參閱許可證文件。