Repository navigation
fix(bot): replace play-dl youtube streaming with yt-dlp in bridge #520
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6d2bb7a
fix(bot): replace play-dl youtube streaming with yt-dlp in bridge
LucasSantana-Dev 20ef7ee
fix(bot): validate https scheme in streamviaytdlp before spawn
LucasSantana-Dev 6be0de6
fix(bot): add nosonar annotation to suppress spawn hotspot
LucasSantana-Dev da960ba
fix(bot): move nosonar annotation to comment line above spawn
LucasSantana-Dev cc55b3e
fix(bot): validate ytdlp urls against allowlist of known domains
LucasSantana-Dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Node.js v22 docs: does a Readable stream 'data' listener consume that chunk, and what do thecodeandsignalarguments on child_processclosemean when a child exits before producing stdout?💡 Result:
Yes, adding a 'data' event listener to a Node.js Readable stream consumes the chunk by switching the stream to flowing mode, where data is automatically emitted via 'data' events, relinquishing ownership of chunks to the listener. This occurs when attaching the listener, calling resume, or pipe. The listener receives the chunk as a Buffer or string (if encoding set). For child_process 'close' event (e.g., from spawn), the callback receives (code, signal). Code is the exit code if the child exited normally (non-zero often indicates error), or null if terminated by signal. Signal is the string name of the terminating signal (e.g., 'SIGTERM', 'SIGKILL') or null if no signal. One is always non-null. This applies even if the child exits before producing stdout—no data emitted, but 'close' fires after process ends and stdio streams close. Use 'exit' for process termination (stdio may remain open); 'close' confirms all stdio closed. No stdout means child produced none or exited too quickly (e.g., immediate error).
Citations:
Fix stream and process lifecycle to avoid chunk loss and dangling promises.
The
proc.stdout!.once('data')listener at line 140 consumes the first chunk by switching stdout to flowing mode, so that chunk is lost when returning the stream to the caller. Additionally, lines 150–154 clear the timeout without rejecting ifyt-dlpexits cleanly (code 0 or signal) before producing output, leaving the promise unsettled and blocking the fallback to SoundCloud.Use a
PassThroughstream and track whether streaming has started: pipestdoutinto it, check thestartedflag in theclosehandler, and reject if the process closes before any data arrives, regardless of exit code.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents