@distube/ytpl

中文文档
1.2.4发布于 2025/12/21MITTypeScriptCommonJS构建来源已验证近 30 天下载 8206

Anonymous YouTube playlist resolver. Made for distube.js.org

此软件包已被标记为弃用

Unmaintained. Use Ytdl#getPlaylist from @distube/ytdl-core 5: https://github.com/distubejs/ytdl-core/blob/main/docs/guides/playlists.md

原始使用文档
文档目录3 节
  1. ytpl(id, [options])
  2. ytpl.validateID(string)
  3. ytpl.getPlaylistID(string)

@distube/ytpl

A light-weight ytpl for DisTube. Original ytpl. Simple js only package to resolve YouTube Playlists. Does not require any login or Google-API-Key.

Installation

npm install @distube/ytpl

Usage

const ytpl = require("@distube/ytpl");

const playlist = await ytpl("https://www.youtube.com/playlist?list=PLRBp0Fe2GpglkzuspoGv-mu7B2ce9_0Fn");

API

ytpl(id, [options])

Attempts to resolve the given playlist id

  • id

    • id of the yt-playlist
    • or a playlist url
    • or a user url (resolves to uploaded playlist)
    • or a channel url (resolves to uploaded playlist)
  • options

    • object with options
    • possible settings:
    • gl[String] -> 2-Digit Code of a Country, defaults to US - Allows for localisation of the request
    • hl[String] -> 2-Digit Code for a Language, defaults to en - Allows for localisation of the request
    • utcOffsetMinutes[Number] -> Offset in minutes from UTC, defaults to -300 - Allows for localisation of the request
    • limit[Number] -> limits the pulled items, defaults to 100, set to Infinity to get the whole playlist - numbers <1 result in the default being used
    • requestOptions[Object] -> All additional parameters will get passed to undici's request options, which is used to do the https requests
  • returns a Promise

  • Example response

ytpl.validateID(string)

Returns true if able to parse out a (formally) valid playlist ID.

ytpl.getPlaylistID(string)

Returns a playlist ID from a YouTube URL. Can be called with the playlist ID directly, in which case it resolves.

Returns a promise.

Related / Works well with

版本与发布记录

@distube/ytpl 共发布 24 个版本,首次发布于 2020/11/13;过去 12 个月发布了 1 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.2.4latest2025/12/2110 个月前
1.2.32025/06/011.4 年前
1.2.22025/05/251.5 年前
1.2.12023/09/233 年前
1.2.02023/09/233 年前
1.1.52023/09/103 年前

关于 @distube/ytpl 的常见问题

@distube/ytpl 是什么?

Anonymous YouTube playlist resolver. Made for distube.js.org注意:该包已被作者标记为弃用——Unmaintained. Use Ytdl#getPlaylist from @distube/ytdl-core 5: https://github.com/distubejs/ytdl-core/blob/main/docs/guides/playlists.md

如何安装 @distube/ytpl?

在项目目录运行 npm install @distube/ytpl,或使用 pnpm add / yarn add / bun add。

@distube/ytpl 支持 TypeScript 吗?

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

@distube/ytpl 支持 ESM 还是 CommonJS?

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

@distube/ytpl 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@distube/ytpl 可以商用吗?

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

@distube/ytpl 的下载量有多少?

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

@distube/ytpl 还在维护吗?

最新版本 1.2.4 发布于 2025/12/21(10 个月前);至今共发布 24 个版本,其中过去 12 个月发布了 1 个;首次发布于 2020/11/13。作者已将其标记为弃用,新项目建议寻找替代方案。