From 90ae7ec90ad7eba86057a3ef8b7f477e7ca01770 Mon Sep 17 00:00:00 2001 From: Frank Schwenk Date: Tue, 18 Nov 2025 15:40:00 +0100 Subject: [PATCH] Add brand account support for cuidas account - Add BRAND_ACCOUNT_ID configuration for brand account usage - Pass user parameter to YTMusic initialization - Works with browser authentication as per ytmusicapi docs - Display brand account info in initialization message --- create_playlist.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/create_playlist.py b/create_playlist.py index ed9b386..20c2b86 100644 --- a/create_playlist.py +++ b/create_playlist.py @@ -36,6 +36,8 @@ PLAYLIST_NAME = "Core Fest 2025" PLAYLIST_DESCRIPTION = "Festival playlist featuring top songs from Core Fest 2025 bands" SONGS_PER_BAND = 3 BROWSER_AUTH_FILE = "browser.json" +# Brand account ID (set to None to use default account) +BRAND_ACCOUNT_ID = "107494778873257953135" # cuidas brand account def main(): @@ -46,7 +48,8 @@ def main(): sys.exit(1) # Initialize YTMusic with browser authentication - print(f"Initializing YouTube Music API with {BROWSER_AUTH_FILE}...") + account_info = f" (brand account: {BRAND_ACCOUNT_ID})" if BRAND_ACCOUNT_ID else "" + print(f"Initializing YouTube Music API with {BROWSER_AUTH_FILE}{account_info}...") try: # Load browser.json as dict with open(BROWSER_AUTH_FILE, 'r') as f: @@ -87,7 +90,8 @@ def main(): auth_string = json.dumps(auth_dict) # Initialize with the properly formatted auth string - yt = YTMusic(auth=auth_string) + # Pass brand account ID if specified (works with browser auth too) + yt = YTMusic(auth=auth_string, user=BRAND_ACCOUNT_ID if BRAND_ACCOUNT_ID else None) except json.JSONDecodeError as e: print(f"Error parsing {BROWSER_AUTH_FILE}: {e}") print("Please check that your browser.json file is valid JSON.")