首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Spotify API是否需要高级帐户?

Spotify API是否需要高级帐户?
EN

Stack Overflow用户
提问于 2021-03-01 01:23:51
回答 1查看 178关注 0票数 0

我正在试着做一个Spotify的音量控制,但我似乎想不通了。有什么想法吗?我已经被困在这个问题上有一段时间了,上面写着Player command failed: Premium required, reason: PREMIUM_REQUIRED。任何帮助都将不胜感激

代码语言:javascript
运行
复制
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()
EN

回答 1

Stack Overflow用户

发布于 2021-03-01 01:27:26

是的,该API调用需要Premium帐户。根据the docs

如果发出请求的用户是非高级用户,则将返回403禁止响应代码。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66411861

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档