Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord-ytdl-core

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-ytdl-core - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

4

index.d.ts
import ytdl, { downloadOptions } from "ytdl-core";
import prism from "prism-media";
interface CreateOpusStreamOptions extends downloadOptions {
interface StreamOptions extends downloadOptions {
seek?: number;
encoderArgs?: any[];
}
declare const DiscordYTDLCore: ((url: string, options: CreateOpusStreamOptions) => prism.opus.Encoder) & typeof ytdl;
declare const DiscordYTDLCore: ((url: string, options: StreamOptions) => prism.opus.Encoder) & typeof ytdl;
export = DiscordYTDLCore;

@@ -9,7 +9,18 @@ "use strict";

/**
* Create an opus stream for your video with provided encoder args
* @param url - YouTube URL of the video
* @param options - YTDL options
*/
const createOpusStream = (url, options) => {
* Create an opus stream for your video with provided encoder args
* @param url - YouTube URL of the video
* @param options - YTDL options
* @param [options.seek] seek - Time in seconds to seek
* @param [options.encoderArgs] encoderArgs - FFmpeg encoder args
* @returns {Stream}
* @example const ytdl = require("discord-ytdl-core");
* const stream = ytdl("VIDEO_URL", {
* seek: 3,
* encoderArgs: ["-af", "bass=g=20,dynaudnorm=f=200"]
* });
* VoiceConnection.play(stream, {
* type: "opus"
* });
*/
const OpusStream = (url, options) => {
if (!url) {

@@ -19,3 +30,3 @@ throw new Error("No input url provided");

if (typeof url !== "string") {
throw new SyntaxError("input URL must be a string");
throw new SyntaxError(`input URL must be a string. Received ${typeof url}!`);
}

@@ -52,3 +63,3 @@ let FFmpegArgs = [

};
const DiscordYTDLCore = Object.assign(createOpusStream, ytdl_core_1.default);
const DiscordYTDLCore = Object.assign(OpusStream, ytdl_core_1.default);
module.exports = DiscordYTDLCore;
import ytdl, { downloadOptions } from "ytdl-core";
import prism from "prism-media";
interface CreateOpusStreamOptions extends downloadOptions {
interface StreamOptions extends downloadOptions {
seek?: number;

@@ -10,7 +10,18 @@ encoderArgs?: any[];

/**
* Create an opus stream for your video with provided encoder args
* @param url - YouTube URL of the video
* @param options - YTDL options
*/
const createOpusStream = (url: string, options: CreateOpusStreamOptions) => {
* Create an opus stream for your video with provided encoder args
* @param url - YouTube URL of the video
* @param options - YTDL options
* @param [options.seek] seek - Time in seconds to seek
* @param [options.encoderArgs] encoderArgs - FFmpeg encoder args
* @returns {Stream}
* @example const ytdl = require("discord-ytdl-core");
* const stream = ytdl("VIDEO_URL", {
* seek: 3,
* encoderArgs: ["-af", "bass=g=20,dynaudnorm=f=200"]
* });
* VoiceConnection.play(stream, {
* type: "opus"
* });
*/
const OpusStream = (url: string, options: StreamOptions) => {
if (!url) {

@@ -20,3 +31,3 @@ throw new Error("No input url provided");

if (typeof url !== "string") {
throw new SyntaxError("input URL must be a string");
throw new SyntaxError(`input URL must be a string. Received ${typeof url}!`);
}

@@ -62,5 +73,5 @@

const DiscordYTDLCore = Object.assign(createOpusStream, ytdl);
const DiscordYTDLCore = Object.assign(OpusStream, ytdl);
export = DiscordYTDLCore;
{
"name": "discord-ytdl-core",
"version": "3.0.0",
"version": "3.0.1",
"description": "Simple ytdl wrapper for discord bots with custom ffmpeg args support.",

@@ -45,3 +45,3 @@ "main": "index.js",

"prism-media": "^1.2.2",
"ytdl-core": "^2.1.5"
"ytdl-core": "^3.1.1"
},

@@ -52,4 +52,3 @@ "devDependencies": {

"ffmpeg-static": "^4.0.1"
},
"runkitExampleFilename": "example.js"
}
}

@@ -17,5 +17,5 @@ # [discord-ytdl-core](https://discord-ytdl-core.netlify.app "Documentation")

## **Supported Opus Engines:**
- **[@discordjs/opus](https://npmjs.com/package/@discordjs/opus)** - Best performance
- **[node-opus](https://npmjs.com/package/node-opus)** - Deprecated
## **Supported Opus Engines**
- **[@discordjs/opus](https://npmjs.com/package/@discordjs/opus)**
- **[node-opus](https://npmjs.com/package/node-opus)**
- **[opusscript](https://npmjs.com/package/opusscript)**

@@ -50,7 +50,7 @@

if (msg.author.bot || !msg.guild) return;
if (msg.content === "??play") {
if (msg.content === "!play") {
if (!msg.member.voice.channel) return msg.channel.send("You're not in a voice channel?");
let stream = ytdl("https://youtube.com/watch?v=ERu6jh_1gR0", {
filter: "audioonly",
encoderArgs: ['-af', 'equalizer=f=40:width_type=h:width=50:g=10'] // FFmpeg args array (optional)
encoderArgs: ['-af', 'bass=g=10,dynaudnorm=f=200'] // Sets Bass Boost
});

@@ -73,10 +73,4 @@

# Example Bots
- **[P74Y](https://github.com/Snowflake107/P74Y)**
> **If you have a bot which uses this package, create a Pull Request.**
# Other functions
This package can do all the functions of normal **[ytdl-core](https://npmjs.com/package/ytdl-core)**.
Visit **[ytdl-core](https://npmjs.com/package/ytdl-core)** for other functions.

@@ -83,0 +77,0 @@ # Related

Sorry, the diff of this file is not supported yet

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