YouTube CLI
A command-line interface for browsing and downloading YouTube videos.
Features
- Search YouTube videos with keyword queries
- Display up to 15 videos at a time with title, author, duration, and type (short/video)
- Download videos using yt-dlp with progress indication
- Configure download locations
- Handle short videos (videos with /shorts/ in URL) with special "(short)" prefix
Requirements
- Python 3.6+
- yt-dlp
- rich
- requests
Installation
From Source
git clone https://github.com/yourusername/youtube-cli.git
cd youtube-cli
pip install -e .
Using pip
pip install youtube-cli
Usage
Basic Search
youtube-cli "python tutorial"
Download a Video
youtube-cli --download "https://www.youtube.com/watch?v=xyz123"
View Help
youtube-cli --help
Configuration
The application will create a default configuration file at ~/.config/youtube_cli/config.json if one doesn't exist. You can customize:
{
"download_dir": "~/Downloads/youtube",
"default_locations": [
"~/Downloads/youtube",
"~/Movies/youtube",
"/tmp/youtube"
],
"max_videos_per_page": 15,
"yt_dlp_args": {
"format": "bestvideo[height=1080]+bestaudio/bestvideo[height<=1080]+bestaudio",
"write_thumbnail": true,
"extractor_args": "youtube:player-client=default,-tv_simply"
}
}
How to Use
- Run a search query to find videos
- Videos will be displayed with:
- Title (short videos marked with "(short)")
- Author
- Duration
- Type indicator
- Choose an option:
nfor next page of resultsqto quit- Enter a number to select and download a video
Features
- Search: Search YouTube videos using keyword queries
- Pagination: View 15 videos at a time with option for more
- Download: Download videos directly with progress indication
- Short Detection: Automatically detects and marks short videos
- Configuration: Customizable download locations
- Cross-platform: Works on macOS and Linux
Dependencies
This tool depends on yt-dlp which must be installed separately:
pip install yt-dlp
Contributing
- Fork it
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Create a Pull Request
License
MIT License
Languages
Python
94.6%
Dockerfile
3.3%
Shell
2.1%