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 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)