ytmusic-distube-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

ytmusic-distube-plugin

Unofficial YouTube Music Plugin for DisTube

Installation

npm install ytmusic-distube-plugin

Usage

const { DisTube } = require("distube");
const { YouTubeMusicPlugin } = require("ytmusic-distube-plugin");

const distube = new DisTube({
  plugins: [new YouTubeMusicPlugin()],
});

Options

new YouTubeMusicPlugin({
  // Whether to emit events after fetching or not (Default: true)
  emitEventsAfterFetching: true,
  // Whether to fetch the song/playlist before adding to the queue or not (Default: false)
  fetchBeforeQueued: false,
  // Whether to process playlist tracks in parallel or sequentially (Default: true)
  parallel: true,
  // Maximum number of tracks to fetch from playlists, albums, and artists (Default: 10)
  maxViews: 10,
});

Supported URLs

  • YouTube Music video: https://music.youtube.com/watch?v=xxx
  • YouTube Music playlist: https://music.youtube.com/playlist?list=xxx
  • YouTube Music album: https://music.youtube.com/browse/MPREb_xxx
  • YouTube Music artist: https://music.youtube.com/channel/xxx
  • YouTube video: https://www.youtube.com/watch?v=xxx

Features

Play from YouTube Music

// Play YouTube Music
distube.play(voiceChannel, "https://music.youtube.com/watch?v=xxx", options);

// Play a YouTube Music playlist
distube.play(voiceChannel, "https://music.youtube.com/playlist?list=xxx", options);

// Play a YouTube Music album
distube.play(voiceChannel, "https://music.youtube.com/browse/MPREb_xxx", options);

// Play a YouTube Music artist
distube.play(voiceChannel, "https://music.youtube.com/channel/xxx", options);

Search on YouTube Music

const song = await distube.search("Hanya Rindu")[0];
distube.play(voiceChannel, song, options);

Get Related Songs

Related songs can be automatically played when using the plugin with the DisTube's autoplay feature enabled. It will use this plugin to get related songs from YouTube Music.

// Enable autoplay mode to use related songs
distube.toggleAutoplay(message);

Testing

To run the tests:

npm test

Disclaimer

This is an unofficial plugin for DisTube. It is not endorsed by or affiliated with DisTube or YouTube Music. This plugin is developed independently to add YouTube Music support to DisTube.

Acknowledgements

This plugin makes use of the following libraries:

License

MIT © abiyyufahri

Package Sidebar

Install

npm i ytmusic-distube-plugin

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

45.6 kB

Total Files

7

Last publish

Collaborators

  • abiyyufahri