A Python tool that automatically organizes videos from a source YouTube playlist into topic-specific playlists using OpenAI for content analysis.
- Analyzes video content using OpenAI's GPT models
- Creates topic-specific playlists automatically
- Handles duplicate videos intelligently
- Efficient batch processing of playlist videos
- Secure credential management
- Python 3.8 or higher
- YouTube Data API v3 credentials
- OpenAI API key
- Required Python packages (see
requirements.txt)
- Clone the repository:
git clone <repository-url>
cd youtube-playlist-organizer- Install dependencies using uv:
uv venv
source .venv/bin/activate # On Unix/macOS
.venv\Scripts\activate # On Windows
uv pip install -r requirements.txt-
Set up credentials:
- Copy
.env.exampleto.env - Add your YouTube API credentials
- Add your OpenAI API key
- Configure other settings as needed
- Copy
-
Set up YouTube API:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable YouTube Data API v3
- Create OAuth 2.0 credentials
- Download client secrets and save as
client_secrets.json
Run the script with your source playlist URL and topics:
python main.py --playlist "https://www.youtube.com/playlist?list=YOUR_PLAYLIST_ID" --topics "topic1,topic2,topic3"The script will:
- Authenticate with YouTube and OpenAI
- Analyze videos in the source playlist
- Create topic-specific playlists if they don't exist
- Add matching videos to appropriate playlists
- Skip any duplicate videos
- Code is formatted using black
- Use
pytestfor running tests - Follow the implementation guide in
IMPLEMENTATION.md
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.