Skip to content

Commit 285ac78

Browse files
committed
Document fork OAuth setup
1 parent b2eb4e5 commit 285ac78

1 file changed

Lines changed: 108 additions & 0 deletions

File tree

README.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,114 @@
1111
[![Build and Test](https://github.com/jagrosh/MusicBot/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/jagrosh/MusicBot/actions/workflows/build-and-test.yml)
1212
[![CodeFactor](https://www.codefactor.io/repository/github/jagrosh/musicbot/badge)](https://www.codefactor.io/repository/github/jagrosh/musicbot)
1313

14+
## DevSH Fork Notes
15+
16+
This repository is a maintained fork focused on keeping YouTube playback working after upstream stalled.
17+
18+
Important differences from the original project:
19+
1. This fork supports YouTube OAuth playback fallback.
20+
2. If you want reliable playback for blocked or age-restricted videos, you should use a dedicated burner Google account.
21+
3. Do not use your main Google account.
22+
4. 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.
23+
24+
## YouTube OAuth Setup For This Fork
25+
26+
If you only care about unrestricted videos, the bot may still work without OAuth.
27+
If you want restricted videos, age-gated videos, or better resilience against `This video requires login`, follow the full setup below.
28+
29+
### What you need
30+
31+
1. A Discord bot token as usual.
32+
2. A separate Google burner account just for this bot.
33+
3. That Google account must be able to play the target video directly on YouTube in a browser.
34+
35+
### Google account preparation
36+
37+
1. Create or pick a burner Google account.
38+
2. Set the birthday on that account to 18+.
39+
3. Complete any Google or YouTube age verification required for that account.
40+
4. Open YouTube in a normal browser while signed into that burner account.
41+
5. Confirm that the exact age-restricted video plays in the browser UI.
42+
43+
If step 5 fails, the bot is not ready yet. Fix the account first.
44+
45+
### Config values
46+
47+
This fork adds the following config keys:
48+
49+
```conf
50+
ytoauth = true
51+
ytoauthrefreshtoken = "YT_OAUTH_REFRESH_TOKEN_HERE"
52+
```
53+
54+
When using OAuth, do not use a `poToken` at the same time.
55+
Leave these at their placeholders:
56+
57+
```conf
58+
ytpotoken = "PO_TOKEN_HERE"
59+
ytvisitordata = "VISITOR_DATA_HERE"
60+
```
61+
62+
### First-time OAuth setup
63+
64+
1. Open your `config.txt`.
65+
2. Set `ytoauth = true`.
66+
3. Leave `ytoauthrefreshtoken = "YT_OAUTH_REFRESH_TOKEN_HERE"` for the first run.
67+
4. Make sure `ytpotoken` and `ytvisitordata` are still placeholders.
68+
5. Start the bot.
69+
6. Watch the bot logs.
70+
7. The bot will print a message telling you to go to `https://www.google.com/device` and enter a code.
71+
8. Open that URL in a browser.
72+
9. Sign in with the burner Google account.
73+
10. Enter the device code shown in the bot logs.
74+
11. Approve the connection.
75+
12. Wait for the bot logs to print the refresh token.
76+
77+
The log line will look similar to this:
78+
79+
```text
80+
OAUTH INTEGRATION: Token retrieved successfully. Store your refresh token as this can be reused. (your_refresh_token_here)
81+
```
82+
83+
### Persisting the refresh token
84+
85+
1. Stop the bot.
86+
2. Open `config.txt`.
87+
3. Replace the placeholder with the real refresh token:
88+
89+
```conf
90+
ytoauth = true
91+
ytoauthrefreshtoken = "paste_the_refresh_token_here"
92+
```
93+
94+
4. Save the file.
95+
5. Start the bot again.
96+
6. Check the logs for:
97+
98+
```text
99+
YouTube access token refreshed successfully
100+
```
101+
102+
At that point the token is persisted and future restarts should not require the device flow again unless Google invalidates the token.
103+
104+
### Verifying playback
105+
106+
1. Join a voice channel.
107+
2. Use the bot to play a normal YouTube video.
108+
3. Use the bot to play an age-restricted YouTube video.
109+
4. If the browser account can play the video but the bot cannot, check the bot logs for the current playability reason.
110+
111+
### Troubleshooting
112+
113+
1. `This video requires login`
114+
This usually means OAuth is not enabled, the refresh token is missing, the refresh token is invalid, or the account is not sufficiently verified.
115+
2. `Sign in to confirm your age`
116+
The burner account still does not pass YouTube age verification for that video.
117+
3. The video works in Discord for some links but not others
118+
The failing video may be private, region-blocked, removed, or age-gated beyond what the account currently allows.
119+
4. The device flow appears again after restart
120+
The refresh token was not copied into `config.txt` correctly or Google invalidated it.
121+
14122
A cross-platform Discord music bot with a clean interface, and that is easy to set up and run yourself!
15123

16124
[![Setup](http://i.imgur.com/VvXYp5j.png)](https://jmusicbot.com/setup)

0 commit comments

Comments
 (0)