fent / node-miniget

A small http(s) GET library.
MIT License
55 stars 17 forks source link

Randomly get this #2

Closed LetsDoughNut closed 7 years ago

LetsDoughNut commented 7 years ago
Error: Status code: 403
    at ClientRequest.<anonymous> (/root/node_modules/miniget/lib/index.js:65:17)
    at Object.onceWrapper (events.js:316:30)
    at emitOne (events.js:115:13)
    at ClientRequest.emit (events.js:210:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
    at TLSSocket.socketOnData (_http_client.js:454:20)
    at emitOne (events.js:115:13)
    at TLSSocket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:266:12)
    at readableAddChunk (_stream_readable.js:253:11)
    at TLSSocket.Readable.push (_stream_readable.js:211:10)
    at TLSWrap.onread (net.js:585:20)

This gets a return then crashes my application while just playing music. Nothing triggered this to happened, this just happens randomly

fent commented 7 years ago

Do you have a url where this happens consistently?

fent commented 7 years ago

If this happens primarily in ytdl-core, this issue is more related to how ytdl-core makes the request, not this module.

You can catch the error by adding an error listener to the stream that ytdl() returns.

let stream  = ytdl(url);
stream.on('error', (err) => {
  // do something with `err`
});
fent commented 7 years ago

Going to close this, feel free to open the issue on the ytdl-core repo with more information so I can help debug.