This is a Discord bot that monitors specified YouTube channels and notifies a designated Discord channel whenever a new video is uploaded.
- Uses the YouTube Data API to track new video uploads.
- Allows users to pass YouTube channel handles instead of manually finding channel IDs.
- Sends a notification with the video link to a specified Discord channel.
- Runs continuously, checking for updates at regular intervals.
- Python 3.8+
- A Google Cloud API Key with YouTube Data API access.
- A Discord bot token (You have to create a discord app on the discord development portal to get a token)
- Required Python packages:
google-api-python-clientdiscord.pyasyncioargparse
- Clone this repository:
git clone https://github.com/sngr0x0/yt_notify_discoBot.git cd yt_notify_discoBot - Install dependencies:
pip install -r requirements.txt
- Set up the
config.jsonfile with the following keys:{ "youtube_token": "YOUR_YOUTUBE_API_KEY", "disco_token": "YOUR_DISCORD_BOT_TOKEN", "channel_id": "YOUR_DISCORD_CHANNEL_ID", "time_interval": 3600, "application_id": "YOUR_DISCORD_APPLICATION_ID" } - Run the bot with your desired YouTube channel handles:
python bot.py --handles fireship mrbeast premierleague beINSPORTS
- Check Interval: Modify the
TIME_INTERVALvalue inconfig.jsonto change the frequency of YouTube checks.
- The bot retrieves the latest uploads from the specified YouTube channels using their handles.
- It compares the latest video ID with the last known video.
- If a new video is found, the bot sends the YouTube video link to the configured Discord channel.
- The process repeats at the specified time interval.
- If a non-existent YouTube handle is provided, the bot will not acknowledge it. Future updates may handle this more gracefully.
Ahmed Senger
Created on: 01/02/2024
This project is open-source. Feel free to modify and contribute!