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

Extremely Slow Requests - Download speeds are 20x slower than what they should be #1024

Closed
r0hin opened this issue Oct 17, 2021 · 7 comments
Closed
Labels

Comments

@r0hin
Copy link

r0hin commented Oct 17, 2021

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

ytdl('https://www.youtube.com/watch?v=Bq6IuZIJhuI', {
  filter: 'audioonly',
}).pipe(fs.createWriteStream('audio.webm'));

The above code successfully gathers information and downloads the video by URL. However, this process is extremely long. When going to the original source googlevideo.com URL in the browser, the audio is able to be downloaded in just a few seconds as opposed to 25+ seconds. It is possible to reduce download times by 90% if you can simulate the chrome browser when performing the download.

You can reproduce this issue by running the above code and taking note of how long it takes. Then running .getInfo() on the same video to return a list of audio URLs. Try opening the URLs in the chrome browser and take note of how quickly the entire progress bar is filled up.

I've faced this issue before and it was previously solved by using a range header but this no longer seems to work. Also, the download speeds remain high on Chrome but seem to falter to YTDL speeds when switching to Firefox.

Thank you for your help.

@r0hin r0hin changed the title Extremely Slow Requests - Download times are 20x what they should be Extremely Slow Requests - Download speeds are 20x slower than what they should be Oct 17, 2021
@gatecrasher777
Copy link
Contributor

See #964 Although it is no longer random, but all the time.

@r0hin
Copy link
Author

r0hin commented Oct 17, 2021

See #964 Although it is no longer random, but all the time.

I see. If I understand correctly, that sucks. Will there need to be an update every single time YouTube changes the player? How often is this and how sustainable is it?

@dardo82
Copy link

dardo82 commented Oct 17, 2021

I’d like this fixed, what can i do to help? Are there any temporary workarounds?�

@LillieH1000
Copy link

LillieH1000 commented Oct 18, 2021

YouTube/Google has made a change to make youtube-dl downloading incrediby slow, the only fix is the fork known as yt-dlp but that doesn't have a node version yet.

@dardo82
Copy link

dardo82 commented Oct 18, 2021

I've installed yt-dlp and it works as expected, thanks...

@gatecrasher777
Copy link
Contributor

gatecrasher777 commented Oct 18, 2021

I see. If I understand correctly, that sucks. Will there need to be an update every single time YouTube changes the player? How often is this and how sustainable is it?

The methodology used in PR #1022 has worked in ytcog without any need to update the code in the past few months. So the method should not require fixing every time a new player is issued.

But there is no guarantee that Google won't continue to throw curve balls that will require code updates in the future. But then, that has always been the case.

@TimeForANinja
Copy link
Collaborator

closing as dup of #964

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

5 participants