npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@minhchi1509/ytdl

v1.0.1

Published

[![npm version](https://badge.fury.io/js/%40minhchi1509%2Fytdl.svg)](https://www.npmjs.com/package/@minhchi1509/ytdl) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Readme

🎬 YouTube Video Downloader CLI

npm version License: MIT

Một công cụ dòng lệnh (CLI) mạnh mẽ và dễ sử dụng để tải video YouTube với chất lượng cao, hỗ trợ cả video thường và YouTube Shorts.

✨ Tính năng

  • 🎯 Tải video YouTube và Shorts với chất lượng tùy chọn
  • 🔧 Hợp nhất audio và video tự động bằng FFmpeg
  • 📁 Tùy chọn thư mục lưu linh hoạt (mặc định hoặc tùy chỉnh)
  • 🎨 Giao diện thân thiện với emoji và màu sắc
  • Kiểm tra dependencies tự động (FFmpeg)
  • 📊 Hiển thị thông tin file (kích thước video/audio)

📋 Yêu cầu hệ thống

🔴 Bắt buộc: Cài đặt FFmpeg trước

Trước khi sử dụng công cụ này, bạn BẮT BUỘC phải cài đặt FFmpeg:

Windows

# Sử dụng Chocolatey
choco install ffmpeg

# Hoặc sử dụng Scoop
scoop install ffmpeg

# Hoặc tải từ trang chính thức
# https://ffmpeg.org/download.html

MacOS

# Sử dụng Homebrew
brew install ffmpeg

Linux (Ubuntu/Debian)

sudo apt update
sudo apt install ffmpeg

Linux (CentOS/RHEL)

sudo yum install ffmpeg
# hoặc
sudo dnf install ffmpeg

Kiểm tra cài đặt FFmpeg

ffmpeg -version

🚀 Cài đặt và sử dụng

Cách 1: Sử dụng trực tiếp với npx (Khuyến nghị)

npx @minhchi1509/ytdl

Cách 2: Cài đặt global

# Cài đặt
npm install -g @minhchi1509/ytdl

# Sử dụng
@minhchi1509/ytdl

🎮 Hướng dẫn sử dụng

  1. Chạy lệnh CLI:

    npx @minhchi1509/ytdl
  2. Công cụ sẽ tự động kiểm tra FFmpeg:

    • ✅ Nếu đã cài đặt: Tiếp tục
    • ❌ Nếu chưa cài: Hiển thị hướng dẫn và dừng
  3. Nhập URL YouTube:

    Nhập URL video YouTube cần tải: https://www.youtube.com/watch?v=...

    Hỗ trợ các định dạng:

    • Video thường: https://youtube.com/watch?v=VIDEO_ID
    • YouTube Shorts: https://youtube.com/shorts/VIDEO_ID
  4. Chọn chất lượng video:

    ? Chọn chất lượng video:
    ❯ 1080p (Video: 15.2MB, Audio: 2.1MB)
      720p (Video: 8.7MB, Audio: 2.1MB)
      480p (Video: 4.3MB, Audio: 2.1MB)
  5. Chọn thư mục lưu:

    • Nếu có thư mục Downloads: Hỏi có dùng mặc định không
    • Nếu không có: Yêu cầu nhập đường dẫn tùy chỉnh
  6. Chờ tải hoàn thành:

    🔍 Đang lấy thông tin video...
    ✅ Đã chọn chất lượng: 1080p
    📁 Video sẽ được lưu tại: C:\Users\...\Downloads\video_ABC123.mp4
    📥 Bắt đầu tải video và audio...
    ✅ Tải file thành công
    🎬 Đang hợp nhất video và audio...
    ✅ Hợp nhất video + audio thành công
    🎉 Tải video thành công! File đã được lưu tại: ...

📝 Ví dụ sử dụng

# Tải một video YouTube
npx @minhchi1509/ytdl
# Nhập: https://www.youtube.com/watch?v=dQw4w9WgXcQ

# Tải một YouTube Short
npx @minhchi1509/ytdl
# Nhập: https://www.youtube.com/shorts/abc123xyz

🛠️ Development

Clone và cài đặt dependencies

git clone <repository-url>
cd youtube_video_download_cli
bun install

Build project

bun run build

Chạy trong môi trường development

bun run src/main.ts

📦 Cấu trúc thư mục

youtube_video_download_cli/
├── src/
│   ├── main.ts          # Entry point chính
│   └── utils.ts         # Các utility functions
├── package.json
├── tsconfig.json
├── esbuild.config.ts
└── README.md

🔧 Cách hoạt động

  1. Kiểm tra FFmpeg - Đảm bảo FFmpeg đã được cài đặt
  2. Xác thực URL - Kiểm tra URL YouTube hợp lệ
  3. Lấy metadata - Gọi API để lấy thông tin video và các định dạng available
  4. Chọn chất lượng - Người dùng chọn chất lượng mong muốn
  5. Tải files - Tải song song video và audio streams
  6. Hợp nhất - Sử dụng FFmpeg để hợp nhất video + audio
  7. Dọn dẹp - Xóa các file tạm

⚠️ Lưu ý quan trọng

  • FFmpeg là bắt buộc - Công cụ sẽ không hoạt động nếu thiếu FFmpeg
  • Tuân thủ bản quyền - Chỉ tải video bạn có quyền hoặc để sử dụng cá nhân
  • Kết nối internet - Cần internet ổn định để tải video
  • Dung lượng đĩa - Đảm bảo có đủ không gian lưu trữ

🤝 Đóng góp

Mọi đóng góp đều được chào đón! Vui lòng:

  1. Fork repository
  2. Tạo feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Mở Pull Request

📄 License

Dự án này được phân phối dưới giấy phép MIT. Xem file LICENSE để biết thêm thông tin.

👨‍💻 Tác giả

Minh Chi - @minhchi1509

🙏 Acknowledgments

  • FFmpeg - Công cụ xử lý multimedia mạnh mẽ
  • Inquirer.js - Interactive command line interface
  • Axios - HTTP client cho Node.js

Nếu thấy hữu ích, hãy để lại một star nhé!