youtube-cli/README.md
2025-12-06 01:17:27 -06:00

117 lines
2.4 KiB
Markdown

# 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
```bash
git clone https://github.com/yourusername/youtube-cli.git
cd youtube-cli
pip install -e .
```
### Using pip
```bash
pip install youtube-cli
```
## Usage
### Basic Search
```bash
youtube-cli "python tutorial"
```
### Download a Video
```bash
youtube-cli --download "https://www.youtube.com/watch?v=xyz123"
```
### View Help
```bash
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:
```json
{
"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
1. Run a search query to find videos
2. Videos will be displayed with:
- Title (short videos marked with "(short)")
- Author
- Duration
- Type indicator
3. Choose an option:
- `n` for next page of results
- `q` to 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:
```bash
pip install yt-dlp
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Create a Pull Request
## License
MIT License