Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Status code: 416 #659

Closed
skiuelowsky opened this issue Jun 29, 2020 · 29 comments
Closed

Error: Status code: 416 #659

skiuelowsky opened this issue Jun 29, 2020 · 29 comments

Comments

@skiuelowsky
Copy link

I have latest ytdl-core

`events.js:287
throw er; // Unhandled 'error' event
^

Error: Status code: 416
at ClientRequest. (E:\KrzysBot\node_modules\discord-ytdl-core\node_modules\miniget\dist\index.js:157:27)
at Object.onceWrapper (events.js:417:26)
at ClientRequest.emit (events.js:310:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
at TLSSocket.socketOnData (_http_client.js:469:22)
at TLSSocket.emit (events.js:310:20)
at addChunk (_stream_readable.js:286:12)
at readableAddChunk (_stream_readable.js:268:9)
at TLSSocket.Readable.push (_stream_readable.js:209:10)
Emitted 'error' event on PassThrough instance at:
at PassThrough. (E:\KrzysBot\node_modules\discord-ytdl-core\node_modules\ytdl-core\lib\index.js:137:14)
at PassThrough.emit (events.js:310:20)
at ClientRequest. (E:\KrzysBot\node_modules\discord-ytdl-core\node_modules\miniget\dist\index.js:162:28)
at Object.onceWrapper (events.js:417:26)
[... lines matching original stack trace ...]
at addChunk (_stream_readable.js:286:12)
[nodemon] app crashed - waiting for file changes before starting...`

@fent fent changed the title Sometimes i have an error Error: Status code: 416 Jul 1, 2020
@fent
Copy link
Owner

fent commented Jul 1, 2020

I've seen this a few times. but have yet to be able to consistently get it myself.

@Malexion
Copy link

I've noticed fiddling with the highWaterMark value can prevent it for me, though it causes other issues.

@M4X1MUS07
Copy link

I've noticed fiddling with the highWaterMark value can prevent it for me, though it causes other issues.

Yeah using lower highWaterMark values causes 416 for me but using higher values prevents it. I haven't seen any 416 after increasing it.

@Aasim-A
Copy link
Contributor

Aasim-A commented Jul 21, 2020

if you're passing a range option to the download, make sure that the range is valid, because if not YouTube will return this error.
(416 => Range Not Satisfiable)

@iwa
Copy link

iwa commented Jul 25, 2020

tried with a 1024kb highWaterMark, but I still have the issue
with a 8min long video, it stops around 6min with the 416 error

@iwa
Copy link

iwa commented Jul 25, 2020

still with 1024kb, every videos with a length above 5-6 mins drop around 1 or 2 minutes before the end

@Paultje52
Copy link

Paultje52 commented Aug 12, 2020

I'm making a music discord bot, and this is a very annoying issue. I'm having it with about half of all the songs I play. The music jumps around, and then throws this error. This is my code.

let dispatcher = connection.play(ytdl(url, {filter: "audioonly"}));

What I'm reading here, is that this is a range issue, but I'm not using any custom range, so ytdl-core does this by itself. Is there maybe a way that I can force it to use a lower range, so my music bot just stays working?

Edit: I went as far back as version 2.1.5, and even on this version, I get the same kind of error, but I get it not as often.

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:205:27) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read'
}

Second edit: I was thinking, there can only be two reasons, because I never had problems before, and I even tried the same version.

  1. The issue is with YouTube updating something
  2. The issue is with a dependency of ytdl-core

@fent
Copy link
Owner

fent commented Aug 12, 2020

  • The issue is with a dependency of ytdl-core

ytdl-core uses miniget to download videos. it has a feature for retrying to download a video with a ranged request if the connection drops halfway. I'm guessing the error lies somewhere around there.

@mh4ck
Copy link

mh4ck commented Aug 12, 2020

I had a similar issue. My problem was that i close the writestream, to which i pipe the download, in the 'finish' event. Maybe it could help someone.

And i'm using 8mb highwaterMark and got problems till now.

@fent
Copy link
Owner

fent commented Aug 21, 2020

for those that keep getting this error, can you log the requests miniget makes? just add a console.log(url) at the start of doDownload in node_modules/miniget/dist/index.js

@fent
Copy link
Owner

fent commented Aug 21, 2020

for those that get the error, do you know what formats it happens on?

another thing you can try, there was recently a change that chunks downloads for certain formats, you can try enabling that for all formats and see if you still get the error. to enable it, change this line to

const shouldBeChunked = true;

@JonathSpirit
Copy link

Hi, I have exactly the same problem :

I put the "console.log(url)" as you asked for :
image

Then I played a 5:40 youtube song with this link : https://www.youtube.com/watch?v=zUwEIt9ez7M

The first log output is :

https://www.youtube.com/watch?v=zUwEIt9ez7M&hl=en&bpctr=1598565478&pbj=1

https://www.youtube.com/s/player/eecb0f1e/player_ias.vflset/en_US/base.js

https://r3---sn-nfpnnjvh-b85e.googlevideo.com/videoplayback?expire=1598587059&ei=UyxIX4r8HY6A8gOj0r3ACg&ip=92.106.193.200&id=o-APDS4GKPPh5Iqh1LNeJCdOZDuxOiZeD8clyK4qc2fD_g&itag=251&source=youtube&requiressl=yes&mh=vI&mm=31%2C29&mn=sn-nfpnnjvh-b85e%2Csn-1gieen7e&ms=au%2Crdu&mv=m&mvi=3&pl=22&initcwndbps=2431250&vprv=1&mime=audio%2Fwebm&gir=yes&clen=5460482&dur=340.861&lmt=1593714887331490&mt=1598565282&fvip=3&keepalive=yes&c=WEB&txp=5511222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgZ0WUcA3ERgGKtCyiCggwWJGZWJxd-fP3riAD2un2y3wCIQCrAMeBU2sgLphyGqL_8Ff14-tJsOmqQoeJBYVKYeMl0w%3D%3D&ratebypass=yes&sig=AOq0QJ8wRgIhAPUYXcmH8ERAkzCIkEBMhY7ALNv04WvyLp8Rm0QN3kbzAiEAoS2fZTNeEfEp7q3K6voxwWxJFUE9O8szT9fP-HtS7zo%3D

After some time the console output that with the crash at the end :


https://r3---sn-nfpnnjvh-b85e.googlevideo.com/videoplayback?expire=1598587059&ei=UyxIX4r8HY6A8gOj0r3ACg&ip=92.106.193.200&id=o-APDS4GKPPh5Iqh1LNeJCdOZDuxOiZeD8clyK4qc2fD_g&itag=251&source=youtube&requiressl=yes&mh=vI&mm=31%2C29&mn=sn-nfpnnjvh-b85e%2Csn-1gieen7e&ms=au%2Crdu&mv=m&mvi=3&pl=22&initcwndbps=2431250&vprv=1&mime=audio%2Fwebm&gir=yes&clen=5460482&dur=340.861&lmt=1593714887331490&mt=1598565282&fvip=3&keepalive=yes&c=WEB&txp=5511222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgZ0WUcA3ERgGKtCyiCggwWJGZWJxd-fP3riAD2un2y3wCIQCrAMeBU2sgLphyGqL_8Ff14-tJsOmqQoeJBYVKYeMl0w%3D%3D&ratebypass=yes&sig=AOq0QJ8wRgIhAPUYXcmH8ERAkzCIkEBMhY7ALNv04WvyLp8Rm0QN3kbzAiEAoS2fZTNeEfEp7q3K6voxwWxJFUE9O8szT9fP-HtS7zo%3D

https://r3---sn-nfpnnjvh-b85e.googlevideo.com/videoplayback?expire=1598587059&ei=UyxIX4r8HY6A8gOj0r3ACg&ip=92.106.193.200&id=o-APDS4GKPPh5Iqh1LNeJCdOZDuxOiZeD8clyK4qc2fD_g&itag=251&source=youtube&requiressl=yes&mh=vI&mm=31%2C29&mn=sn-nfpnnjvh-b85e%2Csn-1gieen7e&ms=au%2Crdu&mv=m&mvi=3&pl=22&initcwndbps=2431250&vprv=1&mime=audio%2Fwebm&gir=yes&clen=5460482&dur=340.861&lmt=1593714887331490&mt=1598565282&fvip=3&keepalive=yes&c=WEB&txp=5511222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgZ0WUcA3ERgGKtCyiCggwWJGZWJxd-fP3riAD2un2y3wCIQCrAMeBU2sgLphyGqL_8Ff14-tJsOmqQoeJBYVKYeMl0w%3D%3D&ratebypass=yes&sig=AOq0QJ8wRgIhAPUYXcmH8ERAkzCIkEBMhY7ALNv04WvyLp8Rm0QN3kbzAiEAoS2fZTNeEfEp7q3K6voxwWxJFUE9O8szT9fP-HtS7zo%3D

https://r3---sn-nfpnnjvh-b85e.googlevideo.com/videoplayback?expire=1598587059&ei=UyxIX4r8HY6A8gOj0r3ACg&ip=92.106.193.200&id=o-APDS4GKPPh5Iqh1LNeJCdOZDuxOiZeD8clyK4qc2fD_g&itag=251&source=youtube&requiressl=yes&mh=vI&mm=31%2C29&mn=sn-nfpnnjvh-b85e%2Csn-1gieen7e&ms=au%2Crdu&mv=m&mvi=3&pl=22&initcwndbps=2431250&vprv=1&mime=audio%2Fwebm&gir=yes&clen=5460482&dur=340.861&lmt=1593714887331490&mt=1598565282&fvip=3&keepalive=yes&c=WEB&txp=5511222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgZ0WUcA3ERgGKtCyiCggwWJGZWJxd-fP3riAD2un2y3wCIQCrAMeBU2sgLphyGqL_8Ff14-tJsOmqQoeJBYVKYeMl0w%3D%3D&ratebypass=yes&sig=AOq0QJ8wRgIhAPUYXcmH8ERAkzCIkEBMhY7ALNv04WvyLp8Rm0QN3kbzAiEAoS2fZTNeEfEp7q3K6voxwWxJFUE9O8szT9fP-HtS7zo%3D

https://r3---sn-nfpnnjvh-b85e.googlevideo.com/videoplayback?expire=1598587059&ei=UyxIX4r8HY6A8gOj0r3ACg&ip=92.106.193.200&id=o-APDS4GKPPh5Iqh1LNeJCdOZDuxOiZeD8clyK4qc2fD_g&itag=251&source=youtube&requiressl=yes&mh=vI&mm=31%2C29&mn=sn-nfpnnjvh-b85e%2Csn-1gieen7e&ms=au%2Crdu&mv=m&mvi=3&pl=22&initcwndbps=2431250&vprv=1&mime=audio%2Fwebm&gir=yes&clen=5460482&dur=340.861&lmt=1593714887331490&mt=1598565282&fvip=3&keepalive=yes&c=WEB&txp=5511222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgZ0WUcA3ERgGKtCyiCggwWJGZWJxd-fP3riAD2un2y3wCIQCrAMeBU2sgLphyGqL_8Ff14-tJsOmqQoeJBYVKYeMl0w%3D%3D&ratebypass=yes&sig=AOq0QJ8wRgIhAPUYXcmH8ERAkzCIkEBMhY7ALNv04WvyLp8Rm0QN3kbzAiEAoS2fZTNeEfEp7q3K6voxwWxJFUE9O8szT9fP-HtS7zo%3D

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: Status code: 416
    at ClientRequest.<anonymous> (C:\Users\guill\Desktop\Creation\discord\GaspardSavoureuxBot\node_modules\miniget\dist\index.js:158:27)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
    at TLSSocket.socketOnData (_http_client.js:469:22)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at TLSSocket.Readable.push (_stream_readable.js:212:10)
Emitted 'error' event on PassThrough instance at:
    at errorOrDestroy (internal/streams/destroy.js:108:12)
    at PassThrough.onerror (_stream_readable.js:752:7)
    at PassThrough.emit (events.js:315:20)
    at PassThrough.<anonymous> (C:\Users\guill\Desktop\Creation\discord\GaspardSavoureuxBot\node_modules\ytdl-core\lib\index.js:96:16)
    at PassThrough.emit (events.js:315:20)
    at ClientRequest.<anonymous> (C:\Users\guill\Desktop\Creation\discord\GaspardSavoureuxBot\node_modules\miniget\dist\index.js:163:28)
    at Object.onceWrapper (events.js:422:26)
    [... lines matching original stack trace ...]
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)

The "const shouldBeChunked = true;" line doesn't fix the problem.

@ErikSzabo
Copy link

Hey, there!
I had the same issue, but, somehow I commented out like 3 lines of code in Miniget, and now looks like it's working. I think this retry/reconnect thingy is failing behind the scenes.

const onRequestError = (err, statusCode) => {
        // if (!retryRequest({ err, statusCode })) {
        //     stream.emit('error', err);
        // }
};

@bwz3rbot
Copy link

bwz3rbot commented Sep 15, 2020

Also having a problem with this.
I had the same error with some other streams using the package ytdl-core on a single voice channel. Now I'm using broadcasters and playing streams with ytdl-core-discord. Before I was able to catch the error by attaching the listener to the ytdl stream object.

Now I am adding an error listener onto the stream object attached to the broadcasters -the same one that is attached a working finish listener- and it isn't even catching. It just logs that there is an uncaught 416.

async function createNewStream(Broadcast, PlaylistName, track, play_next_track, debug_track) {
    console.log("NOW PLAYING: ", PlaylistName)
    console.log(track)
    stream = await ytdl(track.url, request_options)
    broadcast = Broadcast.play(stream, dispatcher_settings)
    StreamData = {
        track,
        Broadcast,
        PlaylistName
    }
    stream._StreamData = StreamData
    stream._play_next_track = play_next_track
    stream._debug_track = debug_track

    Streams.set(PlaylistName, stream)
    Streams.addFinishListener(stream)
    Streams.addErrorListener(stream)
    return StreamData;
}


Streams.addFinishListener = function (stream) {
    stream.on('finish', () => {
        stream._play_next_track(stream)
    })
}
Streams.addErrorListener = function (stream) {
    stream.on('error', () => {
        stream._debug_track(stream)
    })
}
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: Status code: 416
    at ClientRequest.<anonymous> (C:\Users\jayca\Documents\Code\MyNextDiscordBot\node_modules\miniget\dist\index.js:147:27)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
    at TLSSocket.socketOnData (_http_client.js:469:22)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at TLSSocket.Readable.push (_stream_readable.js:212:10)
Emitted 'error' event on PassThrough instance at:
    at errorOrDestroy (internal/streams/destroy.js:108:12)
    at PassThrough.onerror (_stream_readable.js:752:7)
    at PassThrough.emit (events.js:315:20)
    at PassThrough.<anonymous> (C:\Users\jayca\Documents\Code\MyNextDiscordBot\node_modules\ytdl-core\lib\index.js:143:14)
    at PassThrough.emit (events.js:315:20)
    at ClientRequest.<anonymous> (C:\Users\jayca\Documents\Code\MyNextDiscordBot\node_modules\miniget\dist\index.js:152:28)
    at Object.onceWrapper (events.js:422:26)
    [... lines matching original stack trace ...]
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)

I just manually told the stream to emit an error and nothing happend at all.

edit: Yep, I switched from ytdl-core-discord back to ytdl-core and it emitted an error when it was supposed to.

@BearTS
Copy link

BearTS commented Sep 27, 2020

same error

Error: Status code: 429
    at ClientRequest.<anonymous> (/home/container/node_modules/ytdl-core/node_modules/miniget/dist/index.js:150:31)
    at Object.onceWrapper (events.js:421:26)
    at ClientRequest.emit (events.js:314:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:640:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
    at TLSSocket.socketOnData (_http_client.js:509:22)
    at TLSSocket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:303:12)
    at readableAddChunk (_stream_readable.js:279:9)
    at TLSSocket.Readable.push (_stream_readable.js:218:10)

@Mikael-R
Copy link

Mikael-R commented Oct 8, 2020

I have the same error

Error: Status code: 416
    at ClientRequest.<anonymous> (/home/mikael/www/aziris/node_modules/miniget/src/index.ts:180:19)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
    at TLSSocket.socketOnData (_http_client.js:469:22)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at TLSSocket.Readable.push (_stream_readable.js:212:10)
Emitted 'error' event on PassThrough instance at:
    at errorOrDestroy (internal/streams/destroy.js:108:12)
    at PassThrough.onerror (_stream_readable.js:753:7)
    at PassThrough.emit (events.js:315:20)
    at PassThrough.<anonymous> (/home/mikael/www/aziris/node_modules/ytdl-core/lib/index.js:96:16)
    at PassThrough.emit (events.js:327:22)
    at ClientRequest.<anonymous> (/home/mikael/www/aziris/node_modules/miniget/src/index.ts:184:18)
    at Object.onceWrapper (events.js:422:26)
    [... lines matching original stack trace ...]
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)

