SoundCloud API“解析”返回403

时间:2016-05-11 21:30:57

标签: javascript api soundcloud

我正在使用SoundCloud API resolve方法(大部分时间都可以使用)...但有时会返回403.

这是我在JSFiddle上的简化测试 - > https://jsfiddle.net/stursby/fcvce4f7/

小提琴的来源(请在JSFiddle中运行并检查控制台日志)

// setup
const API_BASE = 'https://api.soundcloud.com'
const CLIENT_ID = 'xxxxxxxxxxxxxxxxxxxxxxxxx'

// https://developers.soundcloud.com/docs/api/reference#resolve
const resolve = (url) => {
  console.log(`resolving ${url} ...`)
  axios.get(`${API_BASE}/resolve`, {
      params: {
        url: url,
        client_id: CLIENT_ID
      }
    })
    .then((response) => {
      console.log(response.data)
    })
    .catch((error) => {
      console.log('Error:', error)
    })
}

// works
resolve('https://soundcloud.com/goodvibrationsradioshow/goodvibrations2')

// doesn't...
resolve('https://soundcloud.com/bingoplayers/hysteria-radio-056')

0 个答案:

没有答案