Skip to content
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

[FIX] progressRegex #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

enginefeeder101
Copy link

Add missing 'zero or more' * quantifier to progressRegex that fixes not reporting the progress correctly.

Before:
{"percent":66.3,"totalSize":""}

After:
{"percent":45.6,"totalSize":"21.41MiB","currentSpeed":"5.83MiB/s","eta":"00:02"}

Thank you for maintaining this node module.

Add missing quantifier to progressRegex
@@ -18,7 +18,7 @@ import { stdout } from 'process';

const executableName = 'yt-dlp';
const progressRegex =
/\[download\] *(.*) of ([^ ]*)(:? *at *([^ ]*))?(:? *ETA *([^ ]*))?/;
/\[download\] *(.*) of *([^ ]*)(:? *at *([^ ]*))?(:? *ETA *([^ ]*))?/;
Copy link

@christo christo Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading this regex correctly, the space before the new * is being quantified which suggests that there may be no space in the yt-dlp output between the "of" and the following non-space part. I haven't confirmed this but I'm surprised there would ever be no space.

If your change is supposed to handle 1 or more spaces, + is the correct quantifier.

@christo
Copy link

christo commented Jan 25, 2024

Thanks for making this fix, I have had this same problem of yt-dlp-wrap not emitting progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants