Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

media-grabber

⚡ A fast terminal application to download videos and audios from YouTube, X (Twitter), Instagram, TikTok, SoundCloud, and more — powered by yt-dlp and ffmpeg, wrapped in Bun.


Features

  • 🎥 Video & Audio downloads from any URL yt-dlp supports.
  • 🎵 Audio-only mode (extract to MP3 or original formats).
  • 🧵 Parallel downloads with concurrency control.
  • 🥠 Supports cookies & browser sessions for private/age-restricted content.
  • 📝 Embeds metadata, chapters, subtitles, thumbnails.
  • 🔒 Portable file naming (--safe-names).
  • 🐇 Super fast Bun-powered CLI.
  • Tested E2E integration flow included.

Requirements

  • Bun >= v1.2.0
  • yt-dlp in your PATH
  • ffmpeg installed and in PATH (for conversion/remuxing)

Install Dependencies

bun install

Usage

bun run src/cli.ts <URLS...> [options]

Examples

# Download a YouTube video in best MP4 format
bun run src/cli.ts https://www.youtube.com/watch?v=dQw4w9WgXcQ

# Audio-only download as MP3
bun run src/cli.ts -A https://soundcloud.com/artist/track-name

# Download from Twitter/X with safe filenames
bun run src/cli.ts --safe-names https://x.com/username/status/1234567890

# Dry-run: show yt-dlp commands that would be executed
bun run src/cli.ts --dry-run https://www.youtube.com/watch?v=dQw4w9WgXcQ

Options

Option Description
<urls...> One or more URLs (YouTube, X/Twitter, Instagram, TikTok, SoundCloud, etc.)
-o, --out-dir <dir> Output directory (default: downloads)
-A, --audio Audio-only mode (extract & convert to MP3)
-F, --format <fmt> yt-dlp format string (default picks best video+audio)
-f, --filename <template> Output filename template (yt-dlp style)
-c, --cookies <path> Cookies file in Netscape format
--cookies-from-browser <name> Import cookies from a browser (chrome edge firefox brave)
-p, --proxy <url> Proxy URL (e.g. socks5://127.0.0.1:9050)
--max-concurrency <n> Number of parallel downloads (default: 2)
--subs Download & embed subtitles
--sub-langs <langs> Subtitles languages (e.g. en.,pt.)
--thumb / --no-thumb Embed thumbnail (default: true)
--playlist Allow playlist extraction (default: false)
--safe-names Restrict filenames to ASCII/portable set
--dry-run Print yt-dlp command(s) without running them
--verbose Show full yt-dlp output

Running Tests

Bun Media Grabber Tests

Unit + Integration (E2E)

bun test

Run E2E tests with real downloads (optionally, set your URLs first)

E2E_URL_YT="https://www.youtube.com/watch?v=XXXX" \
E2E_URL_TW="https://x.com/username/status/XXXX" \
E2E_URL_SC="https://soundcloud.com/artist/track" \
bun test tests/integration.e2e.test.ts

Project Structure

src/
  cli.ts      # CLI entrypoint (Commander)
  core.ts     # Core logic: args builder, yt-dlp execution
tests/
  integration.e2e.test.ts  # Real download tests (E2E)
  core.test.ts             # Unit tests for args/builders
  utils/assertOutput.ts    # Helper to validate downloaded files

Why Bun?

  • Lightning-fast CLI execution.
  • Built-in TypeScript & module resolution.
  • Native spawn API for efficient streaming output.
  • Clean bundling with zero overhead.

License

MIT License.

About

Fast CLI to download videos and audios from YouTube, X, TikTok, SoundCloud and more — powered by yt-dlp + ffmpeg, wrapped in Bun.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages