This repository is a maintained fork focused on keeping YouTube playback working after upstream stalled.
Important differences from the original project:
- This fork supports YouTube OAuth playback fallback.
- If you want reliable playback for blocked or age-restricted videos, you should use a dedicated burner Google account.
- Do not use your main Google account.
- If the burner account cannot play a video in the normal YouTube browser UI, the bot will usually not be able to play it either.
If you only care about unrestricted videos, the bot may still work without OAuth.
If you want restricted videos, age-gated videos, or better resilience against This video requires login, follow the full setup below.
- A Discord bot token as usual.
- A separate Google burner account just for this bot.
- That Google account must be able to play the target video directly on YouTube in a browser.
- Create or pick a burner Google account.
- Set the birthday on that account to 18+.
- Complete any Google or YouTube age verification required for that account.
- Open YouTube in a normal browser while signed into that burner account.
- Confirm that the exact age-restricted video plays in the browser UI.
If step 5 fails, the bot is not ready yet. Fix the account first.
This fork adds the following config keys:
ytoauth = true
ytoauthrefreshtoken = "YT_OAUTH_REFRESH_TOKEN_HERE"
When using OAuth, do not use a poToken at the same time.
Leave these at their placeholders:
ytpotoken = "PO_TOKEN_HERE"
ytvisitordata = "VISITOR_DATA_HERE"
- Open your
config.txt. - Set
ytoauth = true. - Leave
ytoauthrefreshtoken = "YT_OAUTH_REFRESH_TOKEN_HERE"for the first run. - Make sure
ytpotokenandytvisitordataare still placeholders. - Start the bot.
- Watch the bot logs.
- The bot will print a message telling you to go to
https://www.google.com/deviceand enter a code. - Open that URL in a browser.
- Sign in with the burner Google account.
- Enter the device code shown in the bot logs.
- Approve the connection.
- Wait for the bot logs to print the refresh token.
The log line will look similar to this:
OAUTH INTEGRATION: Token retrieved successfully. Store your refresh token as this can be reused. (your_refresh_token_here)
- Stop the bot.
- Open
config.txt. - Replace the placeholder with the real refresh token:
ytoauth = true
ytoauthrefreshtoken = "paste_the_refresh_token_here"
- Save the file.
- Start the bot again.
- Check the logs for:
YouTube access token refreshed successfully
At that point the token is persisted and future restarts should not require the device flow again unless Google invalidates the token.
- Join a voice channel.
- Use the bot to play a normal YouTube video.
- Use the bot to play an age-restricted YouTube video.
- If the browser account can play the video but the bot cannot, check the bot logs for the current playability reason.
This video requires loginThis usually means OAuth is not enabled, the refresh token is missing, the refresh token is invalid, or the account is not sufficiently verified.Sign in to confirm your ageThe burner account still does not pass YouTube age verification for that video.- The video works in Discord for some links but not others The failing video may be private, region-blocked, removed, or age-gated beyond what the account currently allows.
- The device flow appears again after restart
The refresh token was not copied into
config.txtcorrectly or Google invalidated it.
A cross-platform Discord music bot with a clean interface, and that is easy to set up and run yourself!
- Easy to run (just make sure Java is installed, and run!)
- Fast loading of songs
- No external keys needed (besides a Discord Bot token)
- Smooth playback
- Server-specific setup for the "DJ" role that can moderate the music
- Clean and beautiful menus
- Supports many sites, including Youtube, Soundcloud, and more
- Supports many online radio/streams
- Supports local files
- Playlist support (both web/youtube, and local)
JMusicBot supports all sources and formats supported by lavaplayer:
- YouTube
- SoundCloud
- Bandcamp
- Vimeo
- Twitch streams
- Local files
- HTTP URLs
- MP3
- FLAC
- WAV
- Matroska/WebM (AAC, Opus or Vorbis codecs)
- MP4/M4A (AAC codec)
- OGG streams (Opus, Vorbis and FLAC codecs)
- AAC streams
- Stream playlists (M3U and PLS)
Please see the Setup Page to run this bot yourself!
Please read the Issues List before suggesting a feature. If you have a question, need troubleshooting help, or want to brainstorm a new feature, please start a Discussion. If you'd like to suggest a feature or report a reproducible bug, please open an Issue on this repository. If you like this bot, be sure to add a star to the libraries that make this possible: JDA and lavaplayer!
This bot (and the source code here) might not be easy to edit for inexperienced programmers. The main purpose of having the source public is to show the capabilities of the libraries, to allow others to understand how the bot works, and to allow those knowledgeable about java, JDA, and Discord bot development to contribute. There are many requirements and dependencies required to edit and compile it, and there will not be support provided for people looking to make changes on their own. Instead, consider making a feature request (see the above section). If you choose to make edits, please do so in accordance with the Apache 2.0 License.



