feat: show live download speed and progress - #66
Open
guoshulin1992-prog wants to merge 6 commits into
Open
guoshulin1992-prog wants to merge 6 commits into
guoshulin1992-prog wants to merge 6 commits into
Conversation
The url field from POST /api/download, /api/info, and /api/playlist was passed straight into the yt-dlp argv list. Since these endpoints are unauthenticated, a caller could pass a value like "--exec=<cmd>" instead of a real URL; yt-dlp parses any argv item starting with "-" as an option rather than a positional URL, so this allowed arbitrary command execution on the host after a (fake) download. Fixes: - Add is_safe_url() to require an http(s) scheme + host, rejecting anything that could be interpreted as a CLI flag. - Insert a "--" argv separator before the URL in every yt-dlp invocation so option parsing stops regardless of URL content (defense in depth alongside the scheme check). - Apply the check on all three endpoints that accept a URL.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
yt-dlpoutput while a download is running instead of waiting for the subprocess to finish.Details
yt-dlp --progress-templatewith a private line prefix and JSON payload rather than parsing human-readable progress text.--URL separator.Tests
Executed locally on 2026-09-02:
-W error::ResourceWarning.py_compilepassed forapp.py,progress.py, anddownload_process.py.git diff --checkpassed.--progress-templatearguments were accepted by the installedyt-dlp(2026.08.19).Relationship to existing work
Closes #2; that issue is not the correct issue for this download-progress work.Known limitations
yt-dlpextractor and the target site's access rules.127.0.0.1unless the operator deliberately chooses otherwise.