@distube/youtube
v1.0.4
Published
A DisTube extractor plugin for supporting YouTube.
Downloads
1,912
Readme
@distube/youtube
A DisTube extractor plugin for supporting YouTube.
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 cookiesYoutubePluginOptions.ytdlOptions
: (Optional) ytdl-core options.
YouTubePlugin#search(query, [options]): Promise<Song[]|SearchResultPlaylist[]>
query
: Search query stringoptions
: Search optionsoptions.type
: Type of results (video
orplaylist
)options.limit
: Maximum number of results to returnoptions.safeSearch
: Whether or not use safe search (YouTube restricted mode)
SearchResultPlaylist
id
: Playlist IDname
: Playlist nameurl
: Playlist URLlength
: Number of videos in the playlistuploader
: Playlist owneruploader.name
: Playlist owner nameuploader.url
: Playlist owner URL