@Paultje52
Copy link

I think everyone knows that there is an issue and that it affects many people. Should we create an issue at miniget or is this something ytdl-core needs to fix?

@fent
Copy link
Owner

fent commented Oct 8, 2020

let's keep this open here for now until we figure out the cause

@Mikael-R
Copy link

Mikael-R commented Oct 9, 2020

is there another lib that does the same as ytdl?

@hmeinertrita
Copy link

same issue

Error: Status code: 416
    at ClientRequest.<anonymous> (D:\Personal Projects\ytdl-test\node_modules\miniget\dist\index.js:156:27)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:596:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
    at TLSSocket.socketOnData (_http_client.js:469:22)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at TLSSocket.Readable.push (_stream_readable.js:212:10)
Emitted 'error' event on PassThrough instance at:
    at PassThrough.<anonymous> (D:\Personal Projects\ytdl-test\node_modules\ytdl-core\lib\index.js:96:16)
    at PassThrough.emit (events.js:315:20)
    at ClientRequest.<anonymous> (D:\Personal Projects\ytdl-test\node_modules\miniget\dist\index.js:161:28)
    at Object.onceWrapper (events.js:422:26)
    [... lines matching original stack trace ...]
    at addChunk (_stream_readable.js:295:12)

@alansyahdwi
Copy link

i got this error too.
Screenshot_381

@xdeoxyz
Copy link

xdeoxyz commented Oct 28, 2020

I fixed this problem by using:

ytdl(url, { highWaterMark: 1 << 25 })

I hope this helps.

@Roki100
Copy link
Contributor

Roki100 commented Nov 10, 2020

I fixed this problem by using:

ytdl(url, { highWaterMark: 1 << 25 })

I hope this helps.

its not really a (good)fix as it makes resources(dl, ram, cpu) go brrrrr
edit: however for this issue, i will be trying to find the cause soon

p4dd9 pushed a commit to p4dd9/heidelbot that referenced this issue Nov 20, 2020
p4dd9 pushed a commit to p4dd9/heidelbot that referenced this issue Nov 20, 2020
@fent fent closed this as completed Nov 24, 2020
@Paultje52
Copy link

Does this mean that the highwatermark is the final fix?

@fent
Copy link
Owner

fent commented Nov 24, 2020

fixed on latest, not due to highWaterMark

@Frontesque
Copy link

fixed on latest, not due to highWaterMark

Still having this issue. Would like to see a fix, but I'm using highwatermark for now.

@wawahuy
Copy link

wawahuy commented Feb 10, 2021

image
I firmly believe this problem comes from the invalid range definition.
I have had the same problem in my project

@mohsenfaraj
Copy link

I'm also getting this error:
MinigetError: Status code: 416 at ClientRequest.<anonymous> (F:\Projects\Nodejs Projects\SpotifydlBot\node_modules\miniget\dist\index.js:206:27) at Object.onceWrapper (node:events:510:26) at ClientRequest.emit (node:events:390:28) at HTTPParser.parserOnIncomingClient (node:_http_client:623:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17) at TLSSocket.socketOnData (node:_http_client:487:22) at TLSSocket.emit (node:events:390:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at TLSSocket.Readable.push (node:internal/streams/readable:228:10) at TLSWrap.onStreamRead (node:internal/stream_base_commons:199:23) { statusCode: 416 }
it seems really random... yesterday it was working fine and today its not! is this a youtube thing?

@mohsenfaraj
Copy link

@fent @Frontesque @wawahuy
for any one who has this problem and still getting 416 error:
I simply fixed the issue by adding dlChunkSize parameter in ytdl() function and it works as a charm now! this is a sample example of it:
ytdl("https://www.youtube.com/watch?v=l-yVYsbvJas" , {filter : "audioonly" , quality: "highestaudio" , dlChunkSize : 1024 * 1024 }).pipe(fs.createWriteStream('music.mp3'))
the default dlChunkSize has been set to 10mb (1024 * 1024 * 10). you could try different values and see what works best for you.
I don't exactly know why its a solution but it works for me! hope it helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests