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

Total bytes in progress-event is of type string #707

Closed
simonwep opened this issue Sep 15, 2020 · 0 comments
Closed

Total bytes in progress-event is of type string #707

simonwep opened this issue Sep 15, 2020 · 0 comments
Labels

Comments

@simonwep
Copy link

First of all, thanks a lot for this library - I'm using it for candy and it's a breeze using this library :)

Description

As stated in the readme the third value of the progress event should be a number indicating the total amount of bytes / size. In my case, after upgrading from 3.1.1 to 3.2.2 this is now a string?!

Steps to reproduce

I've isolated the issued seperately also using the latest version (3.2.2):

const ytdl = require('ytdl-core');

const sourceStream = ytdl('https://www.youtube.com/watch?v=RYtCKmJpbJI ', {
    quality: 137,
    highWaterMark: 16384
});

sourceStream.on('progress', (chunkSize, downloaded, size) => {
    console.log({
        chunkSize: `${chunkSize} (${typeof chunkSize})`,
        downloaded: `${downloaded} (${typeof downloaded})`,
        size: `${size} (${typeof size})`
    });
});

Same result with https://www.youtube.com/watch?v=jMdgpWFD-4M and 137, is there an issue with itag 137?

Console output:

{
  chunkSize: '16384 (number)',
  downloaded: '16384 (number)',
  size: '8238986 (string)'
}
{
  chunkSize: '16384 (number)',
  downloaded: '32768 (number)',
  size: '8238986 (string)'
}

My Environment:

  System:
    OS: Windows 10 10.0.19041
    CPU: (16) x64 AMD Ryzen 7 1700X Eight-Core Processor
    Memory: 12.64 GB / 31.93 GB
  Binaries:
    Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
  Utilities:
    Git: 2.28.0. - /mingw64/bin/git
  Virtualization:
    Docker: 19.03.12 - C:\Program Files\Docker\Docker\resources\bin\docker.EXE
  Languages:
    Bash: 4.4.23 - C:\Program Files\Git\usr\bin\bash.EXE
    Perl: 5.32.0 - C:\Program Files\Git\usr\bin\perl.EXE
  Browsers:
    Edge: Spartan (44.19041.423.0)
    Internet Explorer: 11.0.19041.1

Additional info

I've seen here that this kind of information gets forwarded from the node-m3u8stream which weirdly only casts size to a number when it gets added to downloaded (see this line).

I'm not sure if this is a problem in ytdl-core but m3u8stream is pretty "old" and it worked(?!) previously.

Workaround

I'm just converting it explicit to a number which works.

@fent fent added the bug label Sep 25, 2020
@fent fent closed this as completed in 0ec2675 Sep 25, 2020
pull bot pushed a commit to yyoutubee/node-ytdl-core that referenced this issue Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants