[Python] Is there a Premium Account necesary for the Spotify API?

Discussão em 'Python' iniciado por Stack, Junho 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to make a Spotify voice control for volume and I can't seem to figure it out. Any ideas? I have been stuck at this for a while and it says Player command failed: Premium required, reason: PREMIUM_REQUIRED. Any help would be appreciated

    import spotipy
    from spotipy.oauth2 import SpotifyOAuth
    import speech_recognition as sr
    import pyttsx3

    auth_manager = SpotifyOAuth(
    client_id="myclientid",
    client_secret="myclientsecret",
    redirect_uri="http://localhost:8888/callback",
    username="username",
    scope="user-modify-playback-state"
    )
    spotipy = spotipy.Spotify(auth_manager=auth_manager)

    engine = pyttsx3.init()

    def takeCommand():
    r = sr.Recognizer()
    with sr.Microphone() as source:
    print('Listening...')
    r.pause_threshold = 0.5
    r.energy_threshold = 494
    r.adjust_for_ambient_noise(source, duration=0.3)
    audio = r.listen(source)

    try:
    print('Recognizing..')
    query = r.recognize_google(audio, language='en-us')
    print(f'User said: {query}\n')

    except Exception as e:
    # print(e)

    print('Say that again please...')
    return 'None'
    return query

    def LowerVolume():
    spotipy.volume(15)

    while True:
    query = takeCommand().lower()
    if "lower volume" in query:
    LowerVolume()

    Continue reading...

Compartilhe esta Página