1.2.1 • Published 8 months ago

@distube/ytpl v1.2.1

Weekly downloads
2,814
License
MIT
Repository
github
Last release
8 months ago

@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:
    • glString -> 2-Digit Code of a Country, defaults to US - Allows for localisation of the request
    • hlString -> 2-Digit Code for a Language, defaults to en - Allows for localisation of the request
    • utcOffsetMinutesNumber -> Offset in minutes from UTC, defaults to -300 - Allows for localisation of the request
    • limitNumber -> limits the pulled items, defaults to 100, set to Infinity to get the whole playlist - numbers <1 result in the default being used
    • requestOptionsObject -> 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

1.2.0

8 months ago

1.1.5

8 months ago

1.1.4

8 months ago

1.1.3

8 months ago

1.2.1

8 months ago

1.1.2

9 months ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago