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
This commit is contained in:
+6
-2
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user