Need help with gobo?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

huichen
131 Stars 40 Forks Other 44 Commits 1 Opened issues

Description

新浪微博Go语言SDK

Services available

!
?

Need anything else?

Contributors list

# 22,320
Perl
Go
object-...
Tensorf...
39 commits

gobo

新浪微博Go语言SDK,支持所有微博API功能

安装/更新

go get -u github.com/huichen/gobo

使用

抓取@人民日报的最近10条微博:

package main

import ( "flag" "fmt" "github.com/huichen/gobo" )

var ( weibo = gobo.Weibo{} access_token = flag.String("access_token", "", "用户的访问令牌") )

func main() { // 解析命令行参数 flag.Parse()

// 调用API
var statuses gobo.Statuses
params := gobo.Params{"screen_name": "人民日报", "count": 10}
err := weibo.Call("statuses/user_timeline", "get", *access_token, params, &statuses)

// 处理返回结果
if err != nil {
    fmt.Println(err)
    return
}
for _, status := range statuses.Statuses {
    fmt.Println(status.Text)
}

}

用命令行参数-access_token传入访问令牌,令牌可以通过API测试工具或者gobo.Authenticator得到。

更多API调用的例子见 examples/weibo.go

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.