RequestError: Timeout awaiting 'request' for 30000ms youtube-dl
RequestError: Timeout awaiting 'request' for 30000ms youtube-dl
我只是想让它播放这首歌,虽然它播放了大约 20 秒然后停止并给我以下错误:
RequestError: Timeout awaiting 'request' for 30000ms
2021-02-20T07:55:21.000350+00:00 app[worker.1]: at ClientRequest.<anonymous> (/app/node_modules/got/dist/source/core/index.js:953:65)
2021-02-20T07:55:21.000351+00:00 app[worker.1]: at Object.onceWrapper (events.js:422:26)
2021-02-20T07:55:21.000352+00:00 app[worker.1]: at ClientRequest.emit (events.js:327:22)
2021-02-20T07:55:21.000353+00:00 app[worker.1]: at ClientRequest.origin.emit (/app/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
2021-02-20T07:55:21.000353+00:00 app[worker.1]: at TLSSocket.socketErrorListener (_http_client.js:469:9)
2021-02-20T07:55:21.000354+00:00 app[worker.1]: at TLSSocket.emit (events.js:315:20)
2021-02-20T07:55:21.000354+00:00 app[worker.1]: at emitErrorNT (internal/streams/destroy.js:106:8)
2021-02-20T07:55:21.000354+00:00 app[worker.1]: at emitErrorCloseNT (internal/streams/destroy.js:74:3)
2021-02-20T07:55:21.000355+00:00 app[worker.1]: at processTicksAndRejections (internal/process/task_queues.js:80:21)
2021-02-20T07:55:21.000356+00:00 app[worker.1]: at Timeout.timeoutHandler [as _onTimeout] (/app/node_modules/got/dist/source/core/utils/timed-out.js:36:25)
2021-02-20T07:55:21.000356+00:00 app[worker.1]: at listOnTimeout (internal/timers.js:556:17)
2021-02-20T07:55:21.000356+00:00 app[worker.1]: at processTimers (internal/timers.js:497:7) {
2021-02-20T07:55:21.000357+00:00 app[worker.1]: name: 'TimeoutError',
2021-02-20T07:55:21.000357+00:00 app[worker.1]: code: 'ETIMEDOUT',
2021-02-20T07:55:21.000358+00:00 app[worker.1]: timings: {
2021-02-20T07:55:21.000358+00:00 app[worker.1]: start: 1613807690995,
2021-02-20T07:55:21.000359+00:00 app[worker.1]: socket: 1613807690995,
2021-02-20T07:55:21.000359+00:00 app[worker.1]: lookup: 1613807690996,
2021-02-20T07:55:21.000360+00:00 app[worker.1]: connect: 1613807690998,
2021-02-20T07:55:21.000360+00:00 app[worker.1]: secureConnect: 1613807691002,
2021-02-20T07:55:21.000360+00:00 app[worker.1]: upload: 1613807691002,
2021-02-20T07:55:21.000361+00:00 app[worker.1]: response: 1613807691027,
2021-02-20T07:55:21.000361+00:00 app[worker.1]: end: undefined,
2021-02-20T07:55:21.000361+00:00 app[worker.1]: error: 1613807720997,
2021-02-20T07:55:21.000362+00:00 app[worker.1]: abort: 1613807720999,
2021-02-20T07:55:21.000362+00:00 app[worker.1]: phases: {
2021-02-20T07:55:21.000363+00:00 app[worker.1]: wait: 0,
2021-02-20T07:55:21.000363+00:00 app[worker.1]: dns: 1,
2021-02-20T07:55:21.000363+00:00 app[worker.1]: tcp: 2,
2021-02-20T07:55:21.000364+00:00 app[worker.1]: tls: 4,
2021-02-20T07:55:21.000364+00:00 app[worker.1]: request: 0,
2021-02-20T07:55:21.000364+00:00 app[worker.1]: firstByte: 25,
2021-02-20T07:55:21.000365+00:00 app[worker.1]: download: undefined,
2021-02-20T07:55:21.000365+00:00 app[worker.1]: total: 30004
2021-02-20T07:55:21.000365+00:00 app[worker.1]: }
2021-02-20T07:55:21.000366+00:00 app[worker.1]: },
2021-02-20T07:55:21.000366+00:00 app[worker.1]: event: 'request'
2021-02-20T07:55:21.000366+00:00 app[worker.1]: }
这是我的代码的一部分,如果它可能会出错或超时的话:
setTimeout(async function() {
dispatcher = connection.play(ytdl(url))
.on('finish', () => {
y = number.get(`y`);
number = editJsonFile(`number/${message.guild.id}.json`);
number.set(`y`, y+1);
number.save();
checker = editJsonFile(`checker/${message.guild.id}.json`);
checker.set(`checker`, checking--);
checker.save();
voiceChannel.leave();
try {
delete require.cache[require.resolve(`./queue.js`)];
let commandFile = require(`./queue.js`);
commandFile.run(client, message, args);
} catch(e) {
console.log(e.stack);
}
})
.on('error', error => {
console.log(error);
});
dispatcher.setVolumeLogarithmic(5 / 5);
message.channel.send(" Playing...");
}, 2000);
}
}
我希望它使用 youtube-dl 而不是 ytdl-core(ytdl 被定义为 youtube-dl)正常播放。关于如何解决这个问题有什么想法吗?
找到答案:我使用的是 ytdl-core 而不是 ytdl-core-discord
我只是想让它播放这首歌,虽然它播放了大约 20 秒然后停止并给我以下错误:
RequestError: Timeout awaiting 'request' for 30000ms
2021-02-20T07:55:21.000350+00:00 app[worker.1]: at ClientRequest.<anonymous> (/app/node_modules/got/dist/source/core/index.js:953:65)
2021-02-20T07:55:21.000351+00:00 app[worker.1]: at Object.onceWrapper (events.js:422:26)
2021-02-20T07:55:21.000352+00:00 app[worker.1]: at ClientRequest.emit (events.js:327:22)
2021-02-20T07:55:21.000353+00:00 app[worker.1]: at ClientRequest.origin.emit (/app/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
2021-02-20T07:55:21.000353+00:00 app[worker.1]: at TLSSocket.socketErrorListener (_http_client.js:469:9)
2021-02-20T07:55:21.000354+00:00 app[worker.1]: at TLSSocket.emit (events.js:315:20)
2021-02-20T07:55:21.000354+00:00 app[worker.1]: at emitErrorNT (internal/streams/destroy.js:106:8)
2021-02-20T07:55:21.000354+00:00 app[worker.1]: at emitErrorCloseNT (internal/streams/destroy.js:74:3)
2021-02-20T07:55:21.000355+00:00 app[worker.1]: at processTicksAndRejections (internal/process/task_queues.js:80:21)
2021-02-20T07:55:21.000356+00:00 app[worker.1]: at Timeout.timeoutHandler [as _onTimeout] (/app/node_modules/got/dist/source/core/utils/timed-out.js:36:25)
2021-02-20T07:55:21.000356+00:00 app[worker.1]: at listOnTimeout (internal/timers.js:556:17)
2021-02-20T07:55:21.000356+00:00 app[worker.1]: at processTimers (internal/timers.js:497:7) {
2021-02-20T07:55:21.000357+00:00 app[worker.1]: name: 'TimeoutError',
2021-02-20T07:55:21.000357+00:00 app[worker.1]: code: 'ETIMEDOUT',
2021-02-20T07:55:21.000358+00:00 app[worker.1]: timings: {
2021-02-20T07:55:21.000358+00:00 app[worker.1]: start: 1613807690995,
2021-02-20T07:55:21.000359+00:00 app[worker.1]: socket: 1613807690995,
2021-02-20T07:55:21.000359+00:00 app[worker.1]: lookup: 1613807690996,
2021-02-20T07:55:21.000360+00:00 app[worker.1]: connect: 1613807690998,
2021-02-20T07:55:21.000360+00:00 app[worker.1]: secureConnect: 1613807691002,
2021-02-20T07:55:21.000360+00:00 app[worker.1]: upload: 1613807691002,
2021-02-20T07:55:21.000361+00:00 app[worker.1]: response: 1613807691027,
2021-02-20T07:55:21.000361+00:00 app[worker.1]: end: undefined,
2021-02-20T07:55:21.000361+00:00 app[worker.1]: error: 1613807720997,
2021-02-20T07:55:21.000362+00:00 app[worker.1]: abort: 1613807720999,
2021-02-20T07:55:21.000362+00:00 app[worker.1]: phases: {
2021-02-20T07:55:21.000363+00:00 app[worker.1]: wait: 0,
2021-02-20T07:55:21.000363+00:00 app[worker.1]: dns: 1,
2021-02-20T07:55:21.000363+00:00 app[worker.1]: tcp: 2,
2021-02-20T07:55:21.000364+00:00 app[worker.1]: tls: 4,
2021-02-20T07:55:21.000364+00:00 app[worker.1]: request: 0,
2021-02-20T07:55:21.000364+00:00 app[worker.1]: firstByte: 25,
2021-02-20T07:55:21.000365+00:00 app[worker.1]: download: undefined,
2021-02-20T07:55:21.000365+00:00 app[worker.1]: total: 30004
2021-02-20T07:55:21.000365+00:00 app[worker.1]: }
2021-02-20T07:55:21.000366+00:00 app[worker.1]: },
2021-02-20T07:55:21.000366+00:00 app[worker.1]: event: 'request'
2021-02-20T07:55:21.000366+00:00 app[worker.1]: }
这是我的代码的一部分,如果它可能会出错或超时的话:
setTimeout(async function() {
dispatcher = connection.play(ytdl(url))
.on('finish', () => {
y = number.get(`y`);
number = editJsonFile(`number/${message.guild.id}.json`);
number.set(`y`, y+1);
number.save();
checker = editJsonFile(`checker/${message.guild.id}.json`);
checker.set(`checker`, checking--);
checker.save();
voiceChannel.leave();
try {
delete require.cache[require.resolve(`./queue.js`)];
let commandFile = require(`./queue.js`);
commandFile.run(client, message, args);
} catch(e) {
console.log(e.stack);
}
})
.on('error', error => {
console.log(error);
});
dispatcher.setVolumeLogarithmic(5 / 5);
message.channel.send(" Playing...");
}, 2000);
}
}
我希望它使用 youtube-dl 而不是 ytdl-core(ytdl 被定义为 youtube-dl)正常播放。关于如何解决这个问题有什么想法吗?
找到答案:我使用的是 ytdl-core 而不是 ytdl-core-discord