Open crackodille opened 3 months ago
thanks for fixing!
I am convinced that it would be worthwhile to completely replace the youtube-sr library with ytdl-core to maintain uniformity and improve clarity, but that's rather a larger topic for potential future consideration. Here's a quick fix ready.
If a longer video is played, the following error occurs and the playback is interrupted after some time:
AudioPlayerError: aborted
at connResetException (node:internal/errors:717:14)
at TLSSocket.socketCloseListener (node:_http_client:462:19)
at TLSSocket.emit (node:events:525:35)
at TLSSocket.emit (node:domain:489:12)
at node:net:322:12
at TCP.done (node:_tls_wrap:588:7) {
resource: AudioResource {
playStream: Encoder {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
encoder: null,
_options: [Object],
_required: 3840,
_buffer: null,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: [Function: bound onwrite]
},
edges: [ [Object], [Object], [Object] ],
metadata: Song {
url: 'https://youtube.com/watch?v=mx9Npfwf8xQ',
title: '*周杰伦*Jay Chou慢歌精选30首合集 - 陪你一个慵懒的下午 - 30 Songs of the Most Popular Chinese Singer',
duration: 8064
},
volume: VolumeTransformer {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
_readInt: [Function (anonymous)],
_writeInt: [Function (anonymous)],
_bits: 16,
_bytes: 2,
_extremum: 32768,
volume: 0.42807238607682996,
_chunk: null,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: [Function: bound onwrite]
},
encoder: Encoder {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
encoder: null,
_options: [Object],
_required: 3840,
_buffer: null,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: [Function: bound onwrite]
},
audioPlayer: AudioPlayer {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
_state: [Object],
subscribers: [Array],
behaviors: [Object],
debug: [Function (anonymous)],
[Symbol(kCapture)]: false
},
playbackDuration: 1279740,
started: true,
silencePaddingFrames: 5,
silenceRemaining: -1
}
}
If a longer video is played, the following error occurs and the playback is interrupted after some time:
AudioPlayerError: aborted at connResetException (node:internal/errors:717:14) at TLSSocket.socketCloseListener (node:_http_client:462:19) at TLSSocket.emit (node:events:525:35) at TLSSocket.emit (node:domain:489:12) at node:net:322:12 at TCP.done (node:_tls_wrap:588:7) { resource: AudioResource { playStream: Encoder { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 5, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, encoder: null, _options: [Object], _required: 3840, _buffer: null, [Symbol(kCapture)]: false, [Symbol(kCallback)]: [Function: bound onwrite] }, edges: [ [Object], [Object], [Object] ], metadata: Song { url: 'https://youtube.com/watch?v=mx9Npfwf8xQ', title: '*周杰伦*Jay Chou慢歌精选30首合集 - 陪你一个慵懒的下午 - 30 Songs of the Most Popular Chinese Singer', duration: 8064 }, volume: VolumeTransformer { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 5, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, _readInt: [Function (anonymous)], _writeInt: [Function (anonymous)], _bits: 16, _bytes: 2, _extremum: 32768, volume: 0.42807238607682996, _chunk: null, [Symbol(kCapture)]: false, [Symbol(kCallback)]: [Function: bound onwrite] }, encoder: Encoder { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 5, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, encoder: null, _options: [Object], _required: 3840, _buffer: null, [Symbol(kCapture)]: false, [Symbol(kCallback)]: [Function: bound onwrite] }, audioPlayer: AudioPlayer { _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, _state: [Object], subscribers: [Array], behaviors: [Object], debug: [Function (anonymous)], [Symbol(kCapture)]: false }, playbackDuration: 1279740, started: true, silencePaddingFrames: 5, silenceRemaining: -1 } }
I think this problem comes from the library that was used to replace play-dl. As we see here in the play-dl documentation , ytdl is already known for this error.
Play-dll.stream issue https://github.com/play-dl/play-dl/issues/371
I think this problem comes from the library that was used to replace play-dl. As we see here in the play-dl documentation , ytdl is already known for this error.
My bad ofc i replaced play-dl.stream() not youtube-sr as stated in pull name. I must have been thinking about something else while commiting... Anyway, right now play-dl.stream() is not working properly (in my case at all) hence the replacement.
Thank you so much for your contribution! Your code solved the issue perfectly. I couldn't wait for it to be merged, so I went ahead and used it already. @crackodille
Thank you for your fix @crackodille Bot is working as it should Hope this gets merged
can also confirm it worked on a docker environment
can also confirm it worked on a docker environment
How did you access the file to make the change tho? I cannot find the song.ts file in the container whatsoever.
I would suggest we don't replace play-dl with ytdl-core. Another bot I use with ytdl-core regularly has issues as well.
What might be nice is having a flag or smart logic to bounce between the two.
@j0hnVu
can also confirm it worked on a docker environment
How did you access the file to make the change tho? I cannot find the song.ts file in the container whatsoever.
I checked-out the branch with the fix (https://github.com/crackodille/evobot/tree/issue-1644-fix-with-ytdl), built the container locally and pushed to a private registry
And if you're hosting the container locally, you don't even need to push it to a remote registry
Works fine, thanks !
Seems to be giving 403 now :(
AudioPlayerError: Status code: 403
at ClientRequest.<anonymous> (/node_modules/miniget/dist/index.js:206:27)
at Object.onceWrapper (node:events:632:26)
at ClientRequest.emit (node:events:517:28)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:700:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:541:22)
at TLSSocket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:335:12)
at readableAddChunk (node:internal/streams/readable:308:9)
at Readable.push (node:internal/streams/readable:245:10) {
@j0hnVu
can also confirm it worked on a docker environment
How did you access the file to make the change tho? I cannot find the song.ts file in the container whatsoever.
I checked-out the branch with the fix (https://github.com/crackodille/evobot/tree/issue-1644-fix-with-ytdl), built the container locally and pushed to a private registry
And if you're hosting the container locally, you don't even need to push it to a remote registry
Thank you! ~It's working flawlessly.~
EDIT: NVM I also got 403
Seems to be giving 403 now :(
AudioPlayerError: Status code: 403 at ClientRequest.<anonymous> (/node_modules/miniget/dist/index.js:206:27) at Object.onceWrapper (node:events:632:26) at ClientRequest.emit (node:events:517:28) at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:700:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17) at TLSSocket.socketOnData (node:_http_client:541:22) at TLSSocket.emit (node:events:517:28) at addChunk (node:internal/streams/readable:335:12) at readableAddChunk (node:internal/streams/readable:308:9) at Readable.push (node:internal/streams/readable:245:10) {
same error as well
Seems to be giving 403 now :(
AudioPlayerError: Status code: 403 at ClientRequest.<anonymous> (/node_modules/miniget/dist/index.js:206:27) at Object.onceWrapper (node:events:632:26) at ClientRequest.emit (node:events:517:28) at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:700:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17) at TLSSocket.socketOnData (node:_http_client:541:22) at TLSSocket.emit (node:events:517:28) at addChunk (node:internal/streams/readable:335:12) at readableAddChunk (node:internal/streams/readable:308:9) at Readable.push (node:internal/streams/readable:245:10) {
same error as well
I think I found where it fails In structs/MusicQueue.ts at processQueue() :
try {
const resource = await next.makeResource();
this.resource = resource!;
this.player.play(this.resource); // -- AudioPlayerError: Status code: 403 --
this.resource.volume?.setVolumeLogarithmic(this.volume / 100);
} catch (error) {
console.error(error);
return this.processQueue();
} finally {
this.queueLock = false;
}
The ressource could maybe create an issue but I also found an issue on the main repo so I am not sure if @crackodille 's changes on Song.ts are related to this error. It might be a direct error from discordjs/voice dependency
Seems to be giving 403 now :(
AudioPlayerError: Status code: 403 at ClientRequest.<anonymous> (/node_modules/miniget/dist/index.js:206:27) at Object.onceWrapper (node:events:632:26) at ClientRequest.emit (node:events:517:28) at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:700:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17) at TLSSocket.socketOnData (node:_http_client:541:22) at TLSSocket.emit (node:events:517:28) at addChunk (node:internal/streams/readable:335:12) at readableAddChunk (node:internal/streams/readable:308:9) at Readable.push (node:internal/streams/readable:245:10) {
same error as well
I think I found where it fails In structs/MusicQueue.ts at processQueue() :
try { const resource = await next.makeResource(); this.resource = resource!; this.player.play(this.resource); // -- AudioPlayerError: Status code: 403 -- this.resource.volume?.setVolumeLogarithmic(this.volume / 100); } catch (error) { console.error(error); return this.processQueue(); } finally { this.queueLock = false; }
The ressource could maybe create an issue but I also found an issue on the main repo so I am not sure if @crackodille 's changes on Song.ts are related to this error. It might be a direct error from discordjs/voice dependency
The solution for error 403, https://www.npmjs.com/package/@distube/ytdl-core I tested and it worked. It should be used in conjunction with the @crackodille 's solution.
You can follow the issue here
Submitted a pull request to @crackodille's branch that integrates @paulodsncir's new solution. Can confirm it works.
@paulodsncir @CoocooFroggy nice work. merged :)
Can confirm the new updated code to be working Thank you everyone for contribution Hope evobot author merges this pull
Unfortunately new problems.
Error: While getting info from url Sign in to confirm you’re not a bot at video_basic_info (/home/Documents/evobot/node_modules/play-dl/play-dl/YouTube/utils/extractor.ts:191:19) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async Function.from (/home/Documents/evobot/structs/Song.ts:55:18) at async Object.execute (/home/Documents/evobot/commands/play.ts:56:14)
youtube is not sleeping I guess. They are trying to eliminate bots.
Unfortunately new problems.
Error: While getting info from url Sign in to confirm you’re not a bot at video_basic_info (/home/Documents/evobot/node_modules/play-dl/play-dl/YouTube/utils/extractor.ts:191:19) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async Function.from (/home/Documents/evobot/structs/Song.ts:55:18) at async Object.execute (/home/Documents/evobot/commands/play.ts:56:14)
youtube is not sleeping I guess. They are trying to eliminate bots.
@crackodille I saw a possible workaround in this issue, maybe it could help. I didn't have the opportunity to test it.
YouTube is giving me so much headache, I just wanted to listen to music with my friends
I have a question I tried to play a video with an age restriction, but it was possible to get through what play-dl restricts before entering, but after it it’s no longer possible (as I understand, this is exactly what ytdl is now responsible for, since the same age error), having smoked heavily documentation, I just didn’t come to the conclusion that I could play videos with age restrictions. Maybe I just don’t understand what else is true, but has anyone actually succeeded?
fix #1644