Gathering detailed insights and metrics for @distube/ytdl
Gathering detailed insights and metrics for @distube/ytdl
Gathering detailed insights and metrics for @distube/ytdl
Gathering detailed insights and metrics for @distube/ytdl
@distube/ytdl-core
DisTube fork of ytdl-core. YouTube video downloader in pure javascript.
garfield-ytdl
DisTube fork of ytdl-core. YouTube video downloader in pure javascript.
@quanghd96/ytdl-core
DisTube fork of ytdl-core. YouTube video downloader in pure javascript.
toddys-youtube
An fork of @distube/youtube, for memory optimization, etc
npm install @distube/ytdl
Typescript
Module System
Node Version
NPM Version
72.3
Supply Chain
98.8
Quality
75.6
Maintenance
100
Vulnerability
99.3
License
Total Downloads
560,699
Last Day
65
Last Week
436
Last Month
1,534
Last Year
17,113
Minified
Minified + Gzipped
Latest Version
2.0.6
Package Id
@distube/ytdl@2.0.6
Size
8.08 kB
NPM Version
6.14.12
Node Version
14.16.1
Published on
May 06, 2021
Cumulative downloads
Total Downloads
Last Day
66.7%
65
Compared to previous day
Last Week
33.3%
436
Compared to previous week
Last Month
-24.4%
1,534
Compared to previous month
Last Year
34%
17,113
Compared to previous year
1
1
4
Simple ytdl wrapper for discord bots with custom ffmpeg args support.
1npm i @distube/ytdl
https://www.npmjs.com/package/@distube/ytdl
Please install opus engine if you want to encode the stream to opus format.
Similar to ytdl-core but this method allows you to pass custom FFmpeg args in options.
1ytdl("https://youtube.com/watch?v=ERu6jh_1gR0", { 2 filter: "audioonly", 3 fmt: "mp3", 4 encoderArgs: ['-af', 'bass=g=10'] 5}).pipe(fs.createWritestream("bass_boosted.mp3")); 6 7ytdt.getInfo("https://www.youtube.com/watch?v=ERu6jh_1gR0") 8 .then(info => 9 ytdl.downloadFromInfo(info, { 10 filter: "audioonly", 11 fmt: "mp3", 12 encoderArgs: ['-af', 'bass=g=10'] 13 }).pipe(fs.createWritestream("bass_boosted.mp3")) 14 ) 15
This method allows you to play the stream from other sources rather than just youtube
. Stream source must be a string or stream object (internal.Readable | internal.Duplex).
Through URL: https://listen.moe/kpop/opus
Using fs:
1let stream = fs.createReadStream("./music.mp4");
2ytdl.arbitraryStream(stream, {
3 fmt: "mp3",
4 encoderArgs: ["bass=g=5"]
5}).pipe(fs.createWriteStream("./music.mp3"))
6
This package provides 4 extra options excluding ytdl-core options.
seek
: This option takes the time in seconds.
If this option is provided, it will return the stream from that frame.
Seek option is provided here because discord.js seek doesn't work for ogg/opus
& webm/opus
stream.
This option is ignored when the supplied parameter type isn't a number.
encoderArgs
: This option takes the Array of FFmpeg arguments.
Invalid args will throw error and crash the process.
This option is ignored when the supplied parameter type isn't array. Invalid FFmpeg args might crash the process.
opusEncoded
: This option takes a Boolean value. If true, it returns opus encoded
stream.
If fmt
option isn't provided, it returns converted
stream type of discord.js. Other values returns unknown
stream if opusEncoded
is false.
fmt
: Forcefully changes the stream format. Don't use this option for default value. Even though this option changes the format,
it returns opus
stream if opusEncoded
is set to true
.
Other options are the options for ytdl-core.
1const ytdl = require("discord-ytdl-core"); 2const Discord = require("discord.js"); 3const client = new Discord.Client(); 4 5client.on("ready", () => { 6 console.log("ready") 7}); 8 9client.on("message", msg => { 10 if (msg.author.bot || !msg.guild) return; 11 if (msg.content === "!play") { 12 if (!msg.member.voice.channel) return msg.channel.send("You're not in a voice channel?"); 13 let stream = ytdl("https://youtube.com/watch?v=ERu6jh_1gR0", { 14 filter: "audioonly", 15 opusEncoded: true, 16 encoderArgs: ['-af', 'bass=g=10,dynaudnorm=f=200'] 17 }); 18 19 msg.member.voice.channel.join() 20 .then(connection => { 21 let dispatcher = connection.play(stream, { 22 type: "opus" 23 }) 24 .on("finish", () => { 25 msg.guild.me.voice.channel.leave(); 26 }) 27 }); 28 } 29}); 30 31client.login("TOKEN");
1const ytdl = require("discord-ytdl-core"); 2const Discord = require("discord.js"); 3const client = new Discord.Client(); 4 5client.on("ready", () => { 6 console.log("ready") 7}); 8 9client.on("message", msg => { 10 if (msg.author.bot || !msg.guild) return; 11 if (msg.content === "!play") { 12 if (!msg.member.voice.channel) return msg.channel.send("You're not in a voice channel?"); 13 let stream = ytdl("https://youtube.com/watch?v=ERu6jh_1gR0", { 14 filter: "audioonly", 15 opusEncoded: false, 16 fmt: "mp3", 17 encoderArgs: ['-af', 'bass=g=10,dynaudnorm=f=200'] 18 }); 19 20 msg.member.voice.channel.join() 21 .then(connection => { 22 let dispatcher = connection.play(stream, { 23 type: "unknown" 24 }) 25 .on("finish", () => { 26 msg.guild.me.voice.channel.leave(); 27 }) 28 }); 29 } 30}); 31 32client.login("TOKEN");
1const ytdl = require("discord-ytdl-core"); 2const Discord = require("discord.js"); 3const client = new Discord.Client(); 4 5client.on("ready", () => { 6 console.log("ready") 7}); 8 9client.on("message", msg => { 10 if (msg.author.bot || !msg.guild) return; 11 if (msg.content === "!play") { 12 if (!msg.member.voice.channel) return msg.channel.send("You're not in a voice channel?"); 13 let stream = ytdl("https://youtube.com/watch?v=ERu6jh_1gR0", { 14 filter: "audioonly", 15 opusEncoded: false, 16 encoderArgs: ['-af', 'bass=g=10,dynaudnorm=f=200'] 17 }); 18 19 msg.member.voice.channel.join() 20 .then(connection => { 21 let dispatcher = connection.play(stream, { 22 type: "converted" 23 }) 24 .on("finish", () => { 25 msg.guild.me.voice.channel.leave(); 26 }) 27 }); 28 } 29}); 30 31client.login("TOKEN");
1const ytdl = require("../index.js"); 2const { createWriteStream } = require ("fs"); 3 4const url = "https://www.youtube.com/watch?v=zrwTYozyzYA"; 5 6let stream = ytdl(url, { 7 encoderArgs: ["-af", "asetrate=44100*1.25,bass=g=20,dynaudnorm=f=150"], 8 fmt: "mp3", 9 opusEncoded: false 10}); 11 12stream.pipe(createWriteStream(__dirname+"/test.mp3")); 13
1const ytdl = require("discord-ytdl-core"); 2const Discord = require("discord.js"); 3const client = new Discord.Client(); 4 5client.on("ready", () => { 6 console.log("ready") 7}); 8 9client.on("message", msg => { 10 if (msg.author.bot || !msg.guild) return; 11 if (msg.content === "!play") { 12 if (!msg.member.voice.channel) return msg.channel.send("You're not in a voice channel?"); 13 let stream = ytdl.arbitraryStream("https://listen.moe/kpop/opus", { 14 opusEncoded: true, 15 encoderArgs: ['-af', 'bass=g=10,dynaudnorm=f=200'] 16 }); 17 18 msg.member.voice.channel.join() 19 .then(connection => { 20 let dispatcher = connection.play(stream, { 21 type: "opus" 22 }) 23 .on("finish", () => { 24 msg.guild.me.voice.channel.leave(); 25 }) 26 }); 27 } 28}); 29 30client.login("TOKEN");
Visit ytdl-core for other functions.
No vulnerabilities found.
No security vulnerabilities found.