A fully interactive Python tool that lets you:
- Search YouTube by URL or keywords (pick from results in terminal)
- Download audio as MP3
- Trim audio (manual times or interactive waveform GUI)
- Edit/clear metadata (CLI or a small Tkinter GUI)
- Set cover art from a video frame (FFmpeg), pick a local image, or use a frame scrubber
- Rename and save to a target folder read from
.env
Use case: Provides a more streamlined process for importing Youtube audio to Spotify local files.
-
Install FFmpeg and Tkinter (required by
yt_dlp/pydubfor conversions and frame extraction)- macOS (Homebrew):
brew install ffmpeg python-tk@3.12 - Ubuntu/Debian:
sudo apt-get update && sudo apt-get install -y ffmpeg
- macOS (Homebrew):
-
Create and activate a virtualenv (recommended)
/Library/Frameworks/Python.framework/Versions/3.12/bin/python3 -m venv .venv source .venv/bin/activate -
Install Python dependencies
pip install -r requirements.txt
-
Set your save directory in
.env- Copy
.env.sample→.env, then setSAVE_DIRto your iCloud Drive folder, e.g.:SAVE_DIR="$HOME/Library/Mobile Documents/com~apple~CloudDocs/Music/YouTubeMP3"
- Create that folder if it doesn't exist.
- Copy
-
Run
For full process, starting with downloading YouTube video:
python main.py
For editing metadata and cover art of existing .mp3 file:
python edit_existing.py
- Search: Enter a YouTube URL or keywords; for keywords it shows a selectable list (title, channel, duration).
- Download: Best audio stream, converts to
.mp3withyt_dlp+ FFmpeg. - Trim (optional):
- Manual: enter start/end in seconds (e.g.,
5.5to182.3). - Interactive: pop-up waveform window; press [SPACE] and use mouse/arrow keys to select start/end times and close the window to apply.
- Manual: enter start/end in seconds (e.g.,
- Metadata:
- CLI mode: prompts for Title/Artist/Album/etc., or choose to clear all.
- GUI mode: Tkinter form; save to apply.
- Cover Art:
- From frame: enter timestamp (e.g.,
45.2) and we grab a frame with FFmpeg. - From file: choose an image.
- From scrubber: use arrow keys to scrub through and choose a frame
- From frame: enter timestamp (e.g.,
- Rename: Final prompt to rename the file before saving.
- Save: Writes to
SAVE_DIRfrom.env.
- If you get an FFmpeg-related error, confirm
ffmpegis installed and on your PATH. - On first run, some packages may take a moment to build wheels.
- After picking times in the interactive waveform, close the window to continue to further instructions.
- If the youtube video fails to download, update
yt-dlp.
pip install -U yt-dlpIf it still doesn't work, the format is not supported. Download the video with Y2mate. Place the file in your iCloud folder and then run
python edit_existing.pyto edit metadata and select cover art.
- Remove the
.venvfolder to drop the environment.