1.0.4 • Published 12 months ago

@distube/youtube v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

@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
1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.1

1 year ago