Discord music bot stopped playing YouTube: what changed

Music bots stopped playing YouTube because YouTube blocks automated access and the extraction libraries break or were discontinued. There is no permanent fix: only fragile workarounds or other sources.

Updated 5 min read

Learning objectives

After reading this article you will be able to:

  • Understand why YouTube stopped working in music bots
  • Identify which error and which library your bot uses
  • Choose between fragile workarounds and alternative audio sources
On this page

If your music bot played YouTube without trouble and suddenly started answering with errors, the fault is almost never in your code. YouTube offers no official way for Discord bots to pull audio from it, so every music bot depends on libraries that imitate a YouTube client. When YouTube changes something, they break.

The topic is volatile: before you act, check your library's documentation for its current state.

/playBot orLavalinkYouTubeAudio playsBlocked“not a bot”FormatunavailableorAnother sourceSoundCloud, Bandcamp, HTTP links
Every request to YouTube can play or get blocked, and the fix is fragile; other sources don't go through that block.

Why did the bot stop playing YouTube?#

Three factors add up.

  1. Terms of service. YouTube's terms forbid accessing the service by automated means (robots, botnets, scrapers) without prior written permission. They also forbid circumventing or interfering with the service's security features and downloading content unless the service allows it. In 2021, after requests from Google, large bots such as Groovy and Rythm shut down (Groovy and Rythm, in The Verge).
  2. Automation detection. YouTube flags requests that look automated and answers with blocks such as the sign-in prompt.
  3. Changes to clients and deciphering. Libraries pose as YouTube clients (web, Android, TV) and solve JavaScript challenges. When a client stops working, the library breaks until someone ships a fix.

Which error do you see?#

The symptom depends on the library. The most common one:

text
Sign in to confirm you're not a bot

That is the automation block. The README of youtube-source, Lavalink's YouTube plugin, describes exactly this case and says OAuth and poToken may help, but are not a guaranteed fix.

Other signs: a search that comes back empty, a track that loads and ends within seconds, or a bot that joins the voice channel and stays silent. Since each library reports problems differently, the diagnosis starts with finding out which one you use.

How do you find out which library the bot uses?#

If your project uses Status
discord-player v7 The YouTube extractor was removed. The docs say YouTube playback was discontinued because extraction libraries break so often. The library still detects links, but neither plays them nor extracts metadata.
Lavalink with the built-in YouTube source Disabled in the recommended configuration and replaced by the youtube-source plugin.
Lavalink with youtube-source Update the plugin and review the client list.
yt-dlp (directly or through a wrapper) Update yt-dlp and install a JavaScript runtime.
Old, unmaintained extraction packages Switch to one of the options above or to another source.

This section and the next summarize what each project's documentation says. None of these tweaks makes the use compliant with YouTube's terms.

If you use Lavalink v4, disable the built-in source (the Lavalink docs mark it as deprecated) and use the plugin. Replace VERSION with the version shown on the Releases tab of youtube-source:

yaml
lavalink:
  server:
    password: "change-this-password"
    sources:
      youtube: false
  plugins:
    - dependency: "dev.lavalink.youtube:youtube-plugin:VERSION"
      snapshot: false

plugins:
  youtube:
    enabled: true
    allowSearch: true
    allowDirectVideoIds: true
    allowDirectPlaylistIds: true
    clients:
      - MUSIC
      - ANDROID_VR
      - WEB
      - WEBEMBEDDED

Clients are tried in list order. A few points from the plugin's documentation:

  • MUSIC is for search only (the ytmsearch: prefix), not for playback.
  • The ANDROID client is described as heavily restricted and often broken. Prefer ANDROID_VR and the others. TV requires sign-in to play.
  • TVHTML5EMBEDDED was removed in version 1.18.0 because it stopped working for playback. TVHTML5_SIMPLY took its place.
  • poToken only applies to WEB and WEBEMBEDDED. OAuth only applies to TV. You don't need one if you use the other.
  • Remote deciphering is supported (remoteCipher), with a separate server, yt-cipher.

After changing application.yml, restart Lavalink and read the logs to see which client failed.

How do you try to fix it with yt-dlp?#

yt-dlp now requires a JavaScript runtime to solve YouTube's challenges, through the EJS project's scripts. Deno is recommended and enabled by default; Node.js also works if you enable it with --js-runtimes. The minimum version of each runtime is in the documentation.

When the default clients fail, the extractors page suggests the mweb client with a PO Token, which yt-dlp cannot generate on its own (wiki).

Are cookies or OAuth worth it?#

It is the most cited workaround and the riskiest. youtube-source warns that OAuth can get the account terminated, recommends burner accounts and notes that under heavy traffic it can cause rate-limit errors. yt-dlp says using your account raises the risk of a ban. Never use your personal account.

One point no code solves: the terms of service question remains. Running a public bot that pulls audio from YouTube is a risky decision, and it is the responsibility of whoever runs the bot.

What alternatives are there?#

  • Other Lavalink sources, such as SoundCloud, Bandcamp, Twitch, Vimeo and HTTP links, which the server ships with (Lavalink configuration). Each service has its own terms of use.
  • Your own files or direct audio links that you have the right to play.
  • Services with an official audio API, respecting each one's terms.
  • Accepting the fragility: keep the plugin updated, monitor the bot and tell your users when YouTube fails.

Pin a version of the plugin or library in production and follow its releases. When YouTube changes again, the fix usually ships as a new release, and your job is to apply it. To understand the audio piece behind all this, see what Lavalink is.

How to do this on Square Cloud#

On Square Cloud, a music bot runs like any other Discord bot: you deploy it by ZIP upload in the dashboard, the CLI, GitHub or the VS Code extension, with discord.js, discord.py, JDA or another Gateway library. Voice is supported and FFmpeg is available in the container.

Lavalink runs as a separate web application in the same account (from 512 MB), and the bot connects to its subdomain on port 443 with a secure connection (secure: true). That way you update the YouTube plugin by restarting only Lavalink. The plan's RAM is a pool shared across your applications, with a minimum of 256 MB per background app. Environment variables (such as the Lavalink password) live in the dashboard and apply on the next restart.

None of this changes what YouTube decides to block: hosting keeps the process online, but what the bot does with YouTube remains the responsibility of whoever runs it. For the step-by-step deploy, see how to host a discord.js bot. To see what's available for bots, visit the Discord bots on Square Cloud page.

Bot hosting

Keep your bot online 24/7 with automatic restarts

Learn more

FAQs

Why won't my Discord music bot play YouTube anymore?

YouTube blocks automated requests and changes its clients often, which breaks the libraries that extract the audio. In some cases the library was discontinued, like the YouTube extractor in discord-player v7.

What does 'Sign in to confirm you're not a bot' mean?

It is YouTube blocking requests it classifies as automated. The Lavalink and yt-dlp projects mention OAuth and poToken as workarounds, but neither is guaranteed.

Will updating the library fix it?

Sometimes, when the problem is a change that a new release already fixed. If the library was discontinued, updating does not help: you need a different solution or a different source.

Is it safe to use a Google account in the bot?

No. youtube-source itself warns that OAuth login can get the account terminated and recommends burner accounts. yt-dlp gives a similar warning about cookies.

Next articleHow to host Evolution API (WhatsApp)To host Evolution API you need Node.js, PostgreSQL or MySQL, Redis and an always-on process. Follow the steps, from the .env file to the first message.