@distube/youtube
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

npm peer dependency version npm GitHub Repo stars Discord

Buy Me a Coffee at ko-fi.com

@distube/youtube

A DisTube extractor plugin for supporting YouTube.

What is an extractor plugin?

Feature

  • Scraping YouTube data without using API key
  • Support YouTube video playlists
  • Search on YouTube
  • Play video directly from YouTube

Usage

Plugin

import { DisTube } from "distube";
import { YouTubePlugin } from "@distube/youtube";

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

Search

import { DisTube } from "distube";
import { YouTubePlugin } from "@distube/youtube";

const youtubePlugin = new YouTubePlugin({
  cookies: [
    // ...
  ],
});

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

const results = await distube.search("test", { type: "video", limit: 10 });
console.log(results);

Documentation

YouTubePlugin

YouTubePlugin([YouTubePluginOptions])

  • YoutubePluginOptions.cookies: (Optional) YouTube cookies. See: How to get YouTube cookies
  • YoutubePluginOptions.ytdlOptions: (Optional) ytdl-core options.

YouTubePlugin#search(query, [options]): Promise<Song[]|SearchResultPlaylist[]>

  • query: Search query string
  • options: Search options
  • options.type: Type of results (video or playlist)
  • options.limit: Maximum number of results to return
  • options.safeSearch: Whether or not use safe search (YouTube restricted mode)

SearchResultPlaylist

  • id: Playlist ID
  • name: Playlist name
  • url: Playlist URL
  • length: Number of videos in the playlist
  • uploader: Playlist owner
  • uploader.name: Playlist owner name
  • uploader.url: Playlist owner URL

Package Sidebar

Install

npm i @distube/youtube

Weekly Downloads

249

Version

1.0.4

License

MIT

Unpacked Size

69.5 kB

Total Files

8

Last publish

Collaborators

  • skick