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

Cannot download averagely videos that last more than 1 minute #54

Closed
mr-flame7892 opened this issue Aug 1, 2024 · 12 comments
Closed

Cannot download averagely videos that last more than 1 minute #54

mr-flame7892 opened this issue Aug 1, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@mr-flame7892
Copy link

Describe the bug

When I'm trying to download a video that lasts more than a minute, the "readable" event isn't triggered and when I try to see if the stream is readable, it says that the stream is readable but no stream is returned (there's no error message). But when I tried to download videos that last less than a minute everything works correctly.

Environment

  • @distube/ytdl-core version: 4.13.7
  • Node.js version: 20.15.1
  • Operating system: Windows 11
@mr-flame7892 mr-flame7892 added the bug Something isn't working label Aug 1, 2024
@mr-flame7892 mr-flame7892 changed the title Cannot download videos last more than 1 minute Cannot download videos that last more than 1 minute Aug 1, 2024
@mr-flame7892
Copy link
Author

It seems that some videos are playable even if its duration is over 1 minute, therefore the duration doesn't matter (for example: https://www.youtube.com/watch?v=jzi6RNVEOtA works perfectly for me). Also when the stream isn't readable, the "errored" property of the stream returns a 403 error message and the stream is destroyed:

image_2024-08-01_202148128

@qubiack
Copy link

qubiack commented Aug 1, 2024

Are you using agent ?

@mr-flame7892
Copy link
Author

Are you using agent ?

Yes

@qubiack
Copy link

qubiack commented Aug 1, 2024

Can you provide 2 links: video is working and not working for you?

@mr-flame7892
Copy link
Author

Can you provide 2 links: video is working and not working for you?

Working link: https://www.youtube.com/watch?v=jzi6RNVEOtA

Not working link: https://www.youtube.com/watch?v=uu2XSQgdQDY

@qubiack
Copy link

qubiack commented Aug 1, 2024

@MR-Flame-exe both work for me in the latest version of ytdl. Could you provide a part of code you are using to download that files?

@mr-flame7892
Copy link
Author

@MR-Flame-exe both work for me in the latest version of ytdl. Could you provide a part of code you are using to download that files?

        var stream = ytdl(song.download_url, {
          highWaterMark: 1 << 25,
          filter: "audioonly",
          quality: "lowestaudio",
          agent,
        }).once("readable", async function () {

          console.log(`✅ - The stream of ${song.url} has been downloaded!`)

        })

@qubiack
Copy link

qubiack commented Aug 1, 2024

I think that I had that issue few years ago. Some YT files don't have audioonly versions. You can check that by different API - ytdl.getInfo(url, {agent}) .

My workaround was to download always mp4 and convert it into mp3 in next step.

@mr-flame7892
Copy link
Author

I think that I had that issue few years ago. Some YT files don't have audioonly versions. You can check that by different API - ytdl.getInfo(url, {agent}) .

My workaround was to download always mp4 and convert it into mp3 in next step.

Pretty sure it's not a problem related to the audioonly's filter, I mean every videos worked with the bot since today therefore I think it's not an issue related to my code, just an issue with the YouTube API or something. Btw I also tried to use ytdl-core instead of distube but it gets worse, no video was readable.

@mr-flame7892 mr-flame7892 changed the title Cannot download videos that last more than 1 minute Cannot download averagly videos that last more than 1 minute Aug 1, 2024
@mr-flame7892 mr-flame7892 changed the title Cannot download averagly videos that last more than 1 minute Cannot download averagely videos that last more than 1 minute Aug 1, 2024
@skick1234
Copy link

skick1234 commented Aug 2, 2024

On web client, which ytdl-core is using, have an A/B testing to prevent bots. I will investigate it and release an update after working hours.

@skick1234
Copy link

Also this issue related to #31

@jaysun0
Copy link

jaysun0 commented Aug 3, 2024

I had my app working from server in Finland. Most of the videos downloaded were just blank files. Sometitmes after 2,3 attemptes on each video - manaded to download normaly. Now switched app server location to another country. ~ Half an hour app is working fine. Not sure that it's 100% solution. Just for your information. Thank you all and me for concerns :)

skick1234 added a commit that referenced this issue Aug 4, 2024
Fixed #54
Fixed #31
Fixed #30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants