Skip to main content

The simplest YouTube downloader (CLI + Python API)

Project description

vexo

vexo — The simplest YouTube downloader (CLI + Python API)

Installation

Verify you have Python 3.x:

python --version

Install vexo:

pip install vexo

Upgrade

pip install --upgrade vexo

Quick Start (CLI)

vexo "YOUTUBE_LINK" [PATH]

Examples

# Download a video (interactive selection if needed)
vexo "https://www.youtube.com/watch?v=VIDEO_ID"

# Download audio only
vexo "https://www.youtube.com/watch?v=VIDEO_ID" --audio

# Download to a specific folder
vexo "https://www.youtube.com/watch?v=VIDEO_ID" ./downloads

# Download with specific quality
vexo "https://www.youtube.com/watch?v=VIDEO_ID" --quality 720p

Python API (async)

Use the async DownloadService to integrate vexo into bots and other apps.

from vexo import DownloadService
import os
from typing import Union
import asyncio

async def download(bot_username, link, video: Union[bool, str] = None):
    is_audio = not bool(video)
    service = DownloadService(
        url=link,
        path="downloads/%(id)s.%(ext)s",
        quality="360p" if not is_audio else "audio",
        is_audio=is_audio, 
        download_thumbnail=True, 
        export_metadata=True
        # cookies_file="cookies.txt"  # Optional: auto-detects if available
    )
    return await service.download_async()

# Example runner:
# asyncio.run(download("botname", "https://www.youtube.com/watch?v=VIDEO_ID", video=True))

Simple API

from vexo import download
import asyncio

async def main():
    # Download video (auto-detects cookies if available)
    result = await download("botname", "https://www.youtube.com/watch?v=VIDEO_ID", video=True)
    
    # Download audio with custom cookies
    result = await download("botname", "https://www.youtube.com/watch?v=VIDEO_ID", 
                          video=False, cookies_file="my_cookies.txt")
    
    print(f"Downloaded: {result['title']}")
    print(f"File: {result['file_path']}")

asyncio.run(main())

Cookies Support

Vexo automatically detects and uses cookies for accessing restricted content.

Auto-Detection

Place any of these files in your project directory:

  • cookies.txt
  • youtube_cookies.txt
  • yt_cookies.txt

Manual Cookies

from vexo import YouTubeDownloader

# With custom cookies file
downloader = YouTubeDownloader(cookies_file="path/to/cookies.txt")
audio = downloader.download_audio("https://youtube.com/watch?v=ID")

CLI with Cookies

# Auto-detect cookies
vexo "https://www.youtube.com/watch?v=VIDEO_ID" --audio

# Custom cookies file  
vexo "https://www.youtube.com/watch?v=VIDEO_ID" --cookies my_cookies.txt

Getting Cookies

  1. Install browser extension "Get cookies.txt LOCALLY"
  2. Login to YouTube
  3. Export cookies as cookies.txt
  4. Place in your project folder

Features

  • Download YouTube videos in various qualities
  • Extract audio in MP3 format
  • Download thumbnails automatically
  • Export video metadata as JSON
  • Async/await support for integration
  • Simple CLI interface
  • Custom output paths with pattern support
  • Cross-platform compatibility

File Naming

Downloaded files use the pattern {video_id}.{ext}:

  • Videos: dQw4w9WgXcQ.mp4
  • Audio: dQw4w9WgXcQ.mp3
  • Thumbnails: dQw4w9WgXcQ.jpg
  • Metadata: dQw4w9WgXcQ.json

Metadata Format

{
  "id": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "author": "Rick Astley",
  "channel_id": "UCuAXFkgsw1L7xaCfnd5JJOw",
  "length": 213,
  "views": 1724172072,
  "publish_date": "20091025",
  "description": "The official video...",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "thumbnail_url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg"
}

Requirements

  • Python 3.8+
  • yt-dlp

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vexo-2025.12.34.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vexo-2025.12.34-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file vexo-2025.12.34.tar.gz.

File metadata

  • Download URL: vexo-2025.12.34.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for vexo-2025.12.34.tar.gz
Algorithm Hash digest
SHA256 61b86746dfe245b169ecc1d2a2875f23b6d45e5e77a0c3675b0c6064306185b8
MD5 52ed13ef91a73174a40ba3c0a48aa116
BLAKE2b-256 9e38761af4501118afe7d4c47c0796e709951af3480f565b72f863043986edee

See more details on using hashes here.

File details

Details for the file vexo-2025.12.34-py3-none-any.whl.

File metadata

  • Download URL: vexo-2025.12.34-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for vexo-2025.12.34-py3-none-any.whl
Algorithm Hash digest
SHA256 cda762a34f3739a990e5ead35872b211ca9115925f10cda645ae8df88d154533
MD5 2ba1d0a6e1f9ca0821b0bbf9d4147a9b
BLAKE2b-256 3ce24789e14335df676bf4e15e99164af0386eccacbd9ed40f0afb7fb5045bcf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page