A Discord Bot coded in Python for playing music from a YouTube channel stream.
The bot uses a YouTube API Key making the bot able to fetch the latest stream from a channel.
Recomended: Python 3.5+
-
Edit the config.json file with the required parameters:
botToken
: Your Discord Bot TokenchannelID
: The ID of the voice channel the bot will joinyoutubeID
: The YouTube channel IDyoutubeApiKey
: The YouTube API Key so the bot can get the lastest stream from the YouTube channel -
Install the dependencies
pip install -r requirements.txt
-
Run the bot
python bot.py
-
Go to the Google Cloud Platform
-
Search
YouTube Data API v3
inAPIs & Services
->Library
and enable it -
Select
Credentials
, then clickCreate Credentials
and thenAPI key
, an API key will appear, that's what you need to paste on the config file.
- Open a YouTube channel URL
- Open DevTools, you can do this by right clicking the page and selecting "Inspect", pressing the key
F12
or pressingctrl + shift + i
, then click any part of the HTML code - Press
ctrl + f
and write:https://www.youtube.com/channel/
- Then the channel's ID will appear next to the link you have just searched. (You might have to press enter to go to the next result)
- Right click the element and select
Edit as HTML
to copy the ID