DEV Community

Cover image for Tired of Messy Media Downloaders? Build a Smart CLI with Node.js and yt-dlp 🚀
Ariska Hidayat
Ariska Hidayat

Posted on

Tired of Messy Media Downloaders? Build a Smart CLI with Node.js and yt-dlp 🚀

As developers, we love the terminal. It’s fast, scriptable, and efficient. But when it comes to downloading media for local testing, presentations, or offline use, we often find ourselves using shady websites or struggling with complex flags in yt-dlp.

That’s why I built Media-DL Pro, a smart CLI wrapper that handles everything—from dependency management to bot protection—automatically.


🛑 The Problem

yt-dlp is powerful, but it has a learning curve. You need to manage ffmpeg for merging streams, remember complex arguments for high-quality formats, and deal with potential IP bans if you download too fast.

✅ The Solution: Media-DL Pro

I wanted a tool that:

  1. Works Everywhere: Windows, macOS, Linux, and even Termux on Android.
  2. Auto-Installs Engines: It detects if you have yt-dlp or ffmpeg. If not, it downloads them to a local hidden directory (~/.media-dl).
  3. Has a "Safe Mode": Naturally bypasses bot detection using smart rate-limiting and randomized sleep intervals.

🛠️ Technical Highlights

1. Cross-Platform Auto-Installer

The core of Media-DL is its ability to adapt. Whether it's using powershell on Windows, curl on Mac, or pkg/pip on Termux, the tool ensures you are ready to go in seconds.

2. Smart Selection Logic

Downloading a playlist? You don't have to download all 100 videos. Media-DL allows for selective input like 1,3,5-10.

3. Safe Mode Guard™

To keep your IP safe, the tool implements:

  • Rate Limiting: Capped at 5MB/s.
  • Smart Sleep: 3–10 seconds delay between downloads.
  • Modern User-Agents: Spoofing browser headers to look like a real user.

📦 Quick Start

You can install it globally via npm:

npm install -g media-dl

Enter fullscreen mode Exit fullscreen mode

Usage

There are two ways to use it:

1. Interactive Mode
Just type the command and follow the beautiful UI:

media-dl

Enter fullscreen mode Exit fullscreen mode

2. Direct Download (Fast Mode)
Pass the URL directly as an argument:

media-dl https://www.youtube.com/watch?v=example

Enter fullscreen mode Exit fullscreen mode

📂 Automated File Organization

No more messy "Downloads" folders. Media-DL organizes everything:

  • ~/Downloads/media-dl/video/
  • ~/Downloads/media-dl/audio/
  • Playlist folders are automatically named based on the source title.

🌟 Open Source & Contributing

This project is built with Node.js and is fully open-source under the MIT License. I’d love to hear your feedback or see your PRs!

If this tool saves you time, feel free to give it a ⭐ on GitHub!


Happy Coding!

Top comments (0)