Documentation
¶
Overview ¶
Package weibo 新浪微博 SDK
Example (LoginWithCrackFunc) ¶
注册验证码破解函数示例
package main
import (
"fmt"
"log"
"os"
"github.com/axiaoxin-com/chaojiying"
"github.com/axiaoxin-com/weibo"
)
func main() {
// 登录遇到验证码时
// 如果有注册你自己的破解函数则会尝试使用你注册的函数进行验证码破解
// 破解失败则采用默认的人工手动处理的方式手工输入保存在临时目录中的weibo_pin.png中的验证码
// 从环境变量获取必须的账号信息
appkey := os.Getenv("weibo_app_key")
appsecret := os.Getenv("weibo_app_secret")
username := os.Getenv("weibo_username")
passwd := os.Getenv("weibo_passwd")
redirecturi := os.Getenv("weibo_redirect_uri")
securitydomain := os.Getenv("weibo_security_domain")
// 初始化客户端
weibo := weibo.New(appkey, appsecret, username, passwd, redirecturi)
// 使用超级鹰破解验证码
// 初始化超级鹰客户端
chaojiyingUser := os.Getenv("chaojiying_user")
chaojiyingPass := os.Getenv("chaojiying_pass")
chaojiyingAccount := chaojiying.Account{User: chaojiyingUser, Pass: chaojiyingPass}
cracker, err := chaojiying.New([]chaojiying.Account{chaojiyingAccount})
if err != nil {
log.Println(err)
}
// 将破解函数注册到微博客户端
// 破解函数的声明为 func(io.Reader) (string, error),只要符合此签名的函数就可以注册
// RegisterCrackPinFunc 可以传入多个破解函数,会逐个尝试
// 这里的Cr4ck即为chaojiying中的破解函数
weibo.RegisterCrackPinFunc(cracker.Cr4ck)
fmt.Println("验证码破解方法注册成功")
// 登录微博 遇到验证码将自动识别
if err := weibo.PCLogin(); err != nil {
log.Fatal(err)
}
// 获取授权码
code, err := weibo.Authorize()
if err != nil {
log.Fatal(err)
}
// 获取access token
token, err := weibo.AccessToken(code)
if err != nil {
log.Fatal(err)
}
// 发送微博,必须带有安全域名链接
status := fmt.Sprintf("文本内容 http://%s", securitydomain)
resp, err := weibo.StatusesShare(token.AccessToken, status, nil)
if err != nil {
log.Println(err)
}
log.Println("微博发送成功 详情点击 http://weibo.com/" + resp.User.ProfileURL)
}
Output:
Example (SendPicWeibo) ¶
发送带图片的微博示例
package main
import (
"fmt"
"log"
"os"
"github.com/axiaoxin-com/weibo"
)
func main() {
// 从环境变量获取必须的账号信息
appkey := os.Getenv("weibo_app_key")
appsecret := os.Getenv("weibo_app_secret")
username := os.Getenv("weibo_username")
passwd := os.Getenv("weibo_passwd")
redirecturi := os.Getenv("weibo_redirect_uri")
securitydomain := os.Getenv("weibo_security_domain")
// 初始化客户端
weibo := weibo.New(appkey, appsecret, username, passwd, redirecturi)
// 登录微博
if err := weibo.PCLogin(); err != nil {
log.Fatal(err)
}
// 获取授权码
code, err := weibo.Authorize()
if err != nil {
log.Fatal(err)
}
// 获取access token
token, err := weibo.AccessToken(code)
if err != nil {
log.Fatal(err)
}
// 发送微博,必须带有安全域名链接
status := fmt.Sprintf("文字带图片示例 http://%s", securitydomain)
// 加载要发送的图片,加载方式只要是返回io.Reader都可以
pic, err := os.Open("./example/pic.jpg")
if err != nil {
log.Fatal(err)
}
defer pic.Close()
resp, err := weibo.StatusesShare(token.AccessToken, status, pic)
if err != nil {
log.Println(err)
}
log.Println("微博发送成功 详情点击 http://weibo.com/" + resp.User.ProfileURL)
}
Output:
Example (SendTextWeibo) ¶
发送存文本内容微博示例
package main
import (
"fmt"
"log"
"os"
"github.com/axiaoxin-com/weibo"
)
func main() {
// 从环境变量获取必须的账号信息
appkey := os.Getenv("weibo_app_key")
appsecret := os.Getenv("weibo_app_secret")
username := os.Getenv("weibo_username")
passwd := os.Getenv("weibo_passwd")
redirecturi := os.Getenv("weibo_redirect_uri")
securitydomain := os.Getenv("weibo_security_domain")
// 初始化客户端
weibo := weibo.New(appkey, appsecret, username, passwd, redirecturi)
// 登录微博
if err := weibo.PCLogin(); err != nil {
log.Fatal(err)
}
// 获取授权码
code, err := weibo.Authorize()
if err != nil {
log.Fatal(err)
}
// 获取access token
token, err := weibo.AccessToken(code)
if err != nil {
log.Fatal(err)
}
// 发送微博,必须带有安全域名链接
status := fmt.Sprintf("文本内容 http://%s", securitydomain)
resp, err := weibo.StatusesShare(token.AccessToken, status, nil)
if err != nil {
log.Println(err)
}
log.Println("微博发送成功 详情点击 http://weibo.com/" + resp.User.ProfileURL)
}
Output:
Index ¶
- Variables
- func RandInt(min int, max int) int
- func RandUA() string
- func RealIP() string
- func TerminalOpen(filePath string) error
- type CommentsByMeResp
- type CommentsCreateResp
- type CommentsDestroyBatchResp
- type CommentsReplyResp
- type CommentsShowBatchResp
- type CommentsShowResp
- type CrackPinFunc
- type EmotionsResp
- type ErrorResp
- type MobileLoginResp
- type StatusesCountResp
- type StatusesHomeTimelineResp
- type StatusesMentionsResp
- type StatusesRepostTimelineResp
- type StatusesShareResp
- type StatusesShowResp
- type StatusesUserTimelineResp
- type SummaryResp
- type TokenInfoResp
- type TokenResp
- type UsersDomainShowResp
- type UsersShowResp
- type Weibo
- func (w *Weibo) AccessToken(code string) (*TokenResp, error)
- func (w *Weibo) Authorize() (string, error)
- func (w *Weibo) CommentsByMe(token string, sinceID, maxID int64, count, page, filterBySource int) (*CommentsByMeResp, error)
- func (w *Weibo) CommentsCreate(token string, comment string, id int64, commentOri int) (*CommentsCreateResp, error)
- func (w *Weibo) CommentsDestroyBatch(token string, cids ...int64) (*CommentsDestroyBatchResp, error)
- func (w *Weibo) CommentsReply(token string, cid, id int64, comment string, withoutMention, commentOri int) (*CommentsReplyResp, error)
- func (w *Weibo) CommentsShow(token string, id, sinceID, maxID int64, count, page, filterByAuthor int) (*CommentsShowResp, error)
- func (w *Weibo) CommentsShowBatch(token string, cids ...int64) (*CommentsShowBatchResp, error)
- func (w *Weibo) CommentsTimeline(token string, sinceID, maxID int64, count, page, trimUser int) (*CommentsByMeResp, error)
- func (w *Weibo) CommentsToMe(token string, sinceID, maxID int64, ...) (*CommentsByMeResp, error)
- func (w *Weibo) Emotions(token, emotionType, language string) (*EmotionsResp, error)
- func (w *Weibo) MobileLogin() error
- func (w *Weibo) PCLogin() error
- func (w *Weibo) RegisterCrackPinFunc(f ...CrackPinFunc)
- func (w *Weibo) StatusesCount(token string, ids ...int64) (*StatusesCountResp, error)
- func (w *Weibo) StatusesGo(token string, uid, id int64) (string, error)
- func (w *Weibo) StatusesHomeTimeline(token string, sinceID, maxID int64, ...) (*StatusesHomeTimelineResp, error)
- func (w *Weibo) StatusesMentions(token string, sinceID, maxID int64, ...) (*StatusesMentionsResp, error)
- func (w *Weibo) StatusesRepostTimeline(token string, id, sinceID, maxID int64, count, page, filterByAuthor int) (*StatusesRepostTimelineResp, error)
- func (w *Weibo) StatusesShare(token, status string, pic io.Reader) (*StatusesShareResp, error)
- func (w *Weibo) StatusesShow(token string, id int64) (*StatusesShowResp, error)
- func (w *Weibo) StatusesUserTimeline(token string, uid int64, screenName string, sinceID, maxID int64, ...) (*StatusesUserTimelineResp, error)
- func (w *Weibo) Summary(param string) ([]SummaryResp, error)
- func (w *Weibo) SummaryFriendsSearch() ([]SummaryResp, error)
- func (w *Weibo) SummaryRealtimeHot() ([]SummaryResp, error)
- func (w *Weibo) SummarySocialEvent() ([]SummaryResp, error)
- func (w *Weibo) TokenInfo(token string) (*TokenInfoResp, error)
- func (w *Weibo) UsersDomainShow(token, domain string) (*UsersDomainShowResp, error)
- func (w *Weibo) UsersShow(token string, uid int64, screenName string) (*UsersShowResp, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var UserAgents []string = []string{
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36",
}
UserAgents 模拟登录时随机选择其中的 User-Agent 设置请求头
Functions ¶
Types ¶
type CommentsByMeResp ¶ added in v1.0.4
type CommentsByMeResp struct {
ErrorResp
Comments []struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Mid string `json:"mid"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
Status struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"status"`
} `json:"comments"`
PreviousCursor int `json:"previous_cursor"`
NextCursor int `json:"next_cursor"`
TotalNumber int `json:"total_number"`
}
CommentsByMeResp CommentsByMe 接口返回结果
type CommentsCreateResp ¶ added in v1.0.4
type CommentsCreateResp struct {
ErrorResp
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Mid string `json:"mid"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
Status struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"status"`
}
CommentsCreateResp CommentsCreate 接口返回结构
type CommentsDestroyBatchResp ¶ added in v1.0.4
type CommentsDestroyBatchResp []struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Mid string `json:"mid"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
Status struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"status"`
}
CommentsDestroyBatchResp CommentsDestroyBatch 接口返回结构
type CommentsReplyResp ¶ added in v1.0.4
type CommentsReplyResp struct {
ErrorResp
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Mid string `json:"mid"`
ReplyComment struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Mid string `json:"mid"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"reply_comment"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
Status struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"status"`
}
CommentsReplyResp CommentsReply 接口返回结果
type CommentsShowBatchResp ¶ added in v1.0.4
type CommentsShowBatchResp []struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Mid string `json:"mid"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
Status struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"status"`
}
CommentsShowBatchResp CommentsShowBatch 接口返回结构
type CommentsShowResp ¶ added in v1.0.4
type CommentsShowResp struct {
ErrorResp
Comments []struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Mid string `json:"mid"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
Status struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"status"`
} `json:"comments"`
PreviousCursor int `json:"previous_cursor"`
NextCursor int `json:"next_cursor"`
TotalNumber int `json:"total_number"`
}
CommentsShowResp CommentsShow 接口返回结构
type CrackPinFunc ¶
CrackPinFunc 验证码破解方法类型声明 验证码图片以 io.Reader 类型传入,返回破解结果字符串
type EmotionsResp ¶ added in v1.0.2
type EmotionsResp []struct {
Category string `json:"category"`
Common bool `json:"common"`
Hot bool `json:"hot"`
Icon string `json:"icon"`
Phrase string `json:"phrase"`
Picid interface{} `json:"picid"`
Type string `json:"type"`
URL string `json:"url"`
Value string `json:"value"`
}
EmotionsResp Emotions 接口返回结果
type ErrorResp ¶ added in v1.0.4
type ErrorResp struct {
Error string `json:"error"`
ErrorCode int `json:"error_code"`
Request string `json:"request"`
}
ErrorResp 错误返回
type MobileLoginResp ¶
type MobileLoginResp struct {
Retcode int `json:"retcode"`
Msg string `json:"msg"`
Data map[string]interface{} `json:"data"`
}
MobileLoginResp 移动端登录的返回结果
type StatusesCountResp ¶ added in v1.0.4
type StatusesCountResp []struct {
ID int64 `json:"id"`
Idstr string `json:"idstr"`
Comments int `json:"comments"`
Reposts int `json:"reposts"`
Attitudes int `json:"attitudes"`
NumberDisplayStrategy struct {
ApplyScenarioFlag int `json:"apply_scenario_flag"`
DisplayTextMinNumber int `json:"display_text_min_number"`
DisplayText string `json:"display_text"`
} `json:"number_display_strategy"`
}
StatusesCountResp StatusesCount 接口返回结构
type StatusesHomeTimelineResp ¶ added in v1.0.4
type StatusesHomeTimelineResp struct {
ErrorResp
Statuses []struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"statuses"`
Ad []struct {
ID int64 `json:"id"`
Mark string `json:"mark"`
} `json:"ad"`
PreviousCursor int `json:"previous_cursor"`
NextCursor int64 `json:"next_cursor"`
TotalNumber int `json:"total_number"`
}
StatusesHomeTimelineResp StatusesHomeTimeline 接口返回结构
type StatusesMentionsResp ¶ added in v1.0.4
type StatusesMentionsResp struct {
ErrorResp
Statuses []struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"statuses"`
PreviousCursor int `json:"previous_cursor"`
NextCursor int64 `json:"next_cursor"`
TotalNumber int `json:"total_number"`
}
StatusesMentionsResp StatusesMentions 接口返回结构
type StatusesRepostTimelineResp ¶ added in v1.0.4
type StatusesRepostTimelineResp struct {
ErrorResp
Reposts []struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
RetweetedStatus struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
Annotations []interface{} `json:"annotations"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"retweeted_status"`
} `json:"reposts"`
PreviousCursor int `json:"previous_cursor"`
NextCursor int `json:"next_cursor"`
TotalNumber int `json:"total_number"`
}
StatusesRepostTimelineResp StatusesRepostTimeline 接口返回结构
type StatusesShareResp ¶
type StatusesShareResp struct {
Type int `json:"type"`
ListID int `json:"list_id"`
} `json:"visible"`
ID int64 `json:"id"`
Idstr string `json:"idstr"`
Class int `json:"class"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
ProfileURL string `json:"profile_url"`
Domain string `json:"domain"`
Weihao string `json:"weihao"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
PagefriendsCount int `json:"pagefriends_count"`
StatusesCount int `json:"statuses_count"`
VideoStatusCount int `json:"video_status_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
VerifiedType int `json:"verified_type"`
Remark string `json:"remark"`
Insecurity struct {
SexualContent bool `json:"sexual_content"`
} `json:"insecurity"`
Ptype int `json:"ptype"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
AvatarHd string `json:"avatar_hd"`
VerifiedReason string `json:"verified_reason"`
VerifiedTrade string `json:"verified_trade"`
VerifiedReasonURL string `json:"verified_reason_url"`
VerifiedSource string `json:"verified_source"`
VerifiedSourceURL string `json:"verified_source_url"`
FollowMe bool `json:"follow_me"`
Like bool `json:"like"`
LikeMe bool `json:"like_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
Lang string `json:"lang"`
Star int `json:"star"`
Mbtype int `json:"mbtype"`
Mbrank int `json:"mbrank"`
BlockWord int `json:"block_word"`
BlockApp int `json:"block_app"`
CreditScore int `json:"credit_score"`
UserAbility int `json:"user_ability"`
Urank int `json:"urank"`
StoryReadState int `json:"story_read_state"`
VclubMember int `json:"vclub_member"`
IsTeenager int `json:"is_teenager"`
IsGuardian int `json:"is_guardian"`
IsTeenagerList int `json:"is_teenager_list"`
SpecialFollow bool `json:"special_follow"`
TabManage string `json:"tab_manage"`
} `json:"user"`
CommentManageButton int `json:"comment_manage_button"`
CommentPermissionType int `json:"comment_permission_type"`
ApprovalCommentType int `json:"approval_comment_type"`
} `json:"comment_manage_info"`
}
StatusesShareResp 微博成功发送后的返回结构
type StatusesShowResp ¶ added in v1.0.4
type StatusesShowResp struct {
ErrorResp
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
}
StatusesShowResp StatusesShow 接口的返回结构
type StatusesUserTimelineResp ¶ added in v1.0.4
type StatusesUserTimelineResp struct {
ErrorResp
Statuses []struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
Annotations []interface{} `json:"annotations"`
User struct {
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
Remark string `json:"remark"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
} `json:"user"`
} `json:"statuses"`
PreviousCursor int `json:"previous_cursor"`
NextCursor int64 `json:"next_cursor"`
TotalNumber int `json:"total_number"`
}
StatusesUserTimelineResp StatusesUserTimeline 接口返回结构
type SummaryResp ¶ added in v1.0.4
SummaryResp Summary 返回结构
func Summary ¶ added in v1.0.4
func Summary(param string) ([]SummaryResp, error)
Summary 微博搜索 pkg 级别的搜索,未登录,无法获取好友搜列表,热搜榜和要闻榜正常
type TokenInfoResp ¶
type TokenInfoResp struct {
ErrorResp
UID string `json:"uid"`
Appkey string `json:"appkey"`
Scope string `json:"scope"`
CreateAt string `json:"create_at"`
ExpireIn string `json:"expire_in"`
}
TokenInfoResp 查询 token 信息接口的返回结果
type TokenResp ¶
type TokenResp struct {
ErrorResp
AccessToken string `json:"access_token"` // access token
ExpiresIn int64 `json:"expires_in"` // ExpiresIn 秒之后 token 过期
UID string `json:"uid"`
IsRealName string `json:"isRealName"`
}
TokenResp 获取 access token 接口的返回结果
type UsersDomainShowResp ¶ added in v1.0.4
type UsersDomainShowResp struct {
ErrorResp
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
Status struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
Annotations []interface{} `json:"annotations"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
} `json:"status"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
}
UsersDomainShowResp UsersDomainShow 接口返回结构
type UsersShowResp ¶ added in v1.0.4
type UsersShowResp struct {
ErrorResp
ID int `json:"id"`
ScreenName string `json:"screen_name"`
Name string `json:"name"`
Province string `json:"province"`
City string `json:"city"`
Location string `json:"location"`
Description string `json:"description"`
URL string `json:"url"`
ProfileImageURL string `json:"profile_image_url"`
Domain string `json:"domain"`
Gender string `json:"gender"`
FollowersCount int `json:"followers_count"`
FriendsCount int `json:"friends_count"`
StatusesCount int `json:"statuses_count"`
FavouritesCount int `json:"favourites_count"`
CreatedAt string `json:"created_at"`
Following bool `json:"following"`
AllowAllActMsg bool `json:"allow_all_act_msg"`
GeoEnabled bool `json:"geo_enabled"`
Verified bool `json:"verified"`
Status struct {
CreatedAt string `json:"created_at"`
ID int64 `json:"id"`
Text string `json:"text"`
Source string `json:"source"`
Favorited bool `json:"favorited"`
Truncated bool `json:"truncated"`
InReplyToStatusID string `json:"in_reply_to_status_id"`
InReplyToUserID string `json:"in_reply_to_user_id"`
InReplyToScreenName string `json:"in_reply_to_screen_name"`
Geo interface{} `json:"geo"`
Mid string `json:"mid"`
Annotations []interface{} `json:"annotations"`
RepostsCount int `json:"reposts_count"`
CommentsCount int `json:"comments_count"`
} `json:"status"`
AllowAllComment bool `json:"allow_all_comment"`
AvatarLarge string `json:"avatar_large"`
VerifiedReason string `json:"verified_reason"`
FollowMe bool `json:"follow_me"`
OnlineStatus int `json:"online_status"`
BiFollowersCount int `json:"bi_followers_count"`
}
UsersShowResp UsersShow 接口返回结构
type Weibo ¶
type Weibo struct {
// contains filtered or unexported fields
}
Weibo 实例,在其上实现各类接口
func New ¶
New 创建Weibo实例
appkey 微博开放平台应用的 appkey
appsecret 微博开放平台应用的 appsecret
username 需要发微博的微博登录账号,用于模拟登录直接获取授权码
password 需要发微博的微博登录密码,用于模拟登录直接获取授权码
redirecturi 微博开发平台应用的回调 URL
func (*Weibo) AccessToken ¶
AccessToken 传入授权码请求 access_token 接口,返回 TokenResp 对象
func (*Weibo) CommentsByMe ¶ added in v1.0.4
func (w *Weibo) CommentsByMe(token string, sinceID, maxID int64, count, page, filterBySource int) (*CommentsByMeResp, error)
CommentsByMe 获取当前登录用户所发出的评论列表 sinceID 返回ID比since_id大的评论(即比since_id时间晚的评论) maxID 返回ID小于或等于max_id的评论 count 单页返回的记录条数 page 返回结果的页码 filterBySource 来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论
func (*Weibo) CommentsCreate ¶ added in v1.0.4
func (w *Weibo) CommentsCreate(token string, comment string, id int64, commentOri int) (*CommentsCreateResp, error)
CommentsCreate 对一条微博进行评论 comment 评论内容,不超过140个汉字。 id 需要评论的微博ID。 commentOri 当评论转发微博时,是否评论给原微博,0:否、1:是。
func (*Weibo) CommentsDestroyBatch ¶ added in v1.0.4
func (w *Weibo) CommentsDestroyBatch(token string, cids ...int64) (*CommentsDestroyBatchResp, error)
CommentsDestroyBatch 根据评论 ID 批量删除评论 cids 需要删除的评论 ID
func (*Weibo) CommentsReply ¶ added in v1.0.4
func (w *Weibo) CommentsReply(token string, cid, id int64, comment string, withoutMention, commentOri int) (*CommentsReplyResp, error)
CommentsReply 回复一条评论 cid 需要回复的评论 ID 。 id 需要评论的微博 ID 。 comment 回复评论内容,内容不超过 140 个汉字。 withoutMention 回复中是否自动加入“回复@用户名”, 0 :是、 1 :否。 commentOri 当评论转发微博时,是否评论给原微博, 0 :否、 1 :是。
func (*Weibo) CommentsShow ¶ added in v1.0.4
func (w *Weibo) CommentsShow(token string, id, sinceID, maxID int64, count, page, filterByAuthor int) (*CommentsShowResp, error)
CommentsShow 根据微博ID返回某条微博的评论列表 id 需要查询的微博ID。 sinceID 返回ID比since_id大的评论(即比since_id时间晚的评论) maxID 返回ID小于或等于max_id的评论 count 单页返回的记录条数 page 返回结果的页码。 filterByAuthor 作者筛选类型,0:全部、1:我关注的人、2:陌生人
func (*Weibo) CommentsShowBatch ¶ added in v1.0.4
func (w *Weibo) CommentsShowBatch(token string, cids ...int64) (*CommentsShowBatchResp, error)
CommentsShowBatch 根据评论 ID 批量返回评论信息 cids 需要查询的批量评论 ID
func (*Weibo) CommentsTimeline ¶ added in v1.0.4
func (w *Weibo) CommentsTimeline(token string, sinceID, maxID int64, count, page, trimUser int) (*CommentsByMeResp, error)
CommentsTimeline 获取当前登录用户的最新评论包括接收到的与发出的 sinceID 返回ID比since_id大的评论(即比since_id时间晚的评论) maxID 返回ID小于或等于max_id的评论 count 单页返回的记录条数 page 返回结果的页码 trimUser 返回值中user字段开关,0:返回完整user字段、1:user字段仅返回user_id
func (*Weibo) CommentsToMe ¶ added in v1.0.4
func (w *Weibo) CommentsToMe(token string, sinceID, maxID int64, count, page, filterByAuthor, filterBySource int) (*CommentsByMeResp, error)
CommentsToMe 获取当前登录用户所接收到的评论列表 sinceID 返回ID比since_id大的评论(即比since_id时间晚的评论) maxID 返回ID小于或等于max_id的评论 count 单页返回的记录条数 page 返回结果的页码 filterByAuthor 作者筛选类型,0:全部、1:我关注的人、2:陌生人。 filterBySource 来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论
func (*Weibo) Emotions ¶ added in v1.0.2
func (w *Weibo) Emotions(token, emotionType, language string) (*EmotionsResp, error)
Emotions 获取微博官方表情的详细信息 emotionType 表情类别,face:普通表情、ani:魔法表情、cartoon:动漫表情,默认为face language 语言类别,cnname:简体、twname:繁体,默认为cnname
func (*Weibo) MobileLogin ¶
MobileLogin 模拟移动端登录微博 (该登录无法通过调用 Authorize 方法获取开放平台的 token)
func (*Weibo) RegisterCrackPinFunc ¶
func (w *Weibo) RegisterCrackPinFunc(f ...CrackPinFunc)
RegisterCrackPinFunc 注册验证码破解方法到 Weibo 实例 触发验证码时自动调用注册的方法进行破解后模拟登录
func (*Weibo) StatusesCount ¶ added in v1.0.4
func (w *Weibo) StatusesCount(token string, ids ...int64) (*StatusesCountResp, error)
StatusesCount 批量获取指定微博的转发数评论数 ids 需要获取数据的微博ID,最多不超过100个。
func (*Weibo) StatusesGo ¶ added in v1.0.4
StatusesGo 根据 ID 返回对应微博页面跳转 URL uid int64 需要跳转的用户 ID 。 id int64 需要跳转的微博 ID 。
func (*Weibo) StatusesHomeTimeline ¶ added in v1.0.4
func (w *Weibo) StatusesHomeTimeline(token string, sinceID, maxID int64, count, page, baseApp, feature, trimUser int) (*StatusesHomeTimelineResp, error)
StatusesHomeTimeline 获取当前登录用户及其所关注(授权)用户的最新微博 sinceID 返回ID比sinceID大的微博(即比since_id时间晚的微博) maxID 返回ID小于或等于max_id的微博0。 count 单页返回的记录条数,最大不超过100。 page 返回结果的页码。 baseApp 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用) feature 过滤类型ID,0:全部、1:原创、2:图片、3:视频、4:音乐0。 trim_user 返回值中user字段开关,0:返回完整user字段、1:user字段仅返回user_id。
func (*Weibo) StatusesMentions ¶ added in v1.0.4
func (w *Weibo) StatusesMentions(token string, sinceID, maxID int64, count, page, filterBySource, filterByAuthor, filterByType int) (*StatusesMentionsResp, error)
StatusesMentions 获取最新的提到登录用户的微博列表,即@我的微博 sinceID 返回ID比since_id大的评论(即比since_id时间晚的评论) maxID 返回ID小于或等于max_id的评论 count 单页返回的记录条数 page 返回结果的页码 filterBySource 来源筛选类型,0:全部、1:来自微博的评论、2:来自微群的评论 filterByAuthor 作者筛选类型,0:全部、1:我关注的人、2:陌生人 filterByType 原创筛选类型,0:全部微博、1:原创的微博
func (*Weibo) StatusesRepostTimeline ¶ added in v1.0.4
func (w *Weibo) StatusesRepostTimeline(token string, id, sinceID, maxID int64, count, page, filterByAuthor int) (*StatusesRepostTimelineResp, error)
StatusesRepostTimeline 获取指定微博的转发微博列表 id 微博ID sinceID 返回ID比sinceID大的微博(即比since_id时间晚的微博) maxID 返回ID小于或等于max_id的微博0。 count 单页返回的记录条数,最大不超过200。 page 返回结果的页码。 filterByAuthor 作者筛选类型,0:全部、1:我关注的人、2:陌生人
func (*Weibo) StatusesShare ¶
StatusesShare 第三方分享一条链接到微博
token 为获取到的access_token内容
status 为微博文字内容
pic 为附带的一张图片,传nil则只发文字
func (*Weibo) StatusesShow ¶ added in v1.0.4
func (w *Weibo) StatusesShow(token string, id int64) (*StatusesShowResp, error)
StatusesShow 根据微博ID获取单条微博内容
func (*Weibo) StatusesUserTimeline ¶ added in v1.0.4
func (w *Weibo) StatusesUserTimeline(token string, uid int64, screenName string, sinceID, maxID int64, count, page, baseApp, feature, trimUser int) (*StatusesUserTimelineResp, error)
StatusesUserTimeline 获取当前授权用户最新发表的微博列表 uid int64 需要查询的用户ID。 screenName string 需要查询的用户昵称。 sinceID int64 返回ID比since_id大的微博(即比since_id时间晚的微博)。 maxID int64 返回ID小于或等于max_id的微博。 count int 单页返回的记录条数,最大不超过100,超过100以100处理。 page int 返回结果的页码 baseApp int 是否只获取当前应用的数据。0为否(所有数据),1为是(仅当前应用)。 feature int 过滤类型ID,0:全部、1:原创、2:图片、3:视频、4:音乐。 trimUser int 返回值中user字段开关,0:返回完整user字段、1:user字段仅返回user_id。
func (*Weibo) Summary ¶ added in v1.0.4
func (w *Weibo) Summary(param string) ([]SummaryResp, error)
Summary 微博搜索 for client param:
cate=realtimehot 热搜榜 cate=socialevent 要闻榜 cate=total&key=friends 好友搜
func (*Weibo) SummaryFriendsSearch ¶ added in v1.0.4
func (w *Weibo) SummaryFriendsSearch() ([]SummaryResp, error)
SummaryFriendsSearch 微博好友搜
func (*Weibo) SummaryRealtimeHot ¶ added in v1.0.4
func (w *Weibo) SummaryRealtimeHot() ([]SummaryResp, error)
SummaryRealtimeHot 微博热搜榜
func (*Weibo) SummarySocialEvent ¶ added in v1.0.4
func (w *Weibo) SummarySocialEvent() ([]SummaryResp, error)
SummarySocialEvent 微博要闻榜
func (*Weibo) TokenInfo ¶
func (w *Weibo) TokenInfo(token string) (*TokenInfoResp, error)
TokenInfo 获取用户 access_token 的授权相关信息,包括授权时间,过期时间和 scope 权限
func (*Weibo) UsersDomainShow ¶ added in v1.0.4
func (w *Weibo) UsersDomainShow(token, domain string) (*UsersDomainShowResp, error)
UsersDomainShow 通过个性化域名获取用户资料以及用户最新的一条微博
Source Files
¶
- access_token.go
- authorize.go
- client.go
- comments_by_me.go
- comments_create.go
- comments_destroy_batch.go
- comments_reply.go
- comments_show.go
- comments_show_batch.go
- comments_timeline.go
- comments_to_me.go
- emotions.go
- get_token_info.go
- login.go
- statuses_count.go
- statuses_go.go
- statuses_home_timeline.go
- statuses_mentions.go
- statuses_repost_timeline.go
- statuses_share.go
- statuses_show.go
- statuses_user_timeline.go
- structs.go
- summary.go
- users_domain_show.go
- users_show.go
- utils.go