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)
}
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)
}
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)
}
Index ¶
- Constants
- Variables
- func GetSearchRegionCode(prov, city string) (int, int)
- func NormalizeTime(t string) (nt string)
- func RandInt(min int, max int) int
- func RandUA() string
- func RealIP() string
- func TerminalOpen(filePath string) error
- type CrackPinFunc
- type RespCommentsByMe
- type RespCommentsCreate
- type RespCommentsDestroyBatch
- type RespCommentsReply
- type RespCommentsShow
- type RespCommentsShowBatch
- type RespEmotions
- type RespError
- type RespMobileLogin
- type RespQRLogin
- type RespStatusesCount
- type RespStatusesHomeTimeline
- type RespStatusesMentions
- type RespStatusesPublicTimeline
- type RespStatusesRepostTimeline
- type RespStatusesShare
- type RespStatusesShow
- type RespStatusesUserTimeline
- type RespSummary
- type RespToken
- type RespTokenInfo
- type RespUsersDomainShow
- type RespUsersShow
- type SearchWeiboCondition
- func (c *SearchWeiboCondition) ContainAll() *SearchWeiboCondition
- func (c *SearchWeiboCondition) ContainLink() *SearchWeiboCondition
- func (c *SearchWeiboCondition) ContainMusic() *SearchWeiboCondition
- func (c *SearchWeiboCondition) ContainPic() *SearchWeiboCondition
- func (c *SearchWeiboCondition) ContainVideo() *SearchWeiboCondition
- func (c *SearchWeiboCondition) Region(prov, city string) *SearchWeiboCondition
- func (c *SearchWeiboCondition) TimeScope(begin, end string) *SearchWeiboCondition
- func (c *SearchWeiboCondition) TypeAll() *SearchWeiboCondition
- func (c *SearchWeiboCondition) TypeAtten() *SearchWeiboCondition
- func (c *SearchWeiboCondition) TypeCategory() *SearchWeiboCondition
- func (c *SearchWeiboCondition) TypeHot() *SearchWeiboCondition
- func (c *SearchWeiboCondition) TypeOri() *SearchWeiboCondition
- func (c *SearchWeiboCondition) TypeViewpoint() *SearchWeiboCondition
- func (c *SearchWeiboCondition) TypeVip() *SearchWeiboCondition
- type SearchWeiboResult
- type Status
- type User
- type Weibo
- func (w *Weibo) AccessToken(code string) (*RespToken, error)
- func (w *Weibo) Authorize() (string, error)
- func (w *Weibo) CommentsByMe(token string, sinceID, maxID int64, count, page, filterBySource int) (*RespCommentsByMe, error)
- func (w *Weibo) CommentsCreate(token string, comment string, id int64, commentOri int) (*RespCommentsCreate, error)
- func (w *Weibo) CommentsDestroyBatch(token string, cids ...int64) (*RespCommentsDestroyBatch, error)
- func (w *Weibo) CommentsReply(token string, cid, id int64, comment string, withoutMention, commentOri int) (*RespCommentsReply, error)
- func (w *Weibo) CommentsShow(token string, id, sinceID, maxID int64, count, page, filterByAuthor int) (*RespCommentsShow, error)
- func (w *Weibo) CommentsShowBatch(token string, cids ...int64) (*RespCommentsShowBatch, error)
- func (w *Weibo) CommentsTimeline(token string, sinceID, maxID int64, count, page, trimUser int) (*RespCommentsByMe, error)
- func (w *Weibo) CommentsToMe(token string, sinceID, maxID int64, ...) (*RespCommentsByMe, error)
- func (w *Weibo) Emotions(token, emotionType, language string) (*RespEmotions, error)
- func (w *Weibo) MobileLogin() error
- func (w *Weibo) PCLogin() error
- func (w *Weibo) QRLogin() error
- func (w *Weibo) RegisterCrackPinFunc(f ...CrackPinFunc)
- func (w *Weibo) SearchWeibo(keyword string, page int, condition *SearchWeiboCondition) ([]SearchWeiboResult, error)
- func (w *Weibo) StatusesCount(token string, ids ...int64) (*RespStatusesCount, error)
- func (w *Weibo) StatusesGo(token string, uid, id int64) (string, error)
- func (w *Weibo) StatusesHomeTimeline(token string, sinceID, maxID int64, ...) (*RespStatusesHomeTimeline, error)
- func (w *Weibo) StatusesMentions(token string, sinceID, maxID int64, ...) (*RespStatusesMentions, error)
- func (w *Weibo) StatusesPublicTimeline(token string, count, page, baseApp int) (*RespStatusesPublicTimeline, error)
- func (w *Weibo) StatusesRepostTimeline(token string, id, sinceID, maxID int64, count, page, filterByAuthor int) (*RespStatusesRepostTimeline, error)
- func (w *Weibo) StatusesShare(token, status string, pic io.Reader) (*RespStatusesShare, error)
- func (w *Weibo) StatusesShow(token string, id int64) (*RespStatusesShow, error)
- func (w *Weibo) StatusesUserTimeline(token string, uid int64, screenName string, sinceID, maxID int64, ...) (*RespStatusesUserTimeline, error)
- func (w *Weibo) Summary(param string) ([]RespSummary, error)
- func (w *Weibo) SummaryFriendsSearch() ([]RespSummary, error)
- func (w *Weibo) SummaryRealtimeHot() ([]RespSummary, error)
- func (w *Weibo) SummarySocialEvent() ([]RespSummary, error)
- func (w *Weibo) TokenInfo(token string) (*RespTokenInfo, error)
- func (w *Weibo) UsersDomainShow(token, domain string) (*RespUsersDomainShow, error)
- func (w *Weibo) UsersShow(token string, uid int64, screenName string) (*RespUsersShow, error)
Examples ¶
Constants ¶
const TimeLayout = "2006年01月02日 15:04"
TimeLayout 微博展示的时间格式
Variables ¶
var HTTPTimeout time.Duration = time.Second * 10
HTTPTimeout 请求超时时间 默认 10 秒
var SearchRegion = map[string]interface{}{ "安徽": map[string]interface{}{ "code": 34, "city": map[string]interface{}{ "合肥": 1, "芜湖": 2, "蚌埠": 3, "淮南": 4, "马鞍山": 5, "淮北": 6, "铜陵": 7, "安庆": 8, "黄山": 10, "滁州": 11, "阜阳": 12, "宿州": 13, "巢湖": 14, "六安": 15, "亳州": 16, "池州": 17, "宣城": 18, }, }, "北京": map[string]interface{}{ "code": 11, "city": map[string]interface{}{ "东城区": 1, "西城区": 2, "崇文区": 3, "宣武区": 4, "朝阳区": 5, "丰台区": 6, "石景山区": 7, "海淀区": 8, "门头沟区": 9, "房山区": 11, "通州区": 12, "顺义区": 13, "昌平区": 14, "大兴区": 15, "怀柔区": 16, "平谷区": 17, "密云县": 28, "延庆县": 29, }, }, "重庆": map[string]interface{}{ "code": 50, "city": map[string]interface{}{ "万州区": 1, "涪陵区": 2, "渝中区": 3, "大渡口区": 4, "江北区": 5, "沙坪坝区": 6, "九龙坡区": 7, "南岸区": 8, "北碚区": 9, "万盛区": 10, "双桥区": 11, "渝北区": 12, "巴南区": 13, "黔江区": 14, "长寿区": 15, "綦江县": 22, "潼南县": 23, "铜梁县": 24, "大足县": 25, "荣昌县": 26, "璧山县": 27, "梁平县": 28, "城口县": 29, "丰都县": 30, "垫江县": 31, "武隆县": 32, "忠县": 33, "开县": 34, "云阳县": 35, "奉节县": 36, "巫山县": 37, "巫溪县": 38, "石柱土家族自治县": 40, "秀山土家族苗族自治县": 41, "酉阳土家族苗族自治县": 42, "彭水苗族土家族自治县": 43, "江津区": 81, "合川市": 82, "永川区": 83, "南川市": 84, }, }, "福建": map[string]interface{}{ "code": 35, "city": map[string]interface{}{ "福州": 1, "厦门": 2, "莆田": 3, "三明": 4, "泉州": 5, "漳州": 6, "南平": 7, "龙岩": 8, "宁德": 9, }, }, "甘肃": map[string]interface{}{ "code": 62, "city": map[string]interface{}{ "兰州": 1, "嘉峪关": 2, "金昌": 3, "白银": 4, "天水": 5, "武威": 6, "张掖": 7, "平凉": 8, "酒泉": 9, "庆阳": 10, "定西": 24, "陇南": 26, "临夏": 29, "甘南": 30, }, }, "广东": map[string]interface{}{ "code": 44, "city": map[string]interface{}{ "广州": 1, "韶关": 2, "深圳": 3, "珠海": 4, "汕头": 5, "佛山": 6, "江门": 7, "湛江": 8, "茂名": 9, "肇庆": 12, "惠州": 13, "梅州": 14, "汕尾": 15, "河源": 16, "阳江": 17, "清远": 18, "东莞": 19, "中山": 20, "潮州": 51, "揭阳": 52, "云浮": 53, }, }, "广西": map[string]interface{}{ "code": 45, "city": map[string]interface{}{ "南宁": 1, "柳州": 2, "桂林": 3, "梧州": 4, "北海": 5, "防城港": 6, "钦州": 7, "贵港": 8, "玉林": 9, "百色": 10, "贺州": 11, "河池": 12, "来宾": 13, "崇左": 14, }, }, "贵州": map[string]interface{}{ "code": 52, "city": map[string]interface{}{ "贵阳": 1, "六盘水": 2, "遵义": 3, "安顺": 4, "铜仁": 22, "黔西南": 23, "毕节": 24, "黔东南": 26, "黔南": 27, }, }, "海南": map[string]interface{}{ "code": 46, "city": map[string]interface{}{ "海口": 1, "三亚": 2, "其他": 90, }, }, "河北": map[string]interface{}{ "code": 13, "city": map[string]interface{}{ "石家庄": 1, "唐山": 2, "秦皇岛": 3, "邯郸": 4, "邢台": 5, "保定": 6, "张家口": 7, "承德": 8, "沧州": 9, "廊坊": 10, "衡水": 11, }, }, "黑龙江": map[string]interface{}{ "code": 23, "city": map[string]interface{}{ "哈尔滨": 1, "齐齐哈尔": 2, "鸡西": 3, "鹤岗": 4, "双鸭山": 5, "大庆": 6, "伊春": 7, "佳木斯": 8, "七台河": 9, "牡丹江": 10, "黑河": 11, "绥化": 12, "大兴安岭": 27, }, }, "河南": map[string]interface{}{ "code": 41, "city": map[string]interface{}{ "郑州": 1, "开封": 2, "洛阳": 3, "平顶山": 4, "安阳": 5, "鹤壁": 6, "新乡": 7, "焦作": 8, "濮阳": 9, "许昌": 10, "漯河": 11, "三门峡": 12, "南阳": 13, "商丘": 14, "信阳": 15, "周口": 16, "驻马店": 17, }, }, "湖北": map[string]interface{}{ "code": 42, "city": map[string]interface{}{ "武汉": 1, "黄石": 2, "十堰": 3, "宜昌": 5, "襄阳": 6, "鄂州": 7, "荆门": 8, "孝感": 9, "荆州": 10, "黄冈": 11, "咸宁": 12, "随州": 13, "恩施土家族苗族自治州": 28, }, }, "湖南": map[string]interface{}{ "code": 43, "city": map[string]interface{}{ "长沙": 1, "株洲": 2, "湘潭": 3, "衡阳": 4, "邵阳": 5, "岳阳": 6, "常德": 7, "张家界": 8, "益阳": 9, "郴州": 10, "永州": 11, "怀化": 12, "娄底": 13, "湘西土家族苗族自治州": 31, }, }, "内蒙古": map[string]interface{}{ "code": 15, "city": map[string]interface{}{ "呼和浩特": 1, "包头": 2, "乌海": 3, "赤峰": 4, "通辽": 5, "鄂尔多斯": 6, "呼伦贝尔": 7, "兴安盟": 22, "锡林郭勒盟": 25, "乌兰察布盟": 26, "巴彦淖尔盟": 28, "阿拉善盟": 29, }, }, "江苏": map[string]interface{}{ "code": 32, "city": map[string]interface{}{ "南京": 1, "无锡": 2, "徐州": 3, "常州": 4, "苏州": 5, "南通": 6, "连云港": 7, "淮安": 8, "盐城": 9, "扬州": 10, "镇江": 11, "泰州": 12, "宿迁": 13, }, }, "江西": map[string]interface{}{ "code": 36, "city": map[string]interface{}{ "南昌": 1, "景德镇": 2, "萍乡": 3, "九江": 4, "新余": 5, "鹰潭": 6, "赣州": 7, "吉安": 8, "宜春": 9, "抚州": 10, "上饶": 11, }, }, "吉林": map[string]interface{}{ "code": 22, "city": map[string]interface{}{ "长春": 1, "吉林": 2, "四平": 3, "辽源": 4, "通化": 5, "白山": 6, "松原": 7, "白城": 8, "延边朝鲜族自治州": 24, }, }, "辽宁": map[string]interface{}{ "code": 21, "city": map[string]interface{}{ "沈阳": 1, "大连": 2, "鞍山": 3, "抚顺": 4, "本溪": 5, "丹东": 6, "锦州": 7, "营口": 8, "阜新": 9, "辽阳": 10, "盘锦": 11, "铁岭": 12, "朝阳": 13, "葫芦岛": 14, }, }, "宁夏": map[string]interface{}{ "code": 64, "city": map[string]interface{}{ "银川": 1, "石嘴山": 2, "吴忠": 3, "固原": 4, "中卫": 5, }, }, "青海": map[string]interface{}{ "code": 63, "city": map[string]interface{}{ "西宁": 1, "海东": 21, "海北": 22, "黄南": 23, "海南": 25, "果洛": 26, "玉树": 27, "海西": 28, }, }, "山西": map[string]interface{}{ "code": 14, "city": map[string]interface{}{ "太原": 1, "大同": 2, "阳泉": 3, "长治": 4, "晋城": 5, "朔州": 6, "晋中": 7, "运城": 8, "忻州": 9, "临汾": 10, "吕梁": 23, }, }, "山东": map[string]interface{}{ "code": 37, "city": map[string]interface{}{ "济南": 1, "青岛": 2, "淄博": 3, "枣庄": 4, "东营": 5, "烟台": 6, "潍坊": 7, "济宁": 8, "泰安": 9, "威海": 10, "日照": 11, "莱芜": 12, "临沂": 13, "德州": 14, "聊城": 15, "滨州": 16, "菏泽": 17, }, }, "上海": map[string]interface{}{ "code": 31, "city": map[string]interface{}{ "黄浦区": 1, "卢湾区": 3, "徐汇区": 4, "长宁区": 5, "静安区": 6, "普陀区": 7, "闸北区": 8, "虹口区": 9, "杨浦区": 10, "闵行区": 12, "宝山区": 13, "嘉定区": 14, "浦东新区": 15, "金山区": 16, "松江区": 17, "青浦区": 18, "南汇区": 19, "奉贤区": 20, "崇明县": 30, }, }, "四川": map[string]interface{}{ "code": 51, "city": map[string]interface{}{ "成都": 1, "自贡": 3, "攀枝花": 4, "泸州": 5, "德阳": 6, "绵阳": 7, "广元": 8, "遂宁": 9, "内江": 10, "乐山": 11, "南充": 13, "眉山": 14, "宜宾": 15, "广安": 16, "达州": 17, "雅安": 18, "巴中": 19, "资阳": 20, "阿坝": 32, "甘孜": 33, "凉山": 34, }, }, "天津": map[string]interface{}{ "code": 12, "city": map[string]interface{}{ "和平区": 1, "河东区": 2, "河西区": 3, "南开区": 4, "河北区": 5, "红桥区": 6, "塘沽区": 7, "汉沽区": 8, "大港区": 9, "东丽区": 10, "西青区": 11, "津南区": 12, "北辰区": 13, "武清区": 14, "宝坻区": 15, "宁河县": 21, "静海县": 23, "蓟县": 25, }, }, "西藏": map[string]interface{}{ "code": 54, "city": map[string]interface{}{ "拉萨": 1, "昌都": 21, "山南": 22, "日喀则": 23, "那曲": 24, "阿里": 25, "林芝": 26, }, }, "新疆": map[string]interface{}{ "code": 65, "city": map[string]interface{}{ "乌鲁木齐": 1, "克拉玛依": 2, "吐鲁番": 21, "哈密": 22, "昌吉": 23, "博尔塔拉": 27, "巴音郭楞": 28, "阿克苏": 29, "克孜勒苏": 30, "喀什": 31, "和田": 32, "伊犁": 40, "塔城": 42, "阿勒泰": 43, "石河子": 44, }, }, "云南": map[string]interface{}{ "code": 53, "city": map[string]interface{}{ "昆明": 1, "曲靖": 3, "玉溪": 4, "保山": 5, "昭通": 6, "楚雄": 23, "红河": 25, "文山": 26, "思茅": 27, "西双版纳": 28, "大理": 29, "德宏": 31, "丽江": 32, "怒江": 33, "迪庆": 34, "临沧": 35, }, }, "浙江": map[string]interface{}{ "code": 33, "city": map[string]interface{}{ "杭州": 1, "宁波": 2, "温州": 3, "嘉兴": 4, "湖州": 5, "绍兴": 6, "金华": 7, "衢州": 8, "舟山": 9, "台州": 10, "丽水": 11, }, }, "陕西": map[string]interface{}{ "code": 61, "city": map[string]interface{}{ "西安": 1, "铜川": 2, "宝鸡": 3, "咸阳": 4, "渭南": 5, "延安": 6, "汉中": 7, "榆林": 8, "安康": 9, "商洛": 10, }, }, "台湾": map[string]interface{}{ "code": 71, "city": map[string]interface{}{ "台北": 1, "高雄": 2, "基隆": 3, "台中": 4, "台南": 5, "新竹": 6, "嘉义": 7, "其他": 90, }, }, "香港": map[string]interface{}{ "code": 81, "city": map[string]interface{}{ "香港": 1, }, }, "澳门": map[string]interface{}{ "code": 82, "city": map[string]interface{}{ "澳门": 1, }, }, "海外": map[string]interface{}{ "code": 400, "city": map[string]interface{}{ "美国": 1, "英国": 2, "法国": 3, "俄罗斯": 4, "加拿大": 5, "巴西": 6, "澳大利亚": 7, "印尼": 8, "泰国": 9, "马来西亚": 10, "新加坡": 11, "菲律宾": 12, "越南": 13, "印度": 14, "日本": 15, "其他": 16, }, }, "其他": map[string]interface{}{ "code": 100, "city": map[string]interface{}{ "不限": 1000, }, }, }
SearchRegion 微博高级搜索中的地点
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 ¶
func GetSearchRegionCode ¶ added in v1.0.5
GetSearchRegionCode 获取地点 code 返回格式 prov code 和 city code
func NormalizeTime ¶ added in v1.0.5
NormalizeTime 标准化微博时间 刚刚、x秒前、x分钟前、x小时前、今天H:M、x月x日 -> Y-m-d H:M
Types ¶
type CrackPinFunc ¶
CrackPinFunc 验证码破解方法类型声明 验证码图片以 io.Reader 类型传入,返回破解结果字符串
type RespCommentsByMe ¶ added in v1.0.6
type RespCommentsByMe struct {
RespError
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"`
}
RespCommentsByMe CommentsByMe 接口返回结果
type RespCommentsCreate ¶ added in v1.0.6
type RespCommentsCreate struct {
Error string `json:"error"`
ErrorCode int `json:"error_code"`
Request string `json:"request"`
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"`
}
RespCommentsCreate CommentsCreate 接口返回结构
type RespCommentsDestroyBatch ¶ added in v1.0.6
type RespCommentsDestroyBatch []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"`
}
RespCommentsDestroyBatch CommentsDestroyBatch 接口返回结构
type RespCommentsReply ¶ added in v1.0.6
type RespCommentsReply struct {
Error string `json:"error"`
ErrorCode int `json:"error_code"`
Request string `json:"request"`
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"`
}
RespCommentsReply CommentsReply 接口返回结果
type RespCommentsShow ¶ added in v1.0.6
type RespCommentsShow struct {
Error string `json:"error"`
ErrorCode int `json:"error_code"`
Request string `json:"request"`
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"`
}
RespCommentsShow CommentsShow 接口返回结构
type RespCommentsShowBatch ¶ added in v1.0.6
type RespCommentsShowBatch []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"`
}
RespCommentsShowBatch CommentsShowBatch 接口返回结构
type RespEmotions ¶ added in v1.0.6
type RespEmotions []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"`
}
RespEmotions Emotions 接口返回结果
type RespError ¶ added in v1.0.6
type RespError struct {
Error string `json:"error"`
ErrorCode int `json:"error_code"`
Request string `json:"request"`
}
RespError 微博接口的错误结果返回结构
type RespMobileLogin ¶ added in v1.0.6
type RespMobileLogin struct {
Retcode int `json:"retcode"`
Msg string `json:"msg"`
Data map[string]interface{} `json:"data"`
}
RespMobileLogin 移动端登录的返回结果
type RespQRLogin ¶ added in v1.0.6
type RespQRLogin struct {
Retcode string `json:"retcode"`
UID string `json:"uid"`
Nick string `json:"nick"`
CrossDomainURLList []string `json:"crossDomainUrlList"`
}
RespQRLogin 扫码登录返回 json 结构
type RespStatusesCount ¶ added in v1.0.6
type RespStatusesCount []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"`
}
RespStatusesCount StatusesCount 接口返回结构
type RespStatusesHomeTimeline ¶ added in v1.0.6
type RespStatusesHomeTimeline struct {
RespError
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"`
}
RespStatusesHomeTimeline StatusesHomeTimeline 接口返回结构
type RespStatusesMentions ¶ added in v1.0.6
type RespStatusesMentions struct {
RespError
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"`
}
RespStatusesMentions StatusesMentions 接口返回结构
type RespStatusesPublicTimeline ¶ added in v1.0.6
type RespStatusesPublicTimeline struct {
RespError
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"`
}
RespStatusesPublicTimeline StatusesPublicTimeline 接口返回结果
type RespStatusesRepostTimeline ¶ added in v1.0.6
type RespStatusesRepostTimeline struct {
RespError
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"`
}
RespStatusesRepostTimeline StatusesRepostTimeline 接口返回结构
type RespStatusesShare ¶ added in v1.0.6
type RespStatusesShare 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"`
}
RespStatusesShare 微博成功发送后的返回结构
type RespStatusesShow ¶ added in v1.0.6
type RespStatusesShow struct {
RespError
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"`
}
RespStatusesShow StatusesShow 接口的返回结构
type RespStatusesUserTimeline ¶ added in v1.0.6
type RespStatusesUserTimeline struct {
RespError
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"`
}
RespStatusesUserTimeline StatusesUserTimeline 接口返回结构
type RespSummary ¶ added in v1.0.6
RespSummary Summary 返回结构
func Summary ¶ added in v1.0.4
func Summary(param string) ([]RespSummary, error)
Summary 微博热搜 pkg 级别的热搜,未登录,无法获取好友搜列表,热搜榜和要闻榜正常
type RespToken ¶ added in v1.0.6
type RespToken struct {
RespError
AccessToken string `json:"access_token"` // access token
ExpiresIn int64 `json:"expires_in"` // ExpiresIn 秒之后 token 过期
UID string `json:"uid"`
IsRealName string `json:"isRealName"`
}
RespToken 获取 access token 接口的返回结果
type RespTokenInfo ¶ added in v1.0.6
type RespTokenInfo struct {
RespError
UID string `json:"uid"`
Appkey string `json:"appkey"`
Scope string `json:"scope"`
CreateAt string `json:"create_at"`
ExpireIn string `json:"expire_in"`
}
RespTokenInfo 查询 token 信息接口的返回结果
type RespUsersDomainShow ¶ added in v1.0.6
type RespUsersDomainShow struct {
RespError
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"`
}
RespUsersDomainShow UsersDomainShow 接口返回结构
type RespUsersShow ¶ added in v1.0.6
type RespUsersShow struct {
RespError
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"`
}
RespUsersShow UsersShow 接口返回结构
type SearchWeiboCondition ¶ added in v1.0.5
type SearchWeiboCondition struct {
URLParam string // 保存最终组合到一起的搜索条件对应的 URL 参数
}
SearchWeiboCondition 高级搜索筛选条件
func (*SearchWeiboCondition) ContainAll ¶ added in v1.0.5
func (c *SearchWeiboCondition) ContainAll() *SearchWeiboCondition
ContainAll 设置包含条件为 全部
func (*SearchWeiboCondition) ContainLink ¶ added in v1.0.5
func (c *SearchWeiboCondition) ContainLink() *SearchWeiboCondition
ContainLink 设置包含条件为 包含短链
func (*SearchWeiboCondition) ContainMusic ¶ added in v1.0.5
func (c *SearchWeiboCondition) ContainMusic() *SearchWeiboCondition
ContainMusic 设置包含条件为 包含音乐
func (*SearchWeiboCondition) ContainPic ¶ added in v1.0.5
func (c *SearchWeiboCondition) ContainPic() *SearchWeiboCondition
ContainPic 设置包含条件为 包含图片
func (*SearchWeiboCondition) ContainVideo ¶ added in v1.0.5
func (c *SearchWeiboCondition) ContainVideo() *SearchWeiboCondition
ContainVideo 设置包含条件为 包含视频
func (*SearchWeiboCondition) Region ¶ added in v1.0.5
func (c *SearchWeiboCondition) Region(prov, city string) *SearchWeiboCondition
Region 设置地点范围,传入中文
func (*SearchWeiboCondition) TimeScope ¶ added in v1.0.5
func (c *SearchWeiboCondition) TimeScope(begin, end string) *SearchWeiboCondition
TimeScope 设置起止时间范围 时间格式:2020-05-01-18 Y-m-d-H
func (*SearchWeiboCondition) TypeAll ¶ added in v1.0.5
func (c *SearchWeiboCondition) TypeAll() *SearchWeiboCondition
TypeAll 设置微博搜索类型为 全部
func (*SearchWeiboCondition) TypeAtten ¶ added in v1.0.5
func (c *SearchWeiboCondition) TypeAtten() *SearchWeiboCondition
TypeAtten 设置微博搜索类型为 关注人
func (*SearchWeiboCondition) TypeCategory ¶ added in v1.0.5
func (c *SearchWeiboCondition) TypeCategory() *SearchWeiboCondition
TypeCategory 设置微博搜索类型为 认证用户
func (*SearchWeiboCondition) TypeHot ¶ added in v1.0.5
func (c *SearchWeiboCondition) TypeHot() *SearchWeiboCondition
TypeHot 设置微博搜索类型为 热门
func (*SearchWeiboCondition) TypeOri ¶ added in v1.0.5
func (c *SearchWeiboCondition) TypeOri() *SearchWeiboCondition
TypeOri 设置微博搜索类型为 原创
func (*SearchWeiboCondition) TypeViewpoint ¶ added in v1.0.5
func (c *SearchWeiboCondition) TypeViewpoint() *SearchWeiboCondition
TypeViewpoint 设置微博搜索类型为 认证用户
func (*SearchWeiboCondition) TypeVip ¶ added in v1.0.5
func (c *SearchWeiboCondition) TypeVip() *SearchWeiboCondition
TypeVip 设置微博搜索类型为 认证用户
type SearchWeiboResult ¶ added in v1.0.5
type SearchWeiboResult struct {
ID string // 微博 id
User User // 用户信息
Status struct {
Origin Status // 带有搜索结果的原始微博
Forward Status // 原始微博带有的转发微博
}
}
SearchWeiboResult 微博搜索结果结构
func SearchWeibo ¶ added in v1.0.5
func SearchWeibo(keyword string) ([]SearchWeiboResult, error)
SearchWeibo 微博综合搜索 pkg 级别的搜索,未登录,无法使用高级搜索,搜索内容有限,只能看评论、转发、点赞的数量
type Status ¶ added in v1.0.5
type Status struct {
Content string // 微博文本内容
PicURLs []string // 微博图片链接
PostTime string // 微博发送时间
Source string // 微博发送来源
RepostCount int // 转发数
CommentCount int // 评论数
LikeCount int // 点赞数
Video struct {
URL string // 微博视频链接
CoverURL string // 视频封面图片链接
}
}
Status 微博 html 解析出的微博对象
type User ¶ added in v1.0.5
type User struct {
NickName string // 微博名
HomePage string // 微博主页 URL 地址
AvatorURL string // 头像 URL 地址
}
User 微博 html 解析出的用户对象
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) (*RespCommentsByMe, 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) (*RespCommentsCreate, 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) (*RespCommentsDestroyBatch, 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) (*RespCommentsReply, 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) (*RespCommentsShow, 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) (*RespCommentsShowBatch, 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) (*RespCommentsByMe, error)
CommentsTimeline 获取当前登录用户的最新评论包括接收到的与发出的,返回结构与 RespCommentsByMe 相同 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) (*RespCommentsByMe, error)
CommentsToMe 获取当前登录用户所接收到的评论列表,返回结果和 RespCommentsByMe 相同 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) (*RespEmotions, 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) SearchWeibo ¶ added in v1.0.5
func (w *Weibo) SearchWeibo(keyword string, page int, condition *SearchWeiboCondition) ([]SearchWeiboResult, error)
SearchWeibo 微博综合搜索(登录状态) 支持分页,翻页时不要太快,否则会跳转安全验证页面 支持高级搜索
func (*Weibo) StatusesCount ¶ added in v1.0.4
func (w *Weibo) StatusesCount(token string, ids ...int64) (*RespStatusesCount, 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) (*RespStatusesHomeTimeline, 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) (*RespStatusesMentions, 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) StatusesPublicTimeline ¶ added in v1.0.6
func (w *Weibo) StatusesPublicTimeline(token string, count, page, baseApp int) (*RespStatusesPublicTimeline, error)
StatusesPublicTimeline 返回最新的公共微博 count 单页返回的记录条数 page 返回结果的页码 baseApp 是否只获取当前应用的数据
func (*Weibo) StatusesRepostTimeline ¶ added in v1.0.4
func (w *Weibo) StatusesRepostTimeline(token string, id, sinceID, maxID int64, count, page, filterByAuthor int) (*RespStatusesRepostTimeline, 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) (*RespStatusesShow, 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) (*RespStatusesUserTimeline, 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) ([]RespSummary, 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() ([]RespSummary, error)
SummaryFriendsSearch 微博好友搜
func (*Weibo) SummaryRealtimeHot ¶ added in v1.0.4
func (w *Weibo) SummaryRealtimeHot() ([]RespSummary, error)
SummaryRealtimeHot 微博热搜榜
func (*Weibo) SummarySocialEvent ¶ added in v1.0.4
func (w *Weibo) SummarySocialEvent() ([]RespSummary, error)
SummarySocialEvent 微博要闻榜
func (*Weibo) TokenInfo ¶
func (w *Weibo) TokenInfo(token string) (*RespTokenInfo, error)
TokenInfo 获取用户 access_token 的授权相关信息,包括授权时间,过期时间和 scope 权限
func (*Weibo) UsersDomainShow ¶ added in v1.0.4
func (w *Weibo) UsersDomainShow(token, domain string) (*RespUsersDomainShow, 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
- normalize_post_time.go
- qr_login.go
- search_region.go
- search_weibo.go
- statuses_count.go
- statuses_go.go
- statuses_home_timeline.go
- statuses_mentions.go
- statuses_public_timeline.go
- statuses_repost_timeline.go
- statuses_share.go
- statuses_show.go
- statuses_user_timeline.go
- summary.go
- users_domain_show.go
- users_show.go
- utils.go