MusicBot icon indicating copy to clipboard operation
MusicBot copied to clipboard

"Sign in to confirm you’re not a bot." error with YouTube videos

Open MichailiK opened this issue 1 year ago • 69 comments

Bug Description

Playing YouTube videos may fail with the error "Sign in to confirm you’re not a bot."

YouTube seems to have recently rolled out this measure. It's affecting not only third party players/clients, but also YouTube's official website & apps when logged out. Several communities have come across a few discoveries. Here's a summary of what I've seen:

  1. This is an IP block.
  2. Instead of just banning one IP, it looks YouTube is blocking whole ASNs/IP ranges. If you encounter this issue, it's likely a "neighboring" IP address was bombarding YouTube, causing them to block the ASN/IP range you're in.
  3. The cobalt.tools developers seem to have found a workaround using OAuth2. This currently has a PR in the lavaplayer youtube source manager, however it seems a bit risky.

We are in the process of implementing OAuth2 login for JMusicBot in #1670. Use this with an alternative/burner!!! Google account to play tracks again on blocked IPs.

Checklist

MichailiK avatar Jun 07 '24 13:06 MichailiK

Also having this issue, if anyone has a solution or a quick and dirty workaround, I'd be down

PouletteMC avatar Jun 10 '24 10:06 PouletteMC

downloading youtube videos through tor might be a workaround for this problem. just tested this, it works

$ torsocks yt-dlp https://youtu.be/AL5vANu2gok                                                                                                                                                               
[youtube] Extracting URL: https://youtu.be/AL5vANu2gok
[youtube] AL5vANu2gok: Downloading webpage
[youtube] AL5vANu2gok: Downloading ios player API JSON
[youtube] AL5vANu2gok: Downloading player 4fc7f9fa
[youtube] AL5vANu2gok: Downloading m3u8 information
[info] AL5vANu2gok: Downloading 1 format(s): 302+251
[download] Destination: Black Holes Explained For Gen-Z [AL5vANu2gok].f302.webm
[download] 100% of   48.22MiB in 00:03:40 at 223.78KiB/s
[download] Destination: Black Holes Explained For Gen-Z [AL5vANu2gok].f251.webm
[download] 100% of   10.01MiB in 00:00:49 at 207.41KiB/s
[Merger] Merging formats into "Black Holes Explained For Gen-Z [AL5vANu2gok].webm"
Deleting original file Black Holes Explained For Gen-Z [AL5vANu2gok].f302.webm (pass -k to keep)
Deleting original file Black Holes Explained For Gen-Z [AL5vANu2gok].f251.webm (pass -k to keep)

TheBjoel2 avatar Jun 10 '24 16:06 TheBjoel2

This other repo fixed the issue by adding support for Oauth2, essentially allowing people to create dummy accounts for the bots to log in with: https://github.com/imputnet/cobalt/issues/551

Is this something we'd have to request support for in lavaplayer? Or is MusicBot responsible for querying the youtube API?

cmorley191 avatar Jun 15 '24 00:06 cmorley191

I'm facing the same issue:

Jun 17 23:49:14 env[441177]: [23:49:14] [ERROR] [AudioHandler]: Track BJhF0L7pfo8 has failed to play Jun 17 23:49:14 env[441177]: com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Sign in to confirm you’re not a bot Jun 17 23:49:14 env[441177]: at dev.lavalink.youtube.clients.skeleton.Client.getPlayabilityStatus(Client.java:72) Jun 17 23:49:14 env[441177]: at dev.lavalink.youtube.clients.skeleton.NonMusicClient.loadTrackInfoFromInnertube(NonMusicClient.java:98) Jun 17 23:49:14 env[441177]: at dev.lavalink.youtube.clients.skeleton.StreamingNonMusicClient.loadFormats(StreamingNonMusicClient.java:35) Jun 17 23:49:14 env[441177]: at dev.lavalink.youtube.track.YoutubeAudioTrack.loadBestFormatWithUrl(YoutubeAudioTrack.java:175)

Ozak93 avatar Jun 17 '24 21:06 Ozak93

I can confirm that with my VPS Server, it logs a "Sign in to confirm you’re not a bot." error everytime I want to play a youtube video on my server.

