Androz2091 / discord-player

🎧 Complete framework to simplify the implementation of music commands using discord.js v14
https://discord-player.js.org/
MIT License
588 stars 190 forks source link

RISK OF BAN USING YOUTUBE COOKIES ("Sign in to confirm you're not a bot" error) #1913

Closed retrouser955 closed 2 weeks ago

retrouser955 commented 1 month ago

As of recent events, many people are having issues using YouTube as a stream provider due to Google cracking down on YouTube downloaders. Many are getting errors suggesting "Sign in to confirm you're not a bot" and according to this message, users who are using YouTube cookies to bypass this restrictions are getting their accounts banned. If you are using YouTube cookies, make sure the cookies are of a throwaway alt account or remove them IMMEDIATELY from discord-player. While this issue persist, I recommend switching over to SoundCloud for a while. See this guide.

retrouser955 commented 1 month ago

Furthermore, check out this message on the support server.

retrouser955 commented 1 month ago

An idea is to use a package like puppeteer-stream to simulate a browser and sign in through email and password. However, this does come at the cost of increased resource usage due to having to run a browser for each scraping attempt which is a bit overkill just to create a Discord Bot.

retrouser955 commented 1 month ago

This seemed to be fixed as of latest https://cobalt.tools update but I am still unable to see any active issues in the YouTube engines discord-player is using such as yt-stream and @distube/ytdl-core

fpsone commented 1 month ago

This seemed to be fixed as of latest https://cobalt.tools update but I am still unable to see any active issues in the YouTube engines discord-player is using such as yt-stream and @distube/ytdl-core

I'm using @distube/ytdl-core and it still works normally. I asked its developer and he said youtube check your ip and see if it comes from an isp or a datacenter (https://www.maxmind.com/en/geoip-demo -> Connection Type). @distube/ytdl-core also semi-simulate the browser by setting the cookie when youtube request with its cookie agent so it is safer. I have just realized discord-player create a new agent on every request so it is not saving the new cookie after requests and not safer https://github.com/Androz2091/discord-player/blob/987b2deb2b996d5a3e02d39dbd4a2c5c46ec9d4c/packages/extractor/src/extractors/common/helper.ts#L193

retrouser955 commented 1 month ago

This seemed to be fixed as of latest https://cobalt.tools update but I am still unable to see any active issues in the YouTube engines discord-player is using such as yt-stream and @distube/ytdl-core

I'm using @distube/ytdl-core and it still works normally. I think youtube check your ip and see if it comes from an isp or a datacenter (https://www.maxmind.com/en/geoip-demo -> Connection Type). ~@distube/ytdl-core also semi-simulate the browser by setting the cookie when youtube request with its cookie agent so it is safer.~ I have just realized discord-player create a new agent on every request so it is not saving the new cookie after requests and not safer

https://github.com/Androz2091/discord-player/blob/987b2deb2b996d5a3e02d39dbd4a2c5c46ec9d4c/packages/extractor/src/extractors/common/helper.ts#L193

Hi @fpsone, thanks for the insights. Yes what you are saying is completely true. YouTube does check your IP when making a request to their website. This is why many users who are using VPNs are experiencing this issue on YouTube's own clients.

Additionally, this is why discord-player users are experiencing this issues mostly on their hosts (VPS providers) instead of on their local machine.

twlite commented 1 month ago

@fpsone are you able to make a pr for this?

fpsone commented 1 month ago

@fpsone are you able to make a pr for this?

The problem is, cookie is now required when using a datacenter IP.

Regarding distube's cookie agent, discord-player still utilizes youtube-sr for searching, fetching playlists,.... Therefore, I don't think it is necessary to create a pull request for this scenario.

retrouser955 commented 1 month ago

@fpsone are you able to make a pr for this?

The problem is, cookie is now required when using a datacenter IP.

Regarding distube's cookie agent, discord-player still utilizes youtube-sr for searching, fetching playlists,.... Therefore, I don't think it is necessary to create a pull request for this scenario.

Hey @fpsone. As I said in my first message, usage of cookies may trigger the account to be banned/restricted if the request is coming from a datacenter. The solution I have mentioned in my other message has not been implemented in discord-player at the time of this message.

fpsone commented 1 month ago

@retrouser955 Just use alt accounts, we still don't know how youtube really restricted banned those accounts.

retrouser955 commented 1 month ago

@retrouser955 Just use alt accounts, we still don't know how youtube really ~restricted~ banned those accounts.

Hey @fpsone thanks for the reply. While this may fix the issue in the short run, this is more of a band-aid on the wound rather than treating the actual wound itself. We are looking for long term solutions.