@distube/yt-dlp

中文文档
2.0.1发布于 2024/06/07MITTypeScriptCommonJS构建来源已验证近 30 天下载 3956

A DisTube playable extractor plugin using yt-dlp.

原始使用文档
文档目录5 节
  1. new YtDlpPlugin([YtDlpPluginOptions])
  2. Environment Variables
  3. Troubleshooting
  4. Failed to install (Status code: 403)
  5. Failed to run the plugin (Status code: 403)

npm peer dependency version npm GitHub Repo stars Discord

Buy Me a Coffee at ko-fi.com

@distube/yt-dlp

A DisTube playable extractor plugin using yt-dlp

What is a playable extractor plugin?

Feature

Requirement

Installation

npm install @distube/yt-dlp@latest

Usage

import { DisTube } from "distube";
import { YtDlpPlugin } from "@distube/yt-dlp";

const distube = new DisTube(client, {
  plugins: [new YtDlpPlugin({ update: true })],
});

Documentation

new YtDlpPlugin([YtDlpPluginOptions])

Create a DisTube's ExtractorPlugin instance.

  • YtDlpPluginOptions.update (boolean): Default is true. Update the yt-dlp binary when the plugin is initialized.

YtDlpPlugin should be the last plugin in the plugins array.

Environment Variables

  • YTDLP_DISABLE_DOWNLOAD: Set it to disable download yt-dlp binary.
  • YTDLP_URL: The URL of the yt-dlp binary to download.
  • YTDLP_DIR: The directory to download the yt-dlp binary.
  • YTDLP_FILENAME: The filename of the yt-dlp binary.

Troubleshooting

Failed to install (Status code: 403)

Your IP has been rate-limited by GitHub and the plugin cannot get the latest link to the yt-dlp binary. You can change the download link by using the environment variable YTDLP_URL, or disable download by setting YTDLP_DISABLE_DOWNLOAD to true.

export YTDLP_URL=https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp
npm install @distube/yt-dlp@latest
export YTDLP_DISABLE_DOWNLOAD=true
npm install @distube/yt-dlp@latest

Failed to run the plugin (Status code: 403)

The plugin cannot download the yt-dlp binary on startup. Same as the previous case. You can disable download on startup by using new YtDlpPlugin({ update: false }) or using above solution.

import { DisTube } from "distube";
const distube = new DisTube(client, {
  plugins: [new YtDlpPlugin({ update: false })],
});

版本与发布记录

@distube/yt-dlp 共发布 12 个版本,首次发布于 2022/01/27;过去 12 个月发布了 0 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.0.1latest2024/06/072 年前
2.0.02024/06/052 年前
1.1.32022/07/184 年前
1.1.2-12022/07/184 年前
1.1.22022/07/184 年前
1.1.12022/07/164 年前

关于 @distube/yt-dlp 的常见问题

@distube/yt-dlp 是什么?

A DisTube playable extractor plugin using yt-dlp.

如何安装 @distube/yt-dlp?

在项目目录运行 npm install @distube/yt-dlp,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:distube(5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@distube/yt-dlp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@distube/yt-dlp 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@distube/yt-dlp 可以商用吗?

@distube/yt-dlp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@distube/yt-dlp 的下载量有多少?

根据 npm 官方下载统计,@distube/yt-dlp 在 2026/10/13 – 2026/11/11 这 30 天内被下载 3,956 次,日均约 132 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@distube/yt-dlp 还在维护吗?

最新版本 2.0.1 发布于 2024/06/07(2 年前);至今共发布 12 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/01/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。