distubejs / ytdl-core

YouTube video downloader in javascript.
MIT License
291 stars 50 forks source link

Access to rr4---sn-qxaeenlz.googlevideo.com was denied (Status code: 403) #31

Closed msalik42 closed 3 months ago

msalik42 commented 4 months ago

Ran the following code and it returns the video URLs, But when I try to access the files, it says access denied const ytdl = require("@distube/ytdl-core");

ytdl.getBasicInfo("https://www.youtube.com/watch?v=eFe8bJ9e_FA").then((info) => { console.log(info); });

Pesepvtltd commented 4 months ago

have you got solution?

skick1234 commented 4 months ago

Due to recent youtube changes, you have to update to the latest version and download the stream from the same ip (and maybe the cookies). So if you want to download it from another client, you have to download it to your server and use other methods to download it from your server.

Lampropoulosss commented 4 months ago

The issue is that I use the library on the server and I stream the video to my client myself. So, no other IP is used or anything. And it still, randomly, throws the error.

skick1234 commented 4 months ago

It seems youtube blocked download some itag, try changing the format, quality or filter options

mtripg6666tdr commented 4 months ago

FYI this issue may be related to this pr

pauliusdotpro commented 4 months ago

I've also started getting issues

Raul824 commented 4 months ago

Well after fiddling with all permutations and combinations my assumption is there is some kind of protection on official channels or some strings.

So If i tried to getinfo of official music video the stream gives 403 error but if I do a getinfo of same song uploaded by someone else it works.

example. This doesn't work https://www.youtube.com/watch?v=eFjjO_lhf9c

This works https://www.youtube.com/watch?v=1i0i5lG6Ojc

@msalik42 Try same thing on reaction video of the original video.

vasanth-raja commented 4 months ago

403 fixed or any solutions yet?

skick1234 commented 4 months ago

I disabled cache on 4.13.7, 403 is gone on my side but I don't know if it works on every video. Please try it and give feedback.

ichsanulaulia commented 4 months ago

I disabled cache on 4.13.7, 403 is gone on my side but I don't know if it works on every video. Please try it and give feedback.

image all format quality etc , 403 at all but this happend for some videos not all videos

skick1234 commented 4 months ago

image

all format quality etc , 403 at all

but this happend for some videos not all videos

Can you give me video url and your ip location as well?

ichsanulaulia commented 4 months ago

Can you give me video url and your ip location as well?

https://youtu.be/ozckx6_Z2a4 ip loc : Germany

vasanth-raja commented 4 months ago

i switched to another package thats working at the moment, but docs are not easy to pick up https://github.com/LuanRT/YouTube.js/blob/main/examples/download/index.ts

skick1234 commented 4 months ago

Can you give me video url and your ip location as well?

https://youtu.be/ozckx6_Z2a4 ip loc : Germany

Weird, I don't have any problem with it, can you test with browser headers like user-agent, origin,... and cookies. I don't have 403 problem with your video

fsholehan commented 4 months ago

Now, the local environment is also getting a 403 error.

Lampropoulosss commented 4 months ago

i switched to another package thats working at the moment, but docs are not easy to pick up https://github.com/LuanRT/YouTube.js/blob/main/examples/download/index.ts

Doens't work. Tried it with a few videos, for most of them it logs "server responded with not a 2.x.x status code

alanor87 commented 4 months ago

The same - 403 on some videos - others are being downloaded normally.

https://www.youtube.com/watch?v=6OZQ9Y2c1kY - works

https://www.youtube.com/watch?v=FavdK4bv56Q - does not work

Lampropoulosss commented 4 months ago

Does this issue appear to other libraries / tools too? Such as yt-dlp, youtube-dl etc?

nukeop commented 4 months ago

After I updated to the newest release, these problems are completely gone.

fsholehan commented 4 months ago

After I updated to the newest release, these problems are completely gone.

Yes, but with the same video, sometimes it returns a 403 error, and sometimes it works.

yyildiz commented 4 months ago

Are you on the latest @fsholehan?

nukeop commented 4 months ago

Suddenly 403s are back, with almost every single stream.

fsholehan commented 4 months ago

Are you on the latest @fsholehan?

Yes, I'm on the latest version

skick1234 commented 4 months ago

It looks like YouTube is conducting A/B testing to prevent bots. I’ll look into their anti-bot token and update the package after my working hours.

red1ul commented 4 months ago

It looks like YouTube is conducting A/B testing to prevent bots. I’ll look into their anti-bot token and update the package after my working hours.

Please refer to the following URL: https://x.com/justusecobalt/status/1799043789967036620

Marbanz commented 4 months ago

I did some testing and found out that using cookies of a yt premium account doesn't give errors, while without cookies or with the cookies of a non premium account it gives the 403 error

DevBelkin commented 3 months ago

I did some testing and found out that using cookies of a yt premium account doesn't give errors, while without cookies or with the cookies of a non premium account it gives the 403 error

I also tried with the premium account and it works without any error.

Brainicism commented 3 months ago

https://github.com/yt-dlp/yt-dlp/pull/10457 Not sure if you've seen this already, yt-dlp mitigated this by swapping to a non-web client.

Also: https://github.com/yt-dlp/yt-dlp/pull/10648