New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discord-player-youtubei

Package Overview
Dependencies
Maintainers
0
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-player-youtubei

An unofficial package to test the use of youtubei in discord-player v6.

  • 1.2.1-alpha.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
915
decreased by-28.63%
Maintainers
0
Weekly downloads
 
Created
Source

Discord Player YouTubei

This is a preview the v7 version of the YouTube system that discord-player will be using made backwards compatiable with v6.

Installation

$ npm install discord-player-youtubei
# ----------- or -----------
$ yarn add discord-player-youtubei

Usage

Typescript and ESM
import { YoutubeiExtractor } from "discord-player-youtubei"

const player = useMainPlayer() // or new Player()

player.extractors.register(YoutubeiExtractor, {})
CommonJS
const { YoutubeiExtractor } = require("discord-player-youtubei")

const player = useMainPlayer() // or new Player()

player.extractors.register(YoutubeiExtractor, {})

I have seen many people registering the extractor in their commands. DO NOT DO THIS

Signing into YouTube

First run the following command

$ npx --no discord-player-youtubei

The token will be printed out shortly

In case of errors, you can directly run the generateOauthTokens function exported by discord-player-youtubei

import { YoutubeiExtractor } from "discord-player-youtubei"

const player = useMainPlayer()
const oauthTokens = getOauthTokens() // The tokens printed from step above

player.extractors.register(YoutubeiExtractor, {
    authentication: oauthTokens
})

Rotating your token

Since Youtube has a hard limt (which is not that strict), we can provide a rotator config when registering the extractor. View Rotator

Options for YoutubeiExtractor

interface RotatorShardOptions {
	authentications: string[];
	rotationStrategy: "shard";
	currentShard: number;
}

interface RotatorRandomOptions {
	authentications: string[];
	rotationStrategy: "random";
}

type RotatorConfig = RotatorShardOptions | RotatorRandomOptions

interface YoutubeiOptions {
	authentication?: string;
	overrideDownloadOptions?: DownloadOptions;
	createStream?: (q: Track, extractor: BaseExtractor<object>) => Promise<string | Readable>;
	signOutOnDeactive?: boolean;
	streamOptions?: {
		useClient?: InnerTubeClient
	};
	rotator?: RotatorConfig
}

Want to support us?

Just star this repo!

Notice Regarding YouTube Streaming

Streaming from YouTube is against their Terms of Service (ToS). Refer to LEGAL.md to view the risks using YouTube.

FAQs

Package last updated on 30 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc