A DisTube extractor plugin for supporting YouTube.
- Scraping YouTube data without using API key
- Support YouTube video playlists
- Search on YouTube
- Play video directly from YouTube
import { DisTube } from "distube";
import { YouTubePlugin } from "@distube/youtube";
const distube = new DisTube(client, {
plugins: [new YouTubePlugin()],
});
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);
-
YoutubePluginOptions.cookies
: (Optional) YouTube cookies. See: How to get YouTube cookies -
YoutubePluginOptions.ytdlOptions
: (Optional) ytdl-core options.
-
query
: Search query string -
options
: Search options -
options.type
: Type of results (video
orplaylist
) -
options.limit
: Maximum number of results to return -
options.safeSearch
: Whether or not use safe search (YouTube restricted mode)
-
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