douliao1911 2014-08-08 23:01
浏览 72
已采纳

在GoLang中寻找Soundcloud API的入门资源

I've unsuccessfully tried to access the Soundcloud API with Go. For any language that isn't directly support by Soundcloud, their API is very convoluted. If anyone has any resources or code examples, I'd appreciate it if someone shared them with me.

My code is as follows:

func main() {
    v := url.Values{}
    v.Set("scope", "non-expiring")
    v.Set("client_id", auth.ClientID)
    v.Set("response_type", "code")
    v.Set("redirect_uri", auth.RedirectURI)

    c.AuthURL = AuthEndpoint + "?" + v.Encode()
    c.Values = v.Encode()

    res := c.Request("POST", url.Values{})
}



func (c *Client) Request(method string, params url.Values) []byte {
    params.Set("client_id", "*************")

    reqUrl := "https://api.soundcloud.com/oauth2/token"

    req, _ := http.NewRequest(method, reqUrl, strings.NewReader(c.Values))
    req.Header.Add("Accept", "application/json")
    resp, _ := c.client.Do(req)

    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)

    return body
}
  • 写回答

2条回答 默认 最新

  • dtip91401 2014-08-09 03:56
    关注

    You can have a look at yanatan16/golang-soundcloud, even though then authentication part isn't implemented yet (see issues)

    There is an oauth class though.
    Ad quite a few other calls to the API, for getting SoundCloud objects.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题