kkdai / youtube

Download Youtube Video in Golang
MIT License
3.41k stars 439 forks source link

Error:can't bypass age restriction: login required to confirm your age #343

Open LaoJiuYes opened 3 months ago

LaoJiuYes commented 3 months ago

Hello everyone! It used to work fine. Today I got an error message "can't bypass age restriction: login required to confirm your age". My network environment is Tokyo, Japan. Is there any law on age restriction in Japan in the past month (like Korea. Login verification is required)? Has anyone encountered this problem? How did you solve it? Thank you.

shoce commented 3 months ago

https://github.com/kkdai/youtube/issues/336

shoce commented 3 months ago

https://github.com/kkdai/youtube/issues/336#issuecomment-2248517035

LaoJiuYes commented 3 months ago

336

Thanks for your reply. I have tried many VPS. Still no use. I tried to access Google Scholar with these IPs and it was accessible. But I couldn't download. I was still using it last month, but it's not working this month. I can only wait...

gcottom commented 2 months ago

To summarize what I've found in other threads among yt downloading applications and my own recent experiences, Google is blocking IPs. If you want to run a yt service on AWS, its a complete no go these days. I switched from running my personal service on AWS to local about a month ago. There appears to be multiple levels to the blocking that happens. On cloud services it seems to be a complete block. I've tested locally and found that you can do about 600 downloads in a row (one after another, continuously) before you incur a temporary block which can last anywhere from about 15 minutes to an hour. This can effectively kill your batch download unless you have a long running retry. Running 5 concurrent downloads at a time, you can get about 1k videos downloaded, however concurrency comes at the price of a longer ban. Since that ban was over a day, I came upon this thread which lead me to others. What I learned from the other threads was that:

  1. You should not pass cookies to youtube http client. Google does something with the cookies for every video and if the transforms don't match, you can get an account level ban.
  2. Google is banning IP addresses that download "too much". How much is too much? That's hard to tell. I'd say the days of downloading in bulk are over though, unless you can change your IP address on demand.
  3. IPv6 fingerprinting/tracking. On some systems IPv6 uses part of your MAC address as part of your IPv6 address. If you don't have IPv6 privacy extensions turned on, you may want to look into it. In my specific case, after changing my IPv6 address, and finding that the issue still persisted, I took drastic measures and changed the IPv6 settings on my Mac to Link-Local Only, effectively, turning IPv6 off as far as this computer and the internet are concerned. Why was the IP on my router not blocked? Now that, I don't know. It's possible that Google is using a form of IPv6 prefix hijacking to ensure you are banned for good. I will note that while I was banned from downloading, I was able to still stream from youtube and youtube music.
  4. The bans don't seem to completely block you from downloading, just hinder you. If you have an application that will relentlessly retry, you may still get through, even while banned. I say this because, while banned, I tried my 1000 video batch download, with a 3 retry for each video. While most failed, I did see a few of them that still managed to go through. So that's food for thought.
LaoJiuYes commented 2 months ago

To summarize what I've found in other threads among yt downloading applications and my own recent experiences, Google is blocking IPs. If you want to run a yt service on AWS, its a complete no go these days. I switched from running my personal service on AWS to local about a month ago. There appears to be multiple levels to the blocking that happens. On cloud services it seems to be a complete block. I've tested locally and found that you can do about 600 downloads in a row (one after another, continuously) before you incur a temporary block which can last anywhere from about 15 minutes to an hour. This can effectively kill your batch download unless you have a long running retry. Running 5 concurrent downloads at a time, you can get about 1k videos downloaded, however concurrency comes at the price of a longer ban. Since that ban was over a day, I came upon this thread which lead me to others. What I learned from the other threads was that:

  1. You should not pass cookies to youtube http client. Google does something with the cookies for every video and if the transforms don't match, you can get an account level ban.
  2. Google is banning IP addresses that download "too much". How much is too much? That's hard to tell. I'd say the days of downloading in bulk are over though, unless you can change your IP address on demand.
  3. IPv6 fingerprinting/tracking. On some systems IPv6 uses part of your MAC address as part of your IPv6 address. If you don't have IPv6 privacy extensions turned on, you may want to look into it. In my specific case, after changing my IPv6 address, and finding that the issue still persisted, I took drastic measures and changed the IPv6 settings on my Mac to Link-Local Only, effectively, turning IPv6 off as far as this computer and the internet are concerned. Why was the IP on my router not blocked? Now that, I don't know. It's possible that Google is using a form of IPv6 prefix hijacking to ensure you are banned for good. I will note that while I was banned from downloading, I was able to still stream from youtube and youtube music.
  4. The bans don't seem to completely block you from downloading, just hinder you. If you have an application that will relentlessly retry, you may still get through, even while banned. I say this because, while banned, I tried my 1000 video batch download, with a 3 retry for each video. While most failed, I did see a few of them that still managed to go through. So that's food for thought.

Thanks for your reply, brother. My IP is valid for all Google services, except downloading. I only download one video at a time, not in bulk, and I download about 3-4 videos a month. I will only download if I come across a particularly good work. I think what you said about Google's ban mechanism is correct. I came to the same conclusion after testing, because other services allow access, but only downloading is not allowed. Maybe Google has added its anti-download mechanism.

ppalone commented 3 weeks ago

Has anyone found any workaround?