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
Based on your description, I'll provide an overview of how the script would work from a UX and technological standpoint.
UX Overview
- Initial Setup: The user creates a config file specifying the sources (channels and playlists) to download from, along with the last synced date for each source. The config file also allows the user to specify subtitle languages, enable debug logging, and other settings.
- Running the Script: The user runs the CLI command, which begins checking the sources from the config file. The script finds new videos uploaded past the last sync date and retrieves their metadata (title, etc.).
- Categorization: The script uses an LLM to categorize the new videos into the existing folder structure. The LLM is trained on the existing folder structure and file names, and uses caching for cost optimization.
- Verification Step: The script presents the user with a list of new videos to download, along with their designated folders. The user can verify the list, remove videos, or change the designated folder for each video.
- Download: Once the user is satisfied, the script begins downloading the videos using yt-dlp. A progress UI is displayed, showing the status of the downloads, including errors (e.g., failed downloads, missing subtitles).
- Override: The user can use an override option to provide a list of YouTube video, channel, or playlist links to download instead of using the sources from the config file.
Technological Overview
- Config File: The config file will be in a format such as JSON or YAML, allowing the user to easily edit and modify the settings.
- LLM Integration: The script will use an LLM service (e.g., Hugging Face, Google Cloud AI Platform) to perform categorization. The LLM will be trained on the existing folder structure and file names, and will use caching to optimize costs.
- yt-dlp Integration: The script will use the yt-dlp package to manage downloads and metadata from YouTube.
- Progress UI: The script will use a library such as
richorprogressto display a progress UI, showing the status of the downloads. - Error Handling: The script will handle errors such as failed downloads, missing subtitles, and other issues that may arise during the download process.
- Override Option: The script will use a command-line argument or option to allow the user to provide a list of YouTube video, channel, or playlist links to download instead of using the sources from the config file.
Clarifying Questions
- How do you envision the verification step working? Would you like to use a text-based interface, or a graphical interface (e.g., GUI, web interface)?
- How would you like to handle cases where the LLM is unsure about the categorization of a video? Would you like to use a confidence threshold, or allow the user to manually review and correct the categorization?
- Would you like to implement any additional features, such as automatic folder creation, or support for multiple subtitle languages?
- How would you like to handle errors that occur during the download process? Would you like to retry failed downloads, or abort the download process and notify the user?
Please let me know your thoughts on these questions, and I'll be happy to proceed 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 →
- 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 →
claude-3-5-sonnet-20241022Compare side by side →