Program for overlaying NightBot's current song on your stream.
This works with NightBot and so works with Twitch, YouTube and Mixer. It also works with any streaming software which allows for Text to be read from a file and so works with OBS, XSplit, etc.
cd
into the directory where you want to put the program, then:
git clone https://github.com/pixelchai/NightBotNowPlaying.git
cd NightBotNowPlaying
python3 -m pip install -r requirements.txt
You need to provide this program with access to NightBot in order to use it. This is done as follows:
- Go to your NightBot control panel's "Applications" page: https://nightbot.tv/account/applications
- Click on "New App" (screenshot)
- In the "Add an Application" window that comes up, input "NightBotNowPlaying" in the "Name" field and
http://localhost:5771
in the "Redirect URIs" field. Make sure the URL is exactly as shown, there should be no trailing slash, and it should start withhttp
! - Click "Submit"
- Click the orange edit button (screenshot)
- An "Edit Application" window should come up, displaying your Client ID and Client Secret (screenshot). To show the Client Secret, press the "New Secret" button.
- Edit the provided "auth.json" and paste in these values. The file might look like something like this:
{
"client_id": "abcdef123456789abcdef123456789ab",
"client_secret": "ba987654321fedcba987654321fedcba"
}
Don't share this file or these values with anyone!
python3 nowplaying.py
If authorisation is required, the program will automatically open up a browser. Simply click "Allow". You won't need to do this very often (usually only once the first time you use this script, then once every month after that).
- Make sure the program is running - it should print "Authorized!" in the console if it was able to start successfully
- Create a Text source
- In the source's properties, check "Read from file"
- For the "Text file" field, browse to the folder where you installed the program, and select
np.txt
The program allows for configuration through the config.json
file.
The configurable options are detailed below:
Option | Default | Description |
---|---|---|
text | "{title}" | The text to be outputted - this value supports bracketed variable substitution |
path | "np.txt" | Where the output file should be. (NB: the containing directory must exist) |
update_delay | 1 | How many seconds to wait between checks for updates to the current song. Note: don't set this too low - you don't want to overload NightBot's servers! |
fancy_limit | false | Limits the number of updates such that the program updates less during the middle of the song but more at the endings and beginnings. Enable this if you are likely to not skip songs often |
The variables which may be used in the text string are detailed below:
Option | Example | Description |
---|---|---|
title | Alex Skrindo - Jumbo [NCS Release] | Title of the current song |
artist | NoCopyrightSounds | Artist (uploader) of the current song |
url | https://youtu.be/v4Za061pQac | Url of the current song |
duration | 191 | Total duration, in seconds, of the current song |
requester | test_user_1 | Username of the user who requested that song |
requester.display_name | test_user_1 | Display name of the user who requested that song |
Please ensure you have edited the provided auth.json
file as in the instructions above.
This error message may be shown on the NightBot website when clicking the "Allow" button in the steps above. If so, please ensure that the 'Redirect URI' field when adding an application to NightBot is exactly http://localhost:5771
, and with no trailing backslash.
You can update/check the 'Redirect URI' field by visiting https://nightbot.tv/account/applications and clicking the orange edit button (screenshot).
See discussion of this issue here: #3.