I want to build a CLI tool that automates the process of downloading videos from a list…
- User
I want to build a CLI tool that automates the process of downloading videos from a list of youtube channels and playlists and then sorts them into the right folder on my computer. Essentially its job is to look for new videos from the provided source list, figure out which folder in my local media folder each respective video belongs in, and finally downloads + places those videos into those respective folders.
I already have a folder structure where I've organized hundreds of videos manually. It's a nested folder structure of different custom categories I've defined, where each folder is a category. Most of the videos I've already downloaded (several hundred) use the same title as the YouTube source. The idea is we can use an LLM to perform the categorization by passing in a file tree structure of the existing folders and file names within them. Ideally we would use the LLM service's caching function for cost optimization.
It should use a config file which lets me specify the sources (channels and playlists) we should download from. Each source should have a 'last synced date' parameter to track when that source was last checked and downloaded from. This is to make it easy for me to add new sources over time and prevent the script from checking videos from before the last synced date. The script should use the yt-dlp package to manage downloads/metadata from youtube (that's what I use right now for manually downloading stuff). Because many of the videos I'm downloading are in foreign languages I should be able to specify the subtitle languages I want downloaded and attached to every video that gets downloaded. The config file should also let me enable debug logging.
For reference, here's the command I currently use for downloading these videos (note that this command embeds subtitles too):
yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4" --embed-subs --write-auto-subs --sub-langs "en,en-US,en*,en-*"
Functionally I should be able to run the CLI command and the script will begin checking the sources from the config file, finding videos that were added or uploaded past the last sync date and getting the metadata for them. It will then use the metadata (the video's title) to figure out which folder each new video should go into. Importantly it shouldn't start downloading the videos yet because it should allow me to verify that I'm happy with the videos to download list as well as their designated folders. This verification step should let me make modifications to videos that I'm not happy with, such as removing videos from being downloaded or changing the designated folder (either by re-running the LLM categorization process or by manually selecting a folder myself). Finally, when I'm satisfied, the script should begin downloading videos. A progress UI should be present that lets me see the status of the downloads (including errors, such as if some downloads fail or if subtitles can't be found for example)
Lastly, the CLI should have an override that lets me directly provide a bunch of youtube video, channel, or playlist links which should be used as sources instead of the sources provided in the config file. This is to make it easy for me to download ad-hoc videos I find that aren't in the usual channels/playlists present in the config file.
Give me an overview of how this script would work, from a UX and technological standpoint. Feel free to ask clarifying questions if necessary. When we're both satisfied, we can begin the technical implementation.
Assistant
I'll break down how I envision this CLI tool working, both from a UX and technical perspective. Then I'll list some clarifying questions I have.
Overall Flow:
-
Configuration Setup
- YAML config file containing:
- Source list (channels/playlists)
- Last sync dates per source
- Subtitle language preferences
- Media root directory
- Debug logging toggle
- LLM API configuration
- YAML config file containing:
-
Initial Run
# Normal run using config file yt-organizer sync # Override with direct links yt-organizer sync --links "url1,url2,url3" -
Discovery Phase
- Fetch metadata for new videos (using yt-dlp)
- Show progress bar for metadata collection
- Display summary of found videos
-
Categorization Phase
- Use LLM to categorize videos based on existing folder structure
- Show proposed categorization in a table format
- Allow interactive modifications:
Found 5 new videos: 1. [✓] "Video Title 1" → /media/Educational/Physics 2. [✓] "Video Title 2" → /media/Entertainment/Gaming 3. [!] "Video Title 3" → /media/Unsorted # Marked for review ... Actions: [e] Edit selection [r] Recategorize [s] Skip [c] Continue
-
Download Phase
- Rich progress UI showing:
- Overall progress
- Current download
- Subtitle status
- Any errors/warnings
- Allow pause/resume functionality
- Rich progress UI showing:
Technical Components:
-
Core Libraries
- Click/Typer for CLI interface
- yt-dlp for YouTube interaction
- rich for terminal UI
- PyYAML for config management
- OpenAI/other LLM API for categorization
-
Key Classes
- ConfigManager
- VideoDownloader
- CategoryManager
- ProgressManager
- LLMCategorizer
Clarifying Questions:
-
For the LLM categorization:
- Should we maintain a history of categorization decisions to improve accuracy?
- How should we handle completely new categories that don't exist in the folder structure?
-
For the verification step:
- Would you want batch operations (e.g., move all videos from category X to Y)?
- Should we save "rejected" videos somewhere for later review?
-
For error handling:
- How should we handle partial failures (e.g., video downloaded but subtitles failed)?
- Should we maintain a log of failed downloads for retry?
-
For the config file:
- Should we support different download quality settings per source?
- Would you want to specify different subtitle languages per source?
-
For the folder structure:
- Should we support creating new categories on the fly?
- Should we maintain a mapping file of video IDs to locations for future reference?
Let me know if this aligns with your vision and if you have any additional requirements or modifications. Once we clarify these points, we can move forward with the technical implementation.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
gemini-2.5-pro-preview-03-25Compare side by side →
- chatgpt-4o-latest-20250326Compare side by side →
- grok-3-mini-betaCompare side by side →
- chatgpt-4o-latest-20250326Compare side by side →
claude-3-5-sonnet-20241022Compare side by side →
- grok-3-mini-betaCompare side by side →
llama-3.3-70b-instructCompare side by side →
- o3-miniCompare side by side →
gemini-2.0-flash-001Compare side by side →
- o4-mini-2025-04-16Compare side by side →
gemini-2.5-pro-preview-03-25Compare side by side →