HOWEVER, just recently I found out my old instance of my bot in my local machine work perfectly with youtube. Perhaps it's something to do with how the I.P of my local machine is tied to my youtube account perhaps? maybe youtube blocked requests from my server because of that.

Moonchild6279 avatar Jun 24 '24 06:06 Moonchild6279

a bot called "Nero Bot" manages to still play YT videos- would be worth looking into how they manage past the whole thing with their "nodes".

Derahex avatar Jun 29 '24 13:06 Derahex

a bot called "Nero Bot" manages to still play YT videos- would be worth looking into how they manage past the whole thing with their "nodes".

  1. Nero Bot is not open source
  2. Minerea is also able to play YT. Not open source
  3. Chances are they are paying for a YT API or idk

TheBjoel2 avatar Jun 29 '24 14:06 TheBjoel2

Some people over lavaplayer suggests to use lavaplayer-fork to solve youtube issues

samusaran avatar Jul 09 '24 17:07 samusaran

Some people over lavaplayer suggests to use lavaplayer-fork to solve youtube issues

We're already using lavalink's lavaplayer fork, which is still receiving maintenance. For this issue specifically, a simple update is very unlikely to fix anything, because this block also affects all of YouTube's own apps/clients.

MichailiK avatar Jul 09 '24 19:07 MichailiK

So I guess this is a problem to any bot playing from YouTube as a source, right?

samusaran avatar Jul 09 '24 19:07 samusaran

See the various other issues on the internet on this topic for a rough history of this. The cobalt.tools developers seem to have found a workaround related to OAuth2, however this has not been implemented in any lavaplayer fork yet, and also seems a bit risky.

MichailiK avatar Jul 09 '24 20:07 MichailiK

The issue is fixed for me on version 0.4.2 🎉

samusaran avatar Jul 11 '24 15:07 samusaran

As this is an issue that affects every project using YouTube, several communities have come across a few discoveries. Here's a summary of what I've seen:

  1. This is an IP block.
  2. Instead of just banning one IP, it looks YouTube is blocking whole ASNs/IP ranges. If you encounter this issue, it's likely a "neighboring" IP address was bombarding YouTube, causing them to block the ASN/IP range you're in.
  3. The cobalt.tools developers seem to have found a workaround using OAuth2. This currently ~~is not implemented in lavaplayer~~ has a PR in the lavaplayer youtube source manager, however it seems a bit risky.
  4. IPv6 rotation might also work, which lavaplayer supports & encourages using. We haven't put much thought about supporting IPv6 rotation on JMusicBot yet though.

In my opinion, I see three main ways JMusicBot could move forward:

  1. Wait for OAuth2 support to be arrive in the lavaplayer youtube source manager & make use of that
  2. Allow configuring IPv6 rotation for users on VPS' as they are most commonly affected by these blocks.
  3. Implement support for an external tool (cobalt.tools) as a source, which have circumvented this block. I'm not sure if they would appreciate the additional traffic from JMusicBot users though.

Only my two cents though, no discussion around this has happened yet.

MichailiK avatar Jul 11 '24 18:07 MichailiK

This same issue has started occurring for me, has an easy solution been found yet? (one that a novice like me could implement)

T-h-o-r-p-e avatar Jul 18 '24 18:07 T-h-o-r-p-e

There is no solution at the moment.

MichailiK avatar Jul 18 '24 18:07 MichailiK

This started affecting me on a Hetzner IP range yesterday. Not a solution per se, but managed to temporarily workaround it by routing my jmusicbot Docker container through my WireGuard Docker container running a config from a paid VPN service.

Snaacky avatar Jul 18 '24 20:07 Snaacky

This started affecting me on a Hetzner IP range yesterday

I'm also using Hetzner. Not sure if that's a coincidence or not.

T-h-o-r-p-e avatar Jul 18 '24 20:07 T-h-o-r-p-e

I'm also using Hetzner. Not sure if that's a coincidence or not.

This is expected. As I mentioned earlier, it seems like YouTube is banning entire ASNs/IP ranges, rather than just individual IP addresses. Chances are pretty high that all of Hetzner’s ASNs/IPs have been banned.

MichailiK avatar Jul 18 '24 21:07 MichailiK

As a test, on my server computer i created a new google account (so it appears that the registration is occurring from the banned ip) and logged in. I was able to play youtube video's in the browser! But when i log out in browser, once again im presented with the error. So if the bot can log into youtube, that should solve the problem for everyone.

Ruok2bu avatar Jul 18 '24 22:07 Ruok2bu

So if the bot can log into youtube, that should solve the problem for everyone.

No, apparently this block affects both with or without an account, on the same IP. See: https://github.com/lighttube-org/LightTube/issues/154 https://github.com/yt-dlp/yt-dlp/issues/10085

Edit: Oops, I mentioned another problem without even paying much attention. Yes, you can "fix" it by connecting with an account (https://github.com/yt-dlp/yt-dlp/issues/10128#issuecomment-2185261677), but I don't think it would be very ideal for a project like this (Not to mention that Google can easily end up discovering this repository and try to destroy it, I think). The only four solutions I've seen for now are:

  • Add full support for IPv6 rotation, as stated earlier in this Issue.
  • Set PO_token e visitordata ID (https://github.com/iv-org/invidious/pull/4789; and it's still in WIP, and I don't know if their correction can be valid here or in lavaplayer)
  • Wait for lavaplayer support to add OAuth2 (And yes, it is still risky and is a temporary solution)
  • Change the default client player to web_creator, since it was one that was not affected by the new change. (https://github.com/yt-dlp/yt-dlp/pull/10457; the only problem is that there will be audio loss, and it's also a fairly temporary solution, since YouTube can change this client as well)

While there is no 100% working solution, the only way to continue using the bot is to go to IPs, servers and/or VPNs that YouTube has not (yet) blocked.

tag27 avatar Jul 19 '24 04:07 tag27

this also affects me i used netrc file and add the credentials of youtube but still get the same error

mersal-developing avatar Jul 20 '24 08:07 mersal-developing

YT seems to want to shoot a bullet in his own foot.... I have the same issue from 4 servers in 4 different DC. well done YT, soon you are going to ban yourself as some of your servers are hosted in the same DC of ours!

ROBERT-MCDOWELL avatar Jul 20 '24 18:07 ROBERT-MCDOWELL

can confirm it's happening for me on hetzner also
not using musicbot though

BenCos17 avatar Jul 21 '24 15:07 BenCos17

It’s also happening to me on Aruba (Italian hosting provider)

samusaran avatar Jul 21 '24 15:07 samusaran

Same. Not working for me either. Using a Hetzner Dedicated Server with Windows Server 2022 // Docker Desktop.

xFanexx avatar Jul 22 '24 01:07 xFanexx

i am just popping in to say that after a bunch of tinkering with my OVHcloud server yesterday i only found out that if you run jmusicbot and then a VPN (OpenVPN + Windscribe is what ive used) on top of it then will the bot finally be able to play youtube links without any issues, granted this is still a workaround and you may have to restart your vpn again each time if youtube happens to ban the one the vpn is running on but so far ive had 0 issues since ive went and used this solution. just thought id let everyone know about this since ive seen a bunch of people still trying to figure out how to get their bot to play yt links so yeah i hope this helps

hydrogenicMetallium avatar Jul 23 '24 04:07 hydrogenicMetallium

same on OVH server.. any resolution is planned?

Zawodowiec1532 avatar Jul 23 '24 22:07 Zawodowiec1532

same on OVH server.. any resolution is planned?

Using cloudflare warp on my racknerd vps fixed the issue BUT i lost accès to ssh and now use vnc because I didn't set up cloudflare warp correctly and I'm too lazy to reinstall it, I reccomend you to search on google stuff like "can't accès ssh after installing cloudflare warp" and you will probably find something to not have the same issue as me

Sorry if my English is bad

BlobIsBack avatar Jul 25 '24 10:07 BlobIsBack

Hello! I also encountered the same problem. Has anyone found a solution to this problem? My server is from Hentzer. Located in Finland! изображение изображение Of course I have a nextcloud cloud. But maybe someone already knows the solution to this problem?

C0la149 avatar Jul 25 '24 10:07 C0la149

But maybe someone already knows the solution to this problem?

No, it doesn't have a 100% effective solution so far. There are repositories with the same problem, and others have some pulls that can fix the problem, but many will fix it temporarily.

The best thing to do is to wait.

tag27 avatar Jul 25 '24 12:07 tag27