Skip to content

TheOneWhoBuilds1/Youtube-Music-RPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 

Repository files navigation

🎵 YouTube Music Discord Rich Presence

This script connects your YouTube Music listening activity to Discord, updating your Rich Presence to show what you're currently listening to. It uses the ytmusicapi for fetching song information and pypresence to communicate with Discord.

Discord Status Preview

forgot to mention you have to have Python 3.13.7 or newer installed.

btw to gen the auth keys you need to cd into your python install directory's scripts and run the ytmusicapi.exe file from powershell like this: .\ytmusic oauth

✨ Features

  • Automatic Updates: Automatically detects and displays the song you're playing.
  • Album Art: Shows the song's album art directly on your profile.
  • "Listen" Button: Adds a clickable button that links to the song on YouTube Music.
  • Secure Authentication: Uses the official YouTube Music API via OAuth 2.0, so you don't have to provide your password.

⚙️ Setup

Before you run the script, you need to set up two things: a Discord application and a Google Cloud project.


Step 1: Discord Application

  1. Go to the Discord Developer Portal and log in.
  2. Click "New Application" in the top right corner and give it a name (e.g., "YouTube Music RPC").
  3. On the "General Information" page, copy the Application ID. This is your Discord CLIENT_ID.
  4. Navigate to "Rich Presence" -> "Art Assets".
  5. Upload a YouTube Music logo or any other image and name the asset youtubemusic. This is what will appear as the icon next to the song information.

Step 2: Google Cloud Project (YouTube Music API)

  1. Go to the Google Cloud Console and create or select a project.
  2. In the "APIs & Services" library, search for and enable the "YouTube Data API v3".
  3. Go to "Credentials" in the sidebar. Click "CREATE CREDENTIALS" and select "OAuth client ID".
  4. If prompted, configure the OAuth consent screen. Select "TV and Limited Input" as the application type, and create it.
  5. After creation, a pop-up will show your Client ID and Client secret. Copy both of these.

Step 3: Run the Script

  1. Save the script as a Python file, for example, rpc.py.
  2. Edit the script and replace the placeholder values with the credentials you copied:
    @dataclass
    class Config:
        CLIENT_ID: str = 'YOUR_DISCORD_APPLICATION_ID'
        # ... other settings
        YOUTUBE_CLIENT_ID: str = 'YOUR_GOOGLE_CLIENT_ID'
        YOUTUBE_CLIENT_SECRET: str = 'YOUR_GOOGLE_CLIENT_SECRET'
  3. Install the required libraries using pip:
    pip install ytmusicapi pypresence
  4. Run the script from your terminal:
    python rpc.py

The first time you run it, a browser window will open for you to authorize the application to access your YouTube Music account. Follow the prompts to complete the process. Once done, the script will create an oauth.json file to store your credentials and your Discord Rich Presence will update automatically.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages