api

package module
v0.0.0-...-e5476dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2025 License: MIT Imports: 23 Imported by: 0

README

go-bilibili-api

哔哩哔哩 API 的 go 语言实现。

接口编写参考 BAC Document 目前已按顺序实现至 大会员

背景知识

在使用本库前,你需要了解 req 库的使用方法。

使用方法

你先别急🤭

先看本库有没有实现,如果没有实现,请告诉我,我有空会实现。

其次,本库最大的优点是自由度高,你可以按照本库中编写 API 的方式写你需要的接口,再用 client.go 里的函数实现调用

func Do[T any](api req.API) (result T, err error) {
	err = cli.Result(api, &result)
	return
}

Documentation

Index

Constants

View Source
const (
	// 纯文字消息
	MsgTypeText = 1

	// 图片消息
	MsgTypeImage = 2

	// 撤回消息
	MsgTypeWithdraw = 5

	// 应援团图片
	// 但似乎不常触发 一般使用 MsgTypeImage 即可
	MsgTypeGroupsImage = 6

	// 分享视频
	MsgTypeShareVideo = 7

	// 系统通知
	MsgTypeNotice = 10

	// UP 主推送的视频
	MsgTypePushedVideo = 11

	// 新成员加入应援团欢迎
	MsgTypeWelcome = 306
)

Variables

View Source
var CheckInterval time.Duration = time.Hour

检查 accessID 和 mixinKey 的间隔

每次发起请求时若用到了这两个参数,就会检查是否太久未更新,如果超出这个间隔则会自动更新一次

View Source
var ErrAccessNotExist = errors.New("api: access_id does not exist")
View Source
var ErrBiliJctNotExists = errors.New("api: bili_jct does not exist")
View Source
var ErrRefreshCSRFNotExist = errors.New("api: refresh_csrf does not exist")
View Source
var PublicKeyPEM []byte

Functions

func AddMixinKey

func AddMixinKey(query url.Values) error

添加请求参数验证参数

func Do

func Do[T any](api req.API) (result T, err error)

func GenerateMixinKey

func GenerateMixinKey(ae string) string

根据拼接后字符串生成 mixinKey

func GetAccessID

func GetAccessID() (string, error)

获取 accessID

无法保证一定可用,因为可能在上次检查后服务端就刷新了

func GetBuvid3

func GetBuvid3() string

接口获取 buvid3

func GetClient

func GetClient() *req.Client

func GetCorrespondPath

func GetCorrespondPath(ts int64) (string, error)

生成 CorrespondPath

ts 为当前毫秒级时间戳

代码由 https://socialsisteryi.github.io/bilibili-API-collect/docs/login/cookie_refresh.html 提供

func GetMixinKey

func GetMixinKey() (string, error)

获取 mixinKey

无法保证一定可用,因为可能在上次检查后服务端就刷新了

func GetRefreshCSRF

func GetRefreshCSRF(credential *Credential) (string, error)

获取 refresh_csrf

func IntSliceToString

func IntSliceToString(num []int) string

将数组转为字符串

func PostConfirmRefresh

func PostConfirmRefresh(credential *Credential) error

确认更新

func ReadPage

func ReadPage[V Morer](api PageReader, timer req.RetryTimer) func(yeild func(int, V) bool)

对于需要读取多页的接口设计的迭代器

虽然迭代器要 go1.23 及以上才能用

但这不代表我这个 go1.18 的库不能先写出这样的函数来🤭

func SplitURL

func SplitURL(url string) string

提取 img_key 和 sub_key

func UpdateAccessID

func UpdateAccessID() error

更新 accessID(一般不需要手动调用)

成功后会刷新 accessIDUpdateTime

func UpdateMixinKey

func UpdateMixinKey() error

更新 mixinKey(一般不需要手动调用)

成功后会刷新 mixinKeyUpdateTime

Types

type AccInfo

type AccInfo struct {
	GetWBI
	AccessID
	*Credential

	// 目标用户 UID
	MID int `api:"query"`
}

用户空间详细信息

func (AccInfo) RawURL

func (AccInfo) RawURL() string

type AccInfoResponse

type AccInfoResponse struct {
	Error
	Data struct {
		MID         int    `json:"mid"`           // 208259
		Name        string `json:"name"`          // "陈睿"
		Sex         string `json:"sex"`           // "男"
		Face        string `json:"face"`          // "http://i2.hdslb.com/bfs/app/8920e6741fc2808cce5b81bc27abdbda291655d3.png"
		FaceNft     int    `json:"face_nft"`      // 0
		FaceNftType int    `json:"face_nft_type"` // 0
		Sign        string `json:"sign"`          // "喜欢的话就坚持吧"
		Rank        int    `json:"rank"`          // 10000
		Level       int    `json:"level"`         // 6
		Jointime    int    `json:"jointime"`      // 0
		Moral       int    `json:"moral"`         // 0
		Silence     int    `json:"silence"`       // 0
		Coins       int    `json:"coins"`         // 0
		FansBadge   bool   `json:"fans_badge"`    // true
		FansMedal   struct {
			Show  bool `json:"show"` // false
			Wear  bool `json:"wear"` // false
			Medal any  `json:"medal"`
		} `json:"fans_medal"`
		Official struct {
			Role  int    `json:"role"`  // 2
			Title string `json:"title"` // "bilibili董事长兼CEO"
			Desc  string `json:"desc"`  // ""
			Type  int    `json:"type"`  // 0
		} `json:"official"`
		Vip struct {
			Type       int   `json:"type"`         // 2
			Status     int   `json:"status"`       // 1
			DueDate    int64 `json:"due_date"`     // 2096121600000
			VipPayType int   `json:"vip_pay_type"` // 1
			ThemeType  int   `json:"theme_type"`   // 0
			Label      struct {
				Path                  string `json:"path"`                      // ""
				Text                  string `json:"text"`                      // "十年大会员"
				LabelTheme            string `json:"label_theme"`               // "ten_annual_vip"
				TextColor             string `json:"text_color"`                // "#FFFFFF"
				BgStyle               int    `json:"bg_style"`                  // 1
				BgColor               string `json:"bg_color"`                  // "#FB7299"
				BorderColor           string `json:"border_color"`              // ""
				UseImgLabel           bool   `json:"use_img_label"`             // true
				ImgLabelURIHans       string `json:"img_label_uri_hans"`        // "https://i0.hdslb.com/bfs/activity-plat/static/20220608/e369244d0b14644f5e1a06431e22a4d5/wltavwHAkL.gif"
				ImgLabelURIHant       string `json:"img_label_uri_hant"`        // ""
				ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"` // "https://i0.hdslb.com/bfs/vip/802418ff03911645648b63aa193ba67997b5a0bc.png"
				ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"` // "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/8u7iRTPE7N.png"
			} `json:"label"`
			AvatarSubscript    int    `json:"avatar_subscript"`     // 1
			NicknameColor      string `json:"nickname_color"`       // "#FB7299"
			Role               int    `json:"role"`                 // 7
			AvatarSubscriptURL string `json:"avatar_subscript_url"` // ""
			TvVipStatus        int    `json:"tv_vip_status"`        // 1
			TvVipPayType       int    `json:"tv_vip_pay_type"`      // 0
			TvDueDate          int    `json:"tv_due_date"`          // 1873641600
			AvatarIcon         struct {
				IconType     int `json:"icon_type"` // 1
				IconResource struct {
				} `json:"icon_resource"`
			} `json:"avatar_icon"`
		} `json:"vip"`
		Pendant struct {
			PID               int    `json:"pid"`                 // 0
			Name              string `json:"name"`                // ""
			Image             string `json:"image"`               // ""
			Expire            int    `json:"expire"`              // 0
			ImageEnhance      string `json:"image_enhance"`       // ""
			ImageEnhanceFrame string `json:"image_enhance_frame"` // ""
			NPID              int    `json:"n_pid"`               // 0
		} `json:"pendant"`
		Nameplate struct {
			NID        int    `json:"nid"`         // 0
			Name       string `json:"name"`        // ""
			Image      string `json:"image"`       // ""
			ImageSmall string `json:"image_small"` // ""
			Level      string `json:"level"`       // ""
			Condition  string `json:"condition"`   // ""
		} `json:"nameplate"`
		UserHonourInfo struct {
			MID               int   `json:"mid"` // 0
			Colour            any   `json:"colour"`
			Tags              []any `json:"tags"`
			IsLatest100Honour int   `json:"is_latest_100honour"` // 0
		} `json:"user_honour_info"`
		IsFollowed bool   `json:"is_followed"` // false
		TopPhoto   string `json:"top_photo"`   // "http://i0.hdslb.com/bfs/space/cb1c3ef50e22b6096fde67febe863494caefebad.png"
		Theme      struct {
		} `json:"theme"`
		SysNotice struct {
		} `json:"sys_notice"`
		LiveRoom struct {
			RoomStatus    int    `json:"roomStatus"`     // 1
			LiveStatus    int    `json:"liveStatus"`     // 0
			URL           string `json:"url"`            // "https://live.bilibili.com/3394945?broadcast_type=0&is_room_feed=0"
			Title         string `json:"title"`          // "初来报道,关注一下吧~"
			Cover         string `json:"cover"`          // "https://i0.hdslb.com/bfs/live/59fc254c1f51a962dbf69ae85e4920f2f6fb8dcd.png"
			RoomID        int    `json:"roomid"`         // 3394945
			RoundStatus   int    `json:"roundStatus"`    // 0
			BroadcastType int    `json:"broadcast_type"` // 0
			WatchedShow   struct {
				Switch       bool   `json:"switch"`        // true
				Num          int    `json:"num"`           // 1
				TextSmall    string `json:"text_small"`    // "1"
				TextLarge    string `json:"text_large"`    // "1人看过"
				Icon         string `json:"icon"`          // "https://i0.hdslb.com/bfs/live/a725a9e61242ef44d764ac911691a7ce07f36c1d.png"
				IconLocation string `json:"icon_location"` // ""
				IconWeb      string `json:"icon_web"`      // "https://i0.hdslb.com/bfs/live/8d9d0f33ef8bf6f308742752d13dd0df731df19c.png"
			} `json:"watched_show"`
		} `json:"live_room"`
		Birthday string `json:"birthday"` // "01-23"
		School   struct {
			Name string `json:"name"` // "成都信息工程大学"
		} `json:"school"`
		Profession struct {
			Name       string `json:"name"`       // ""
			Department string `json:"department"` // ""
			Title      string `json:"title"`      // ""
			IsShow     int    `json:"is_show"`    // 0
		} `json:"profession"`
		Tags   any `json:"tags"`
		Series struct {
			UserUpgradeStatus int  `json:"user_upgrade_status"` // 3
			ShowUpgradeWindow bool `json:"show_upgrade_window"` // false
		} `json:"series"`
		IsSeniorMember int  `json:"is_senior_member"` // 0
		McnInfo        any  `json:"mcn_info"`
		GaiaResType    int  `json:"gaia_res_type"` // 0
		GaiaData       any  `json:"gaia_data"`
		IsRisk         bool `json:"is_risk"` // false
		Elec           struct {
			ShowInfo struct {
				Show    bool   `json:"show"`     // false
				State   int    `json:"state"`    // -1
				Title   string `json:"title"`    // ""
				Icon    string `json:"icon"`     // ""
				JumpURL string `json:"jump_url"` // "?oid=208259"
			} `json:"show_info"`
		} `json:"elec"`
		Contract struct {
			IsDisplay       bool `json:"is_display"`        // false
			IsFollowDisplay bool `json:"is_follow_display"` // false
		} `json:"contract"`
		CertificateShow bool `json:"certificate_show"` // false
		NameRender      any  `json:"name_render"`
	} `json:"data"`
}

func GetAccInfo

func GetAccInfo(uid int, credential *Credential) (result AccInfoResponse, err error)

用户空间详细信息

type AccRelation

type AccRelation struct {
	GetWBI
	*Credential

	// 目标用户 UID
	MID int `api:"query"`
}

查询用户与自己关系(互相关系)

func (AccRelation) RawURL

func (AccRelation) RawURL() string

type AccRelationResponse

type AccRelationResponse struct {
	Error
	Data struct {
		Relation   QueryRelation `json:"relation"`    // 目标用户对于当前用户的关系
		BeRelation QueryRelation `json:"be_relation"` // 当前用户对于目标用户的关系
	} `json:"data"`
}

func GetAccRelation

func GetAccRelation(uid int, credential *Credential) (result AccRelationResponse, err error)

查询用户与自己关系(互相关系)

type AccTags

type AccTags struct {
	req.Get

	// 用户 UID
	MID int `api:"query"`
}

查看用户个人 TAG

func (AccTags) RawURL

func (AccTags) RawURL() string

type AccTagsResponse

type AccTagsResponse struct {
	Error
	Data []struct {
		MID  int      `json:"mid"` // 434334701
		Tags []string `json:"tags"`
	} `json:"data"`
}

func GetAccTags

func GetAccTags(uid int) (result AccTagsResponse, err error)

查看用户个人 TAG

type AccessID

type AccessID struct{}

对于需要添加 access_id 的接口 只需要将 AccessID 嵌入结构体即可

func (AccessID) NeedAccessID

func (AccessID) NeedAccessID()

type Account

type Account struct {
	req.Get
	*Credential
}

获取我的信息

func (Account) RawURL

func (Account) RawURL() string

type AccountResponse

type AccountResponse struct {
	Error

	Data struct {
		MID      int    `json:"mid"`
		Uname    string `json:"uname"`
		UserID   string `json:"userid"`
		Sign     string `json:"sign"`
		Birthday string `json:"birthday"`
		Sex      string `json:"sex"`
		NickFree bool   `json:"nick_free"`
		Rank     string `json:"rank"`
	} `json:"data"`
}

func GetAccount

func GetAccount(credential *Credential) (result AccountResponse, err error)

获取我的信息

type Add

type Add struct {
	PostCSRF
	*Credential

	// 置顶目标稿件 avid
	// 与 bvid 任选一个
	AID int `api:"body"`

	// 置顶目标稿件 bvid
	// 与 avid 任选一个
	BVID string `api:"body" req:"bvid"`

	// 置顶视频备注 最大 40 字符
	Reason string `api:"body"`
}

添加代表作视频

func (Add) RawURL

func (Add) RawURL() string

type AddResponse

type AddResponse struct {
	Error
}

func PostAdd

func PostAdd(bvid, reason string, credential *Credential) (result AddResponse, err error)

添加代表作视频

type AddUsers

type AddUsers struct {
	PostCSRF
	*Credential

	// 目标用户 UID 用(,)间隔
	FIDs string `api:"query"`

	// 分组 id 列表 用(,)间隔
	TagIDs string `api:"query" req:"tagids"`
}

修改分组成员

如需删除分组中的成员 请将 tagids 设为 0 即移动至默认分组 而不是取关

func (AddUsers) RawURL

func (AddUsers) RawURL() string

type AddUsersResponse

type AddUsersResponse struct {
	Error
}

func PostAddUsers

func PostAddUsers(uid, tagid []int, credential *Credential) (result AddUsersResponse, err error)

修改分组成员

如需删除分组中的成员 请将 tagids 设为 0 即移动至默认分组 而不是取关

type ApplyStatus

type ApplyStatus struct {
	req.Get
	*Credential
}

查询实名认证详细信息

func (ApplyStatus) RawURL

func (ApplyStatus) RawURL() string

type ApplyStatusResponse

type ApplyStatusResponse struct {
	Error

	Data struct {
		Status   int    `json:"status"`
		Remark   string `json:"remark"`
		Realname string `json:"realname"`
		Card     string `json:"card"`
		CardType int    `json:"card_type"`
	} `json:"data"`
}

func GetApplyStatus

func GetApplyStatus(credential *Credential) (result ApplyStatusResponse, err error)

查询实名认证详细信息

type Arc

type Arc struct {
	req.Get

	// 目标用户 UID
	Vmid int `api:"query"`
}

查询用户置顶视频

func (Arc) RawURL

func (Arc) RawURL() string

type ArcResponse

type ArcResponse struct {
	Error
	Data VideoInfo `json:"data"`
}

func GetArc

func GetArc(uid int) (result ArcResponse, err error)

查询用户置顶视频

type BatchModify

type BatchModify struct {
	PostCSRF
	*Credential
}

批量操作用户关系

func (BatchModify) RawURL

func (BatchModify) RawURL() string

type Blacks

type Blacks struct {
	req.Get
	*Credential

	// 分页页数
	Pn int `api:"query:1"`

	// 分页大小
	Ps int `api:"query:50"`
}

查询黑名单明细

func (Blacks) RawURL

func (Blacks) RawURL() string

func (*Blacks) ReadPage

func (api *Blacks) ReadPage(v any) (int, error)

type BlacksResponse

type BlacksResponse struct {
	Error
	Data struct {
		List      []RelationItem `json:"list"`
		ReVersion int            `json:"re_version"` // 0
		Total     int            `json:"total"`      // 87
	} `json:"data"`
}

func GetBlacks

func GetBlacks(credential *Credential) (result BlacksResponse, err error)

查询黑名单明细

func (BlacksResponse) More

func (r BlacksResponse) More() bool

type Cancel

type Cancel struct {
	PostCSRF
	*Credential
}

取消置顶视频

func (Cancel) RawURL

func (Cancel) RawURL() string

type CancelResponse

type CancelResponse struct {
	Error
}

func PostCancel

func PostCancel(credential *Credential) (result CancelResponse, err error)

取消置顶视频

type Card

type Card struct {
	req.Get
	*Credential

	// 目标用户 UID
	MID int `api:"query"`

	// 是否请求用户主页头图
	Photo bool `api:"query"`
}

用户名片信息

func (Card) RawURL

func (Card) RawURL() string

type CardMap

type CardMap struct {
	req.Get
	*Credential

	// 目标用户的 UID 列表 用(,)间隔
	// 最多200个成员
	UIDs string `api:"query"`
}

多用户详细信息字典

func (CardMap) RawURL

func (CardMap) RawURL() string

type CardMapResponse

type CardMapResponse struct {
	Error
	Data map[string]struct {
		Face       string `json:"face"`         // "https://i1.hdslb.com/bfs/face/8802d20c0c0e7f4cc232543c619da14ec5bac76d.jpg"
		FaceNft    int    `json:"face_nft"`     // 0
		FaceNftNew int    `json:"face_nft_new"` // 0
		MID        string `json:"mid"`          // "434324701"
		Name       string `json:"name"`         // "奔跑在上岸路上的小杨"
		NameRender any    `json:"name_render"`
		Nameplate  any    `json:"nameplate"`
		Official   struct {
			Desc  string `json:"desc"`  // ""
			Role  int    `json:"role"`  // 0
			Title string `json:"title"` // ""
			Type  int    `json:"type"`  // -1
		} `json:"official"`
		Pendant any `json:"pendant"`
		Vip     struct {
			AvatarIcon         any    `json:"avatar_icon"`
			AvatarSubscript    int    `json:"avatar_subscript"`     // 0
			AvatarSubscriptURL string `json:"avatar_subscript_url"` // ""
			DueDate            string `json:"due_date"`             // "0"
			Label              struct {
				BgColor               string `json:"bg_color"`                  // ""
				BgStyle               int    `json:"bg_style"`                  // 0
				BorderColor           string `json:"border_color"`              // ""
				ImgLabelURIHans       string `json:"img_label_uri_hans"`        // ""
				ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"` // "https://i0.hdslb.com/bfs/vip/d7b702ef65a976b20ed854cbd04cb9e27341bb79.png"
				ImgLabelURIHant       string `json:"img_label_uri_hant"`        // ""
				ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"` // "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/KJunwh19T5.png"
				LabelTheme            string `json:"label_theme"`               // ""
				Path                  string `json:"path"`                      // ""
				Text                  string `json:"text"`                      // ""
				TextColor             string `json:"text_color"`                // ""
				UseImgLabel           bool   `json:"use_img_label"`             // true
			} `json:"label"`
			NicknameColor string `json:"nickname_color"`  // ""
			Role          string `json:"role"`            // "0"
			Status        int    `json:"status"`          // 0
			ThemeType     int    `json:"theme_type"`      // 0
			TvDueDate     string `json:"tv_due_date"`     // "0"
			TvVipPayType  int    `json:"tv_vip_pay_type"` // 0
			TvVipStatus   int    `json:"tv_vip_status"`   // 0
			Type          int    `json:"type"`            // 0
			VipPayType    int    `json:"vip_pay_type"`    // 0
		} `json:"vip"`
	} `json:"data"`
}

func GetCardMap

func GetCardMap(uid []int, credential *Credential) (result CardMapResponse, err error)

多用户详细信息字典

type CardResponse

type CardResponse struct {
	Error
	Data struct {
		Card struct {
			MID         string `json:"mid"`           // "208259"
			Name        string `json:"name"`          // "陈睿"
			Approve     bool   `json:"approve"`       // false
			Sex         string `json:"sex"`           // "男"
			Rank        string `json:"rank"`          // "10000"
			Face        string `json:"face"`          // "http://i2.hdslb.com/bfs/app/8920e6741fc2808cce5b81bc27abdbda291655d3.png"
			FaceNft     int    `json:"face_nft"`      // 0
			FaceNftType int    `json:"face_nft_type"` // 0
			DisplayRank string `json:"DisplayRank"`   // "0"
			Regtime     int    `json:"regtime"`       // 0
			Spacesta    int    `json:"spacesta"`      // 0
			Birthday    string `json:"birthday"`      // ""
			Place       string `json:"place"`         // ""
			Description string `json:"description"`   // ""
			Article     int    `json:"article"`       // 0
			Attentions  []any  `json:"attentions"`
			Fans        int    `json:"fans"`      // 2280857
			Friend      int    `json:"friend"`    // 528
			Attention   int    `json:"attention"` // 528
			Sign        string `json:"sign"`      // "喜欢的话就坚持吧"
			LevelInfo   struct {
				CurrentLevel int `json:"current_level"` // 6
				CurrentMin   int `json:"current_min"`   // 0
				CurrentExp   int `json:"current_exp"`   // 0
				NextExp      int `json:"next_exp"`      // 0
			} `json:"level_info"`
			Pendant struct {
				PID               int    `json:"pid"`                 // 0
				Name              string `json:"name"`                // ""
				Image             string `json:"image"`               // ""
				Expire            int    `json:"expire"`              // 0
				ImageEnhance      string `json:"image_enhance"`       // ""
				ImageEnhanceFrame string `json:"image_enhance_frame"` // ""
				NPID              int    `json:"n_pid"`               // 0
			} `json:"pendant"`
			Nameplate struct {
				NID        int    `json:"nid"`         // 0
				Name       string `json:"name"`        // ""
				Image      string `json:"image"`       // ""
				ImageSmall string `json:"image_small"` // ""
				Level      string `json:"level"`       // ""
				Condition  string `json:"condition"`   // ""
			} `json:"nameplate"`
			Official struct {
				Role  int    `json:"role"`  // 2
				Title string `json:"title"` // "bilibili董事长兼CEO"
				Desc  string `json:"desc"`  // ""
				Type  int    `json:"type"`  // 0
			} `json:"Official"`
			OfficialVerify struct {
				Type int    `json:"type"` // 0
				Desc string `json:"desc"` // "bilibili董事长兼CEO"
			} `json:"official_verify"`
			Vip struct {
				Type       int   `json:"type"`         // 2
				Status     int   `json:"status"`       // 1
				DueDate    int64 `json:"due_date"`     // 2096121600000
				VipPayType int   `json:"vip_pay_type"` // 1
				ThemeType  int   `json:"theme_type"`   // 0
				Label      struct {
					Path                  string `json:"path"`                      // ""
					Text                  string `json:"text"`                      // "十年大会员"
					LabelTheme            string `json:"label_theme"`               // "ten_annual_vip"
					TextColor             string `json:"text_color"`                // "#FFFFFF"
					BgStyle               int    `json:"bg_style"`                  // 1
					BgColor               string `json:"bg_color"`                  // "#FB7299"
					BorderColor           string `json:"border_color"`              // ""
					UseImgLabel           bool   `json:"use_img_label"`             // true
					ImgLabelURIHans       string `json:"img_label_uri_hans"`        // "https://i0.hdslb.com/bfs/activity-plat/static/20220608/e369244d0b14644f5e1a06431e22a4d5/wltavwHAkL.gif"
					ImgLabelURIHant       string `json:"img_label_uri_hant"`        // ""
					ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"` // "https://i0.hdslb.com/bfs/vip/802418ff03911645648b63aa193ba67997b5a0bc.png"
					ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"` // "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/8u7iRTPE7N.png"
				} `json:"label"`
				AvatarSubscript    int    `json:"avatar_subscript"`     // 1
				NicknameColor      string `json:"nickname_color"`       // "#FB7299"
				Role               int    `json:"role"`                 // 7
				AvatarSubscriptURL string `json:"avatar_subscript_url"` // ""
				TvVipStatus        int    `json:"tv_vip_status"`        // 1
				TvVipPayType       int    `json:"tv_vip_pay_type"`      // 0
				TvDueDate          int    `json:"tv_due_date"`          // 1873641600
				AvatarIcon         struct {
					IconType     int `json:"icon_type"` // 1
					IconResource struct {
					} `json:"icon_resource"`
				} `json:"avatar_icon"`
				VipType   int `json:"vipType"`   // 2
				VipStatus int `json:"vipStatus"` // 1
			} `json:"vip"`
			IsSeniorMember int `json:"is_senior_member"` // 0
			NameRender     any `json:"name_render"`
		} `json:"card"`
		Space struct {
			SImg string `json:"s_img"` // "http://i0.hdslb.com/bfs/space/768cc4fd97618cf589d23c2711a1d1a729f42235.png"
			LImg string `json:"l_img"` // "http://i0.hdslb.com/bfs/space/cb1c3ef50e22b6096fde67febe863494caefebad.png"
		} `json:"space"`
		Following    bool `json:"following"`     // false
		ArchiveCount int  `json:"archive_count"` // 13
		ArticleCount int  `json:"article_count"` // 0
		Follower     int  `json:"follower"`      // 2280857
		LikeNum      int  `json:"like_num"`      // 5862111
	} `json:"data"`
}

func GetCard

func GetCard(uid int, credential *Credential) (result CardResponse, err error)

用户名片信息

type CardSlice

type CardSlice struct {
	req.Get
	*Credential

	// 目标用户的 UID 列表 用(,)间隔
	// 最多 50 个成员
	UIDs string `api:"query"`
}

多用户详细信息切片

func (CardSlice) RawURL

func (CardSlice) RawURL() string

type CardSliceResponse

type CardSliceResponse struct {
	Error
	Data []struct {
		MID     int    `json:"mid"`     // 7706705
		Name    string `json:"name"`    // "阿梓从小就很可爱"
		Face    string `json:"face"`    // "https://i2.hdslb.com/bfs/face/217b2cd3d069325244f7f64ff3d75b33c71f43c8.jpg"
		Sign    string `json:"sign"`    // "虚拟艺人团体VirtuaReal成员,喜欢宅在家唱歌打游戏的梓宝! 商务合作:bd@vrp.live"
		Rank    int    `json:"rank"`    // 10000
		Level   int    `json:"level"`   // 6
		Silence int    `json:"silence"` // 0
	} `json:"data"`
}

func GetCardSlice

func GetCardSlice(uid []int, credential *Credential) (result CardSliceResponse, err error)

多用户详细信息切片

type Coin

type Coin struct {
	req.Get
	*Credential
}

获取硬币数

func (Coin) RawURL

func (Coin) RawURL() string

type CoinLog

type CoinLog struct {
	req.Get
	*Credential
}

查询硬币变化情况

func (CoinLog) RawURL

func (CoinLog) RawURL() string

type CoinLogResponse

type CoinLogResponse struct {
	Error

	Data struct {
		List []struct {
			Time   string `json:"time"`
			Delta  int    `json:"delta"`
			Reason string `json:"reason"`
		} `json:"list"`
		Count int `json:"count"`
	} `json:"data"`
}

func GetCoinLog

func GetCoinLog(credential *Credential) (result CoinLogResponse, err error)

查询硬币变化情况

type CoinResponse

type CoinResponse struct {
	Error
	Status bool `json:"status"`
	Data   struct {
		Money float64 `json:"money"`
	} `json:"data"`
}

func GetCoin

func GetCoin(credential *Credential) (result CoinResponse, err error)

获取硬币数

type ConfirmRefresh

type ConfirmRefresh struct {
	PostCSRF
	*Credential

	// 旧的持久化刷新口令
	RefreshToken string `api:"body"`
}

确认更新

func (ConfirmRefresh) RawURL

func (ConfirmRefresh) RawURL() string

type ConfirmRefreshResponse

type ConfirmRefreshResponse struct {
	Error
}

type Content

type Content interface {
	req.Marshaler
	MsgType() int
}

内容接口

type ContractInfo

type ContractInfo struct {
	// 目标用户是否为对方的契约者
	IsContract bool `json:"is_contract"`

	// 是否为目标用户的契约者
	IsContractor bool `json:"is_contractor"`

	// 对方成为目标用户的契约者的时间 秒级时间戳
	// 仅当 IsContractor 项的值为 true 时才有此项
	TS int `json:"ts"`

	// 对方作为目标用户的契约者的属性
	// (1)老粉
	// 否则为原始粉丝
	UserAttr int `json:"user_attr"`
}

契约计划相关信息

type CookieInfo

type CookieInfo struct {
	req.Get
	*Credential
}

检查是否需要刷新

func (CookieInfo) RawURL

func (CookieInfo) RawURL() string

type CookieInfoResponse

type CookieInfoResponse struct {
	Error
	Data struct {
		Refresh   bool  `json:"refresh"`   // true
		Timestamp int64 `json:"timestamp"` // 1734963138171
	} `json:"data"`
}

func GetCookieInfo

func GetCookieInfo(credential *Credential) (result CookieInfoResponse, err error)

检查是否需要刷新

type CookieRefresh

type CookieRefresh struct {
	PostCSRF
	*Credential

	// 实时刷新口令
	// 通过 GetRefreshCSRF 获得
	RefreshCSRF string `api:"body" req:"refresh_csrf"`

	// 访问来源 默认值 main_web
	Source string `api:"body:main_web"`

	// 持久化刷新口令
	RefreshToken string `api:"body"`
}

刷新 Cookie

func (CookieRefresh) RawURL

func (CookieRefresh) RawURL() string

type CookieRefreshResponse

type CookieRefreshResponse struct {
	Error
	Data struct {
		Status       int    `json:"status"`        // 0
		Message      string `json:"message"`       // ""
		RefreshToken string `json:"refresh_token"` // "xxx"
	} `json:"data"`
}

func PostCookieRefresh

func PostCookieRefresh(credential *Credential) (result CookieRefreshResponse, err error)

刷新 Cookie

type CopyUsers

type CopyUsers struct {
	PostCSRF
	*Credential

	// 待复制用户 UID 用(,)间隔
	FIDs string `api:"query"`

	// 目标分组 id 列表 用(,)间隔
	TagIDs string `api:"query" req:"tagids"`
}

复制关注到分组

func (CopyUsers) RawURL

func (CopyUsers) RawURL() string

type CopyUsersResponse

type CopyUsersResponse struct {
	Error
}

func PostCopyUsers

func PostCopyUsers(uid, tagid []int, credential *Credential) (result CopyUsersResponse, err error)

复制关注到分组

type Correspond

type Correspond struct {
	req.Get
	*Credential

	// 通过 GetCorrespondPath 获取
	CorrespondPath string
}

获取 refresh_csrf

func (Correspond) RawURL

func (c Correspond) RawURL() string

type Create

type Create struct {
	PostCSRF
	*Credential

	// 分组名 最长 16 字符
	Tag string `api:"body"`
}

创建分组

func (Create) RawURL

func (Create) RawURL() string

type CreateResponse

type CreateResponse struct {
	Error
	Data struct {
		TagID int `json:"tagid"`
	} `json:"data"`
}

func PostCreate

func PostCreate(tag string, credential *Credential) (result CreateResponse, err error)

创建分组

type Credential

type Credential struct {
	// 登录 Token
	SESSDATA string

	// CSRF Token
	BiliJct string

	// 设备信息
	Buvid3 string

	// 数字型用户 UID
	DedeUserID string

	// 字符型用户 UID
	DedeUserIDckMd5 string

	// 持久化刷新口令
	// 保存在浏览器 localStorage 中 ac_time_value 的值
	RefreshToken string
}

凭据

func GetCredential

func GetCredential(qrcodeKey string) (*Credential, error)

登录成功后会自动将 Cookie 值写入返回值 *Credential 中

func (*Credential) Cookies

func (c *Credential) Cookies(*url.URL) []*http.Cookie

func (*Credential) IsValid

func (c *Credential) IsValid() bool

func (*Credential) Refresh

func (c *Credential) Refresh() error

func (*Credential) SetCookies

func (c *Credential) SetCookies(_ *url.URL, cookies []*http.Cookie)

func (*Credential) UID

func (c *Credential) UID() int

type DanmuInfo

type DanmuInfo struct {
	req.Get
	*Credential

	// 直播间真实 ID
	ID int `api:"query"`
}

获取信息流认证密钥

func (DanmuInfo) RawURL

func (DanmuInfo) RawURL() string

type DanmuInfoResponse

type DanmuInfoResponse struct {
	Error
	Data struct {
		Group            string  `json:"group"`              // "live"
		BusinessID       int     `json:"business_id"`        // 0
		RefreshRowFactor float64 `json:"refresh_row_factor"` // 0.125
		RefreshRate      int     `json:"refresh_rate"`       // 100
		MaxDelay         int     `json:"max_delay"`          // 5000
		Token            string  `json:"token"`              // "kCFEQiWeDA15-4KOmwu4IZ597OPNSEfHoYTGY0HOoWQEHVBKM4nGTGOWW6SLE2LJxnOKZINMCQxIExb7xkO8FIBZNs_kMflWYeojYTEV_jl9TsILOJRX1pC2kAOByp72j4WrKsc0GdvdUnxqwfnib8Ysps1Upwe2O2Db_uRSr6hVKEAAlwjifVvc"
		HostList         []struct {
			Host    string `json:"host"`     // "zj-cn-live-comet.chat.bilibili.com"
			Port    int    `json:"port"`     // 2243
			WssPort int    `json:"wss_port"` // 2245
			WsPort  int    `json:"ws_port"`  // 2244
		} `json:"host_list"`
	} `json:"data"`
}

func GetDanmuInfo

func GetDanmuInfo(roomid int, credential *Credential) (result DanmuInfoResponse, err error)

获取信息流认证密钥

参数 roomid 为直播间真实 ID

type Del

type Del struct {
	PostCSRF
	*Credential

	// 分组 id
	TagID int `api:"body" req:"tagid"`
}

删除分组

func (Del) RawURL

func (Del) RawURL() string

type DelResponse

type DelResponse struct {
	Error
}

func PostDel

func PostDel(tagid int, credential *Credential) (result DelResponse, err error)

删除分组

type EXPLog

type EXPLog struct {
	req.Get
	*Credential

	JSONP       string `api:"query:jsonp"`
	WebLocation string `api:"query:333.33"`
}

最近一周的经验记录

func (EXPLog) RawURL

func (EXPLog) RawURL() string

type EXPLogResponse

type EXPLogResponse struct {
	Error

	Data struct {
		List []struct {
			Delta  int    `json:"delta"`
			Time   string `json:"time"`
			Reason string `json:"reason"`
		} `json:"list"`
		Count int `json:"count"`
	} `json:"data"`
}

func GetEXPLog

func GetEXPLog(credential *Credential) (result EXPLogResponse, err error)

最近一周的经验记录

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (Error) Error

func (e Error) Error() string

注意 不应该用这个判断是否发生了错误 因为这里无法判断 Code 是否真的是错误 也就是说这里必然会认定为是错误 正确使用为 Error.Unwrap() 方法

func (Error) Unwrap

func (e Error) Unwrap() error

type FetchSessionMsgs

type FetchSessionMsgs struct {
	GetWBI
	*Credential

	// 聊天对象的 ID
	TalkerID int `api:"query"`

	// 聊天对象的类型 (1)用户 (2)粉丝团
	SessionType int `api:"query"`

	// 列出消息条数
	// 最大 2000
	Size int `api:"query"`

	// 发送者设备
	SenderDeviceID int `api:"query:1"`

	// 开始的序列号
	// 默认 0 为全部
	BeginSeqno json.Number `api:"query,omitempty"`

	// 结束的序列号
	// 默认 0 为全部
	EndSeqno json.Number `api:"query,omitempty"`
}

私信消息记录

func (FetchSessionMsgs) RawURL

func (FetchSessionMsgs) RawURL() string

type FetchSessionMsgsResponse

type FetchSessionMsgsResponse struct {
	Error
	Msg  string `json:"msg"`
	Data struct {
		Messages []struct {
			SenderUID      int         `json:"sender_uid"`
			ReceiverType   int         `json:"receiver_type"`
			ReceiverID     int         `json:"receiver_id"`
			MsgType        int         `json:"msg_type"`
			Content        string      `json:"content"`
			MsgSeqno       json.Number `json:"msg_seqno"`
			Timestamp      int         `json:"timestamp"`
			AtUids         []int       `json:"at_uids"`
			MsgKey         int64       `json:"msg_key"`
			MsgStatus      int         `json:"msg_status"`
			NotifyCode     string      `json:"notify_code"`
			NewFaceVersion int         `json:"new_face_version,omitempty"`
		} `json:"messages"`
		HasMore  int         `json:"has_more"`
		MinSeqno json.Number `json:"min_seqno"`
		MaxSeqno json.Number `json:"max_seqno"`
		EInfos   []struct {
			Text string `json:"text"`
			URL  string `json:"url"`
			Size int    `json:"size"`
		} `json:"e_infos"`
	} `json:"data"`
}

func GetFetchSessionMsgs

func GetFetchSessionMsgs(talkerID int, sessionType int, size int, beginSeqno string, credential *Credential) (result FetchSessionMsgsResponse, err error)

私信消息记录

type Followers

type Followers struct {
	req.Get
	*Credential

	// 目标用户 UID
	Vmid int `api:"query"`

	// 分页页数 仅可查看前 1000 名粉丝
	Pn int `api:"query:1"`

	// 分页大小
	Ps int `api:"query:50"`
}

查询用户粉丝明细

func (Followers) RawURL

func (Followers) RawURL() string

func (*Followers) ReadPage

func (api *Followers) ReadPage(v any) (int, error)

type FollowersResponse

type FollowersResponse struct {
	Error
	Data struct {
		List      []RelationItem `json:"list"`
		ReVersion int            `json:"re_version"` // 0
		Total     int            `json:"total"`      // 1057249
	} `json:"data"`
}

func GetFollowers

func GetFollowers(uid int, credential *Credential) (result FollowersResponse, err error)

查询用户粉丝明细

func (FollowersResponse) More

func (r FollowersResponse) More() bool

type FollowingsSearch

type FollowingsSearch struct {
	req.Get
	*Credential

	// 目标用户 UID
	Vmid int `api:"query"`

	// 搜索关键词
	Name string `api:"query"`

	// 分页页数
	Pn int `api:"query:1"`

	// 分页大小
	Ps int `api:"query:50"`
}

搜索关注明细

func (FollowingsSearch) RawURL

func (FollowingsSearch) RawURL() string

func (*FollowingsSearch) ReadPage

func (api *FollowingsSearch) ReadPage(v any) (int, error)

type FollowingsSearchResponse

type FollowingsSearchResponse struct {
	Error
	Data struct {
		List  []RelationItem `json:"list"`
		Total int            `json:"total"` // 1
	} `json:"data"`
}

func GetFollowingsSearch

func GetFollowingsSearch(uid int, name string, credential *Credential) (result FollowingsSearchResponse, err error)

搜索关注明细

func (FollowingsSearchResponse) More

func (r FollowingsSearchResponse) More() bool

type Friends

type Friends struct {
	req.Get
	*Credential
}

查询互相关注明细

func (Friends) RawURL

func (Friends) RawURL() string

type FriendsResponse

type FriendsResponse struct {
	Error
	Data struct {
		List      []RelationItem `json:"list"`
		ReVersion int            `json:"re_version"` // 0
	} `json:"data"`
}

func GetFriends

func GetFriends(credential *Credential) (result FriendsResponse, err error)

查询互相关注明细

type Generate

type Generate struct {
	req.Get
}

申请二维码

func (Generate) RawURL

func (Generate) RawURL() string

type GenerateResponse

type GenerateResponse struct {
	Error
	Data struct {
		URL       string `json:"url"`        // https://account.bilibili.com/h5/account-h5/auth/scan-web?navhide=1&callback=close&qrcode_key=52360fad71935c52ca33f4f24fd18e07&from=
		QRCodeKey string `json:"qrcode_key"` // 52360fad71935c52ca33f4f24fd18e07
	} `json:"data"`
}

func GetGenerate

func GetGenerate() (result GenerateResponse, err error)

申请二维码

type GetWBI

type GetWBI struct{}

需要添加 mixin_key 的 GET 请求

嵌入此字段后不用额外嵌入 MixinKey 字段

func (GetWBI) Method

func (GetWBI) Method() string

func (GetWBI) NewRequestWithContext

func (GetWBI) NewRequestWithContext(ctx context.Context, cli *req.Client, api req.APIData) (r *http.Request, err error)

type HomepageCombine

type HomepageCombine struct {
	req.Get
	*Credential
}

大积分中心信息

func (HomepageCombine) RawURL

func (HomepageCombine) RawURL() string

type HomepageCombineResponse

type HomepageCombineResponse struct {
	Error
	Data struct {
		VipInfo struct {
			Type       int   `json:"type"`         // 2
			Status     int   `json:"status"`       // 1
			DueDate    int64 `json:"due_date"`     // 1797264000000
			VipPayType int   `json:"vip_pay_type"` // 1
			Label      struct {
				Path                  string `json:"path"`                      // "http://i0.hdslb.com/bfs/vip/label_annual.png"
				TextColor             string `json:"text_color"`                // ""
				BgStyle               int    `json:"bg_style"`                  // 0
				BgColor               string `json:"bg_color"`                  // ""
				BorderColor           string `json:"border_color"`              // ""
				UseImgLabel           bool   `json:"use_img_label"`             // false
				ImgLabelURIHans       string `json:"img_label_uri_hans"`        // ""
				ImgLabelURIHant       string `json:"img_label_uri_hant"`        // ""
				ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"` // ""
				ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"` // ""
			} `json:"label"`
			StartTime     int `json:"start_time"`      // 1592710727
			PaidType      int `json:"paid_type"`       // 0
			MID           int `json:"mid"`             // 188888131
			Role          int `json:"role"`            // 3
			TvVipStatus   int `json:"tv_vip_status"`   // 0
			TvVipPayType  int `json:"tv_vip_pay_type"` // 0
			TvDueDate     int `json:"tv_due_date"`     // 0
			VipRecentTime int `json:"vip_recent_time"` // 1728292199
		} `json:"vip_info"`
		Content   string `json:"content"` // ""
		PointInfo struct {
			Point       int `json:"point"`        // 0
			ExpirePoint int `json:"expire_point"` // 0
			ExpireTime  int `json:"expire_time"`  // 0
			ExpireDays  int `json:"expire_days"`  // 0
		} `json:"point_info"`
		Task struct {
			TaskItem []struct {
				TaskCode      string `json:"task_code"`      // "bonus"
				State         int    `json:"state"`          // 1
				Title         string `json:"title"`          // "大会员福利大积分"
				Icon          string `json:"icon"`           // "https://i0.hdslb.com/bfs/activity-plat/static/20220607/b66bfe4ccfd6bed05bdb54008ff5c7aa/IbtMl6R3yt.png"
				Subtitle      string `json:"subtitle"`       // "大会员/年度大会员<br /><span class="active">+100/200大积分"
				Explain       string `json:"explain"`        // "在期大会员可领取100大积分,在期年度大会员可领取200大积分,每人限领1次。如当身份为大会员时已领取过本任务大积分,则后续成为年度大会员也无法补领取差值大积分。"
				VipLimit      int    `json:"vip_limit"`      // 1
				CompleteTimes int    `json:"complete_times"` // 0
				MaxTimes      int    `json:"max_times"`      // 1
				RecallNum     int    `json:"recall_num"`     // 0
				Link          string `json:"link,omitempty"` // "https://www.bilibili.com/h5/mall/home?f_source=vip&navhide=1"
			} `json:"task_item"`
			TaskCount int  `json:"task_count"` // 9
			Signed    bool `json:"signed"`     // false
			Score     int  `json:"score"`      // 5
			ExpValue  int  `json:"exp_value"`  // -1
		} `json:"task"`
		Banner        any `json:"banner"`
		GoodsCategory []struct {
			ID    int    `json:"id"`    // 110
			Name  string `json:"name"`  // "大会员"
			State int    `json:"state"` // 2
		} `json:"goods_category"`
		GoodsSkus []struct {
			Base struct {
				Token            string   `json:"token"`   // "1126774380639117732"
				Title            string   `json:"title"`   // "百草味50元礼盒直减券"
				Picture          string   `json:"picture"` // "https://i0.hdslb.com/bfs/activity-plat/9f7fe43bb6cd1692f10b9c0a2892ea63fc80041e.jpg"
				RotationPictures []string `json:"rotation_pictures"`
				Price            struct {
					Origin    int `json:"origin"` // 188
					Promotion any `json:"promotion"`
					Sale      int `json:"sale"` // 188
				} `json:"price"`
				Inventory struct {
					AvailableNum int `json:"available_num"` // 50000
					UsedNum      int `json:"used_num"`      // 44
					SurplusNum   int `json:"surplus_num"`   // 49956
				} `json:"inventory"`
				UserType          int `json:"user_type"`           // 2
				ExchangeLimitType int `json:"exchange_limit_type"` // 2
				ExchangeLimitNum  int `json:"exchange_limit_num"`  // 5
				StartTime         int `json:"start_time"`          // 1735198320
				EndTime           int `json:"end_time"`            // 1753977599
				State             int `json:"state"`               // 2
				Priority          int `json:"priority"`            // 90
			} `json:"base"`
		} `json:"goods_skus"`
		CurrentTs       int  `json:"current_ts"`       // 1735366429
		IntegrationTask bool `json:"integration_task"` // false
	} `json:"data"`
}

func GetHomepageCombine

func GetHomepageCombine(credential *Credential) (result HomepageCombineResponse, err error)

大积分中心信息

type ImageContent

type ImageContent struct {
	URL      string `json:"url"`                // 图片链接 默认为相簿图片上传通道 也可用三方图床
	Width    int    `json:"width,omitempty"`    // 图片的宽	单位像素 非必要
	Height   int    `json:"height,omitempty"`   // 图片的高	单位像素 非必要
	Type     string `json:"type,omitempty"`     // 图片格式	非必要
	Original int    `json:"original,omitempty"` // 作用未知 默认值 1 非必要
	Size     int    `json:"size,omitempty"`     // 文件大小	单位千字节 非必要
}

图片内容

func (ImageContent) MarshalString

func (c ImageContent) MarshalString() (string, error)

func (ImageContent) MsgType

func (ImageContent) MsgType() int

type Live

type Live struct {
	// 开播状态
	// (0)未开播
	// (1)已开播
	LiveStatus int `json:"live_status"`

	// 直播链接
	JumpURL string `json:"jump_url"`
}

直播信息

type LoginLog

type LoginLog struct {
	req.Get
	*Credential

	JSONP       string `api:"query:jsonp"`
	WebLocation string `api:"query:333.33"`
}

最近一周的登录情况

func (LoginLog) RawURL

func (LoginLog) RawURL() string

type LoginLogResponse

type LoginLogResponse struct {
	Error

	Data struct {
		Count int `json:"count"`
		List  []struct {
			IP     string `json:"ip"`
			Time   int    `json:"time"`
			TimeAt string `json:"time_at"`
			Status bool   `json:"status"`
			Type   int    `json:"type"`
			Geo    string `json:"geo"`
		} `json:"list"`
	} `json:"data"`
}

func GetLoginLog

func GetLoginLog(credential *Credential) (result LoginLogResponse, err error)

最近一周的登录情况

type LoginNotice

type LoginNotice struct {
	req.Get
	*Credential

	// 用户 UID(一般是自己的)
	MID int `api:"query"`

	// 设备虚拟 ID 可为空
	Buvid3 string `api:"query"`
}

查询登录记录

func (LoginNotice) RawURL

func (LoginNotice) RawURL() string

type LoginNoticeResponse

type LoginNoticeResponse struct {
	Error

	Data struct {
		MID        int    `json:"mid"`
		DeviceName string `json:"device_name"`
		LoginType  string `json:"login_type"`
		LoginTime  string `json:"login_time"`
		Location   string `json:"location"`
		IP         string `json:"ip"`
	} `json:"data"`
}

func GetLoginNotice

func GetLoginNotice(credential *Credential) (result LoginNoticeResponse, err error)

查询登录记录

type Masterpiece

type Masterpiece struct {
	req.Get

	// 目标用户 UID
	Vmid int `api:"query"`
}

查询用户代表作视频列表

func (Masterpiece) RawURL

func (Masterpiece) RawURL() string

type MasterpieceCancel

type MasterpieceCancel struct {
	PostCSRF
	*Credential

	// 取消置顶稿件 avid
	// 与 bvid 任选一个
	AID int `api:"body"`

	// 取消置顶稿件 bvid
	// 与 avid 任选一个
	BVID string `api:"body" req:"bvid"`
}

删除代表作视频

func (MasterpieceCancel) RawURL

func (MasterpieceCancel) RawURL() string

type MasterpieceCancelResponse

type MasterpieceCancelResponse struct {
	Error
}

func PostMasterpieceCancel

func PostMasterpieceCancel(bvid string, credential *Credential) (result MasterpieceCancelResponse, err error)

删除代表作视频

type MasterpieceResponse

type MasterpieceResponse struct {
	Error
	Data []VideoInfo `json:"data"`
}

func GetMasterpiece

func GetMasterpiece(uid int) (result MasterpieceResponse, err error)

查询用户代表作视频列表

type MedalWall

type MedalWall struct {
	req.Get
	*Credential

	// 目标 UID
	TargetID int `api:"query"`
}

指定用户的所有粉丝勋章信息

func (MedalWall) RawURL

func (MedalWall) RawURL() string

type MedalWallResponse

type MedalWallResponse struct {
	Error
	Data struct {
		List []struct {
			MedalInfo struct {
				TargetID         int    `json:"target_id"`          // 7706705
				Level            int    `json:"level"`              // 28
				MedalName        string `json:"medal_name"`         // "小孩梓"
				MedalColorStart  int    `json:"medal_color_start"`  // 398668
				MedalColorEnd    int    `json:"medal_color_end"`    // 6850801
				MedalColorBorder int    `json:"medal_color_border"` // 6809855
				GuardLevel       int    `json:"guard_level"`        // 3
				WearingStatus    int    `json:"wearing_status"`     // 1
				MedalID          int    `json:"medal_id"`           // 13139
				Intimacy         int    `json:"intimacy"`           // 66132
				NextIntimacy     int    `json:"next_intimacy"`      // 160000
				TodayFeed        int    `json:"today_feed"`         // 0
				DayLimit         int    `json:"day_limit"`          // 250000
				GuardIcon        string `json:"guard_icon"`         // "https://i0.hdslb.com/bfs/live/143f5ec3003b4080d1b5f817a9efdca46d631945.png"
				HonorIcon        string `json:"honor_icon"`         // ""
			} `json:"medal_info"`
			TargetName string `json:"target_name"` // "阿梓从小就很可爱"
			TargetIcon string `json:"target_icon"` // "https://i2.hdslb.com/bfs/face/217b2cd3d069325244f7f64ff3d75b33c71f43c8.jpg"
			Link       string `json:"link"`        // "https://live.bilibili.com/80397?accept_quality=%5B10000%2C400%2C250%5D&av1_current_qn=0&broadcast_type=0&current_qn=10000&current_quality=10000&h264_current_qn=10000&h265_current_qn=10000&is_room_feed=1&live_from=28013&live_play_network=other&master_url=&p2p_type=-1&playurl_av1=&playurl_h264=http%3A%2F%2F123.234.3.207%2Flive-bvc%2F590881%2Flive_7706705_4063361_bluray.flv%3Fexpires%3D1735143025%26pt%3Dandroid%26deadline%3D1735143025%26len%3D0%26oi%3D1869969956%26platform%3Dandroid%26qn%3D10000%26trid%3D10000cc48f6d1b916d7f07e4c0e4be676c20%26uipk%3D100%26uipv%3D100%26nbs%3D1%26uparams%3Dcdn%2Cdeadline%2Clen%2Coi%2Cplatform%2Cqn%2Ctrid%2Cuipk%2Cuipv%2Cnbs%26cdn%3Dcn-gotcha01%26upsig%3D6e3a89585667751f71d1158bd00b653d%26site%3Df9ee5f4915d5bded29049b85ce6c4bc1%26free_type%3D0%26mid%3D188888131%26sche%3Dban%26sid%3Dcn-sdqd-cu-01-38%26chash%3D1%26bmt%3D1%26sg%3Ddf%26trace%3D4877%26isp%3Dother%26rg%3DNorthEast%26pv%3DLiaoning%26suffix%3Dbluray%26qp%3Dhv_10000%26source%3Dpuv3_batch%26sk%3D1304f646dfeb4df8b6e7ff33c167d3ad491555cae985818bb2a5ec341f048d3d%26deploy_env%3Dprod%26score%3D1%26pp%3Drtmp%26info_source%3Dcache%26hot_cdn%3D909513%26sl%3D4%26p2p_type%3D-1%26origin_bitrate%3D945259%26vd%3Dnc%26zoneid_l%3D151420932%26sid_l%3Dstream_name_cold%26src%3Dpuv3%26order%3D1&playurl_h265=http%3A%2F%2F223.111.250.61%2Flive-bvc%2F534453%2Flive_7706705_4063361_prohevc.flv%3Fexpires%3D1735143025%26pt%3Dandroid%26deadline%3D1735143025%26len%3D0%26oi%3D1869969956%26platform%3Dandroid%26qn%3D10000%26trid%3D10000cc48f6d1b916d7f07e4c0e4be676c20%26uipk%3D100%26uipv%3D100%26nbs%3D1%26uparams%3Dcdn%2Cdeadline%2Clen%2Coi%2Cplatform%2Cqn%2Ctrid%2Cuipk%2Cuipv%2Cnbs%26cdn%3Dcn-gotcha01%26upsig%3Ddf3e1ac3550756b70d49fb6468663495%26site%3Df9ee5f4915d5bded29049b85ce6c4bc1%26free_type%3D0%26mid%3D188888131%26sche%3Dban%26sid%3Dcn-jssz-cm-02-76%26chash%3D1%26bmt%3D1%26sg%3Ddf%26trace%3D13%26isp%3Dother%26rg%3DNorthEast%26pv%3DLiaoning%26pp%3Drtmp%26info_source%3Dcache%26suffix%3Dprohevc%26score%3D57%26deploy_env%3Dprod%26origin_bitrate%3D945259%26p2p_type%3D-1%26qp%3Dhv_10000%26source%3Dpuv3_batch%26sk%3D1304f646dfeb4df8b6e7ff33c167d3ad491555cae985818bb2a5ec341f048d3d%26hot_cdn%3D909513%26sl%3D4%26vd%3Dnc%26zoneid_l%3D151420932%26sid_l%3Dlive_7706705_4063361_prohevc%26src%3Dpuv3%26order%3D1&quality_description=%5B%7B%22qn%22%3A10000%2C%22desc%22%3A%22%E5%8E%9F%E7%94%BB%22%2C%22hdr_type%22%3A0%7D%2C%7B%22qn%22%3A400%2C%22desc%22%3A%22%E8%93%9D%E5%85%89%22%2C%22hdr_type%22%3A0%7D%2C%7B%22qn%22%3A250%2C%22desc%22%3A%22%E8%B6%85%E6%B8%85%22%2C%22hdr_type%22%3A0%7D%5D"
			LiveStatus int    `json:"live_status"` // 1
			Official   int    `json:"official"`    // 1
			UinfoMedal struct {
				Name               string `json:"name"`                  // "小孩梓"
				Level              int    `json:"level"`                 // 28
				ColorStart         int    `json:"color_start"`           // 398668
				ColorEnd           int    `json:"color_end"`             // 6850801
				ColorBorder        int    `json:"color_border"`          // 6809855
				Color              int    `json:"color"`                 // 0
				ID                 int    `json:"id"`                    // 13139
				Typ                int    `json:"typ"`                   // 0
				IsLight            int    `json:"is_light"`              // 1
				RUID               int    `json:"ruid"`                  // 7706705
				GuardLevel         int    `json:"guard_level"`           // 3
				Score              int    `json:"score"`                 // 0
				GuardIcon          string `json:"guard_icon"`            // "https://i0.hdslb.com/bfs/live/143f5ec3003b4080d1b5f817a9efdca46d631945.png"
				HonorIcon          string `json:"honor_icon"`            // ""
				V2MedalColorStart  string `json:"v2_medal_color_start"`  // "#4775EFCC"
				V2MedalColorEnd    string `json:"v2_medal_color_end"`    // "#4775EFCC"
				V2MedalColorBorder string `json:"v2_medal_color_border"` // "#58A1F8FF"
				V2MedalColorText   string `json:"v2_medal_color_text"`   // "#FFFFFFFF"
				V2MedalColorLevel  string `json:"v2_medal_color_level"`  // "#000B7099"
				UserReceiveCount   int    `json:"user_receive_count"`    // 0
			} `json:"uinfo_medal"`
		} `json:"list"`
		Count           int    `json:"count"`             // 1
		CloseSpaceMedal int    `json:"close_space_medal"` // 0
		OnlyShowWearing int    `json:"only_show_wearing"` // 1
		Name            string `json:"name"`              // "七海Nana7mi"
		Icon            string `json:"icon"`              // "https://i2.hdslb.com/bfs/face/3adb26401cfab0fe6b1a0d5b2c09220499108d64.jpg"
		UID             int    `json:"uid"`               // 188888131 (编者著:神金啊怎么返回的是查询者的 UID)
		Level           int    `json:"level"`             // 6
	} `json:"data"`
}

func GetMedalWall

func GetMedalWall(uid int, credential *Credential) (result MedalWallResponse, err error)

指定用户的所有粉丝勋章信息

type MixinKey

type MixinKey struct{}

对于需要添加 mixin_key 的接口 只需要将 MixinKey 嵌入结构体即可

func (MixinKey) NeedMixinKey

func (MixinKey) NeedMixinKey()

type MoralLog

type MoralLog struct {
	req.Get
	*Credential

	JSONP       string `api:"query:jsonp"`
	WebLocation string `api:"query:333.33"`
}

最近一周的节操记录

func (MoralLog) RawURL

func (MoralLog) RawURL() string

type MoralLogResponse

type MoralLogResponse struct {
	Error

	Data struct {
		Moral int           `json:"moral"`
		List  []interface{} `json:"list"`
		Count int           `json:"count"`
	} `json:"data"`
}

func GetMoralLog

func GetMoralLog(credential *Credential) (result MoralLogResponse, err error)

最近一周的节操记录

type Morer

type Morer interface {
	More() bool
}

判断是否还有新内容

type MoveUsers

type MoveUsers struct {
	PostCSRF
	*Credential

	// 原分组 id 列表 用(,)间隔
	BeforeTagIDs string `api:"body" req:"beforeTagids"`

	// 新分组 id 列表 用(,)间隔
	AfterTagIDs string `api:"body" req:"afterTagids"`

	// 待移动用户 UID 用(,)间隔
	FIDs string `api:"query"`
}

移动关注到分组

func (MoveUsers) RawURL

func (MoveUsers) RawURL() string

type MoveUsersResponse

type MoveUsersResponse struct {
	Error
}

func PostMoveUsers

func PostMoveUsers(uid, beforeTagid, afterTagid []int, credential *Credential) (result MoveUsersResponse, err error)

移动关注到分组

type My

type My struct {
	req.Get
	*Credential
}

卡券状态查询

func (My) RawURL

func (My) RawURL() string

type MyInfo

type MyInfo struct {
	req.Get
	*Credential
}

登录用户空间详细信息

func (MyInfo) RawURL

func (MyInfo) RawURL() string

type MyInfoResponse

type MyInfoResponse struct {
	Error
	Data struct {
		MID            int    `json:"mid"`            // 188888131
		Name           string `json:"name"`           // "脆鲨12138"
		Sex            string `json:"sex"`            // "女"
		Face           string `json:"face"`           // "https://i1.hdslb.com/bfs/face/86faab4844dd2c45870fdafa8f2c9ce7be3e999f.jpg"
		Sign           string `json:"sign"`           // "虚拟艺人团体Vcslive成员,喜欢宅在家打游戏的脆鲨12138!!!"
		Rank           int    `json:"rank"`           // 10000
		Level          int    `json:"level"`          // 6
		Jointime       int    `json:"jointime"`       // 0
		Moral          int    `json:"moral"`          // 70
		Silence        int    `json:"silence"`        // 0
		EmailStatus    int    `json:"email_status"`   // 0
		TelStatus      int    `json:"tel_status"`     // 1
		Identification int    `json:"identification"` // 1
		Vip            struct {
			Type       int   `json:"type"`         // 2
			Status     int   `json:"status"`       // 1
			DueDate    int64 `json:"due_date"`     // 1797264000000
			VipPayType int   `json:"vip_pay_type"` // 1
			ThemeType  int   `json:"theme_type"`   // 0
			Label      struct {
				Path                  string `json:"path"`                      // ""
				Text                  string `json:"text"`                      // "年度大会员"
				LabelTheme            string `json:"label_theme"`               // "annual_vip"
				TextColor             string `json:"text_color"`                // "#FFFFFF"
				BgStyle               int    `json:"bg_style"`                  // 1
				BgColor               string `json:"bg_color"`                  // "#FB7299"
				BorderColor           string `json:"border_color"`              // ""
				UseImgLabel           bool   `json:"use_img_label"`             // true
				ImgLabelURIHans       string `json:"img_label_uri_hans"`        // ""
				ImgLabelURIHant       string `json:"img_label_uri_hant"`        // ""
				ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"` // "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png"
				ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"` // "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png"
			} `json:"label"`
			AvatarSubscript    int    `json:"avatar_subscript"`     // 1
			NicknameColor      string `json:"nickname_color"`       // "#FB7299"
			Role               int    `json:"role"`                 // 3
			AvatarSubscriptURL string `json:"avatar_subscript_url"` // ""
			TvVipStatus        int    `json:"tv_vip_status"`        // 0
			TvVipPayType       int    `json:"tv_vip_pay_type"`      // 0
			TvDueDate          int    `json:"tv_due_date"`          // 0
			AvatarIcon         struct {
				IconType     int `json:"icon_type"` // 1
				IconResource struct {
				} `json:"icon_resource"`
			} `json:"avatar_icon"`
		} `json:"vip"`
		Pendant struct {
			PID               int    `json:"pid"`                 // 4820
			Name              string `json:"name"`                // "七海演唱会"
			Image             string `json:"image"`               // "https://i1.hdslb.com/bfs/garb/item/7061b098537482bb78242a16cba5d44b426b429d.png"
			Expire            int    `json:"expire"`              // 0
			ImageEnhance      string `json:"image_enhance"`       // "https://i1.hdslb.com/bfs/garb/item/7061b098537482bb78242a16cba5d44b426b429d.png"
			ImageEnhanceFrame string `json:"image_enhance_frame"` // ""
			NPID              int    `json:"n_pid"`               // 4820
		} `json:"pendant"`
		Nameplate struct {
			NID        int    `json:"nid"`         // 62
			Name       string `json:"name"`        // "有爱大佬"
			Image      string `json:"image"`       // "https://i0.hdslb.com/bfs/face/a10ee6b613e0d68d2dfdac8bbf71b94824e10408.png"
			ImageSmall string `json:"image_small"` // "https://i0.hdslb.com/bfs/face/54f4c31ab9b1f1fa2c29dbbc967f66535699337e.png"
			Level      string `json:"level"`       // "普通勋章"
			Condition  string `json:"condition"`   // "当前持有粉丝勋章最高等级>=15级"
		} `json:"nameplate"`
		Official struct {
			Role  int    `json:"role"`  // 0
			Title string `json:"title"` // ""
			Desc  string `json:"desc"`  // ""
			Type  int    `json:"type"`  // -1
		} `json:"official"`
		Birthday      int  `json:"birthday"`
		IsTourist     int  `json:"is_tourist"`      // 0
		IsFakeAccount int  `json:"is_fake_account"` // 0
		PinPrompting  int  `json:"pin_prompting"`   // 0
		IsDeleted     int  `json:"is_deleted"`      // 0
		InRegAudit    int  `json:"in_reg_audit"`    // 0
		IsRipUser     bool `json:"is_rip_user"`     // false
		Profession    struct {
			ID              int    `json:"id"`               // 0
			Name            string `json:"name"`             // ""
			ShowName        string `json:"show_name"`        // ""
			IsShow          int    `json:"is_show"`          // 0
			CategoryOne     string `json:"category_one"`     // ""
			Realname        string `json:"realname"`         // ""
			Title           string `json:"title"`            // ""
			Department      string `json:"department"`       // ""
			CertificateNo   string `json:"certificate_no"`   // ""
			CertificateShow bool   `json:"certificate_show"` // false
		} `json:"profession"`
		FaceNft        int `json:"face_nft"`         // 0
		FaceNftNew     int `json:"face_nft_new"`     // 0
		IsSeniorMember int `json:"is_senior_member"` // 0
		Honours        struct {
			MID    int `json:"mid"` // 188888131
			Colour struct {
				Dark   string `json:"dark"`   // "#CE8620"
				Normal string `json:"normal"` // "#F0900B"
			} `json:"colour"`
			Tags              any `json:"tags"`
			IsLatest100Honour int `json:"is_latest_100honour"` // 0
		} `json:"honours"`
		DigitalID   string `json:"digital_id"`   // ""
		DigitalType int    `json:"digital_type"` // -2
		Attestation struct {
			Type       int `json:"type"` // 0
			CommonInfo struct {
				Title       string `json:"title"`        // ""
				Prefix      string `json:"prefix"`       // ""
				PrefixTitle string `json:"prefix_title"` // ""
			} `json:"common_info"`
			SpliceInfo struct {
				Title string `json:"title"` // ""
			} `json:"splice_info"`
			Icon string `json:"icon"` // ""
			Desc string `json:"desc"` // ""
		} `json:"attestation"`
		ExpertInfo struct {
			Title string `json:"title"` // ""
			State int    `json:"state"` // 0
			Type  int    `json:"type"`  // 0
			Desc  string `json:"desc"`  // ""
		} `json:"expert_info"`
		NameRender  any    `json:"name_render"`
		CountryCode string `json:"country_code"` // "86"
		LevelExp    struct {
			CurrentLevel int   `json:"current_level"` // 6
			CurrentMin   int   `json:"current_min"`   // 28800
			CurrentExp   int   `json:"current_exp"`   // 48539
			NextExp      int   `json:"next_exp"`      // -1
			LevelUp      int64 `json:"level_up"`      // -62135596800
		} `json:"level_exp"`
		Coins     float64 `json:"coins"`     // 1547.8
		Following int     `json:"following"` // 6601
		Follower  int     `json:"follower"`  // 6601
	} `json:"data"`
}

func GetMyInfo

func GetMyInfo(credential *Credential) (result MyInfoResponse, err error)

登录用户空间详细信息

type MyResponse

type MyResponse struct {
	Error
	Data struct {
		List []struct {
			Type            int    `json:"type"`              // 1
			State           int    `json:"state"`             // 0
			ExpireTime      int    `json:"expire_time"`       // 0
			VipType         int    `json:"vip_type"`          // 2
			NextReceiveDays int    `json:"next_receive_days"` // 21
			PeriodEndUnix   int    `json:"period_end_unix"`   // 1737129600
			IsCount         bool   `json:"is_count"`          // true
			Name            string `json:"name"`              // ""
			CouponCode      string `json:"coupon_code"`       // ""
			AppDescribe     string `json:"app_describe"`      // ""
			ReciveState     int    `json:"recive_state"`      // 1
			SalaryType      int    `json:"salary_type"`       // 0
			ExpParams       struct {
				ExpGroupTag string `json:"exp_group_tag"` // "45476"
				HitValue    int    `json:"hit_value"`     // 2
			} `json:"exp_params"`
			ExtraParams any `json:"extra_params"`
		} `json:"list"`
		IsShortVip     bool   `json:"is_short_vip"`     // false
		IsFreightOpen  bool   `json:"is_freight_open"`  // true
		Level          int    `json:"level"`            // 6
		CurExp         int    `json:"cur_exp"`          // 48579
		NextExp        int    `json:"next_exp"`         // -1
		IsVip          bool   `json:"is_vip"`           // true
		IsSeniorMember int    `json:"is_senior_member"` // 0
		Format060102   int    `json:"format060102"`     // 241218
		IsOverdueVip   bool   `json:"is_overdue_vip"`   // false
		VipStatus      int    `json:"vip_status"`       // 1
		VipType        int    `json:"vip_type"`         // 2
		KeeptimeEnd    int    `json:"keeptime_end"`     // 1737129600
		VipDueDate     int    `json:"vip_due_date"`     // 1797264000
		VipIsAnnual    bool   `json:"vip_is_annual"`    // true
		VipIsMonth     bool   `json:"vip_is_month"`     // false
		VipIsNewUser   bool   `json:"vip_is_new_user"`  // false
		BindPhone      string `json:"bind_phone"`
		TaobaoAccount  any    `json:"taobao_account"`
	} `json:"data"`
}

func GetMy

func GetMy(credential *Credential) (result MyResponse, err error)

卡券状态查询

type Nav struct {
	req.Get
	*Credential
}

导航栏用户信息

func (Nav) RawURL() string
type NavNum struct {
	req.Get

	// 目标用户 UID
	MID int `api:"query"`
}

用户导航栏状态数

但是不知道为什么被禁止访问了

错误号:412 由于触发哔哩哔哩安全风控策略,该次访问请求被拒绝。 The request was rejected because of the bilibili security control policy.

func (NavNum) RawURL() string
type NavResponse struct {
	Error
	Data struct {
		IsLogin       bool   `json:"isLogin"` // false
		EmailVerified int    `json:"email_verified"`
		Face          string `json:"face"`
		FaceNft       int    `json:"face_nft"`
		FaceNftType   int    `json:"face_nft_type"`
		LevelInfo     struct {
			CurrentLevel int    `json:"current_level"`
			CurrentMin   int    `json:"current_min"`
			CurrentExp   int    `json:"current_exp"`
			NextExp      string `json:"next_exp"`
		} `json:"level_info"`
		MID            int     `json:"mid"`
		MobileVerified int     `json:"mobile_verified"`
		Money          float64 `json:"money"`
		Moral          int     `json:"moral"`
		Official       struct {
			Role  int    `json:"role"`
			Title string `json:"title"`
			Desc  string `json:"desc"`
			Type  int    `json:"type"`
		} `json:"official"`
		OfficialVerify struct {
			Type int    `json:"type"`
			Desc string `json:"desc"`
		} `json:"officialVerify"`
		Pendant struct {
			PID               int    `json:"pid"`
			Name              string `json:"name"`
			Image             string `json:"image"`
			Expire            int    `json:"expire"`
			ImageEnhance      string `json:"image_enhance"`
			ImageEnhanceFrame string `json:"image_enhance_frame"`
			NPID              int    `json:"n_pid"`
		} `json:"pendant"`
		Scores       int    `json:"scores"`
		Uname        string `json:"uname"`
		VipDueDate   int64  `json:"vipDueDate"`
		VipStatus    int    `json:"vipStatus"`
		VipType      int    `json:"vipType"`
		VipPayType   int    `json:"vip_pay_type"`
		VipThemeType int    `json:"vip_theme_type"`
		VipLabel     struct {
			Path                  string `json:"path"`
			Text                  string `json:"text"`
			LabelTheme            string `json:"label_theme"`
			TextColor             string `json:"text_color"`
			BgStyle               int    `json:"bg_style"`
			BgColor               string `json:"bg_color"`
			BorderColor           string `json:"border_color"`
			UseImgLabel           bool   `json:"use_img_label"`
			ImgLabelURIHans       string `json:"img_label_uri_hans"`
			ImgLabelURIHant       string `json:"img_label_uri_hant"`
			ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"`
			ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"`
		} `json:"vip_label"`
		VipAvatarSubscript int    `json:"vip_avatar_subscript"`
		VipNicknameColor   string `json:"vip_nickname_color"`
		Vip                struct {
			Type       int   `json:"type"`
			Status     int   `json:"status"`
			DueDate    int64 `json:"due_date"`
			VipPayType int   `json:"vip_pay_type"`
			ThemeType  int   `json:"theme_type"`
			Label      struct {
				Path                  string `json:"path"`
				Text                  string `json:"text"`
				LabelTheme            string `json:"label_theme"`
				TextColor             string `json:"text_color"`
				BgStyle               int    `json:"bg_style"`
				BgColor               string `json:"bg_color"`
				BorderColor           string `json:"border_color"`
				UseImgLabel           bool   `json:"use_img_label"`
				ImgLabelURIHans       string `json:"img_label_uri_hans"`
				ImgLabelURIHant       string `json:"img_label_uri_hant"`
				ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"`
				ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"`
			} `json:"label"`
			AvatarSubscript    int    `json:"avatar_subscript"`
			NicknameColor      string `json:"nickname_color"`
			Role               int    `json:"role"`
			AvatarSubscriptURL string `json:"avatar_subscript_url"`
			TvVipStatus        int    `json:"tv_vip_status"`
			TvVipPayType       int    `json:"tv_vip_pay_type"`
			TvDueDate          int    `json:"tv_due_date"`
			AvatarIcon         struct {
				IconType     int `json:"icon_type"`
				IconResource struct {
				} `json:"icon_resource"`
			} `json:"avatar_icon"`
		} `json:"vip"`
		Wallet struct {
			MID           int `json:"mid"`
			BcoinBalance  int `json:"bcoin_balance"`
			CouponBalance int `json:"coupon_balance"`
			CouponDueTime int `json:"coupon_due_time"`
		} `json:"wallet"`
		HasShop        bool   `json:"has_shop"`
		ShopURL        string `json:"shop_url"`
		AllowanceCount int    `json:"allowance_count"`
		AnswerStatus   int    `json:"answer_status"`
		IsSeniorMember int    `json:"is_senior_member"`
		WbiImg         struct {
			ImgURL string `json:"img_url"` // https://i0.hdslb.com/bfs/wbi/7cd084941338484aae1ad9425b84077c.png
			SubURL string `json:"sub_url"` // https://i0.hdslb.com/bfs/wbi/4932caff0ff746eab6f01bf08b70ac45.png
		} `json:"wbi_img"`
		IsJury     bool        `json:"is_jury"`
		NameRender interface{} `json:"name_render"`
	} `json:"data"`
}

完整返回值结构

type NavResponseSimple struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		IsLogin bool `json:"isLogin"` // false
		WbiImg  struct {
			ImgURL string `json:"img_url"` // https://i0.hdslb.com/bfs/wbi/7cd084941338484aae1ad9425b84077c.png
			SubURL string `json:"sub_url"` // https://i0.hdslb.com/bfs/wbi/4932caff0ff746eab6f01bf08b70ac45.png
		} `json:"wbi_img"`
	} `json:"data"`
}

未登录返回值结构

func GetNav

func GetNav(credential *Credential) (result NavResponseSimple, err error)

导航栏用户信息

type NavStat struct {
	req.Get
	*Credential
}

登录用户状态数

func (NavStat) RawURL() string
type NavStatResponse struct {
	Error

	Data struct {
		Following    int `json:"following"`
		Follower     int `json:"follower"`
		DynamicCount int `json:"dynamic_count"`
	} `json:"data"`
}

func GetNavStat

func GetNavStat(credential *Credential) (result NavStatResponse, err error)

登录用户状态数

type NeedAccessID

type NeedAccessID interface {
	NeedAccessID()
}

type NeedMixinKey

type NeedMixinKey interface {
	NeedMixinKey()
}

type Notice

type Notice struct {
	req.Get

	// 用户 UID
	MID int `api:"query"`
}

查看用户空间公告

func (Notice) RawURL

func (Notice) RawURL() string

type NoticeResponse

type NoticeResponse struct {
	Error
	Data string `json:"data"` // "新浪微博:七海Nana7mi"
}

func GetNotice

func GetNotice(uid int) (result NoticeResponse, err error)

查看用户空间公告

type NoticeSet

type NoticeSet struct {
	PostCSRF
	*Credential

	// 要设置的公告内容
	Notice string `api:"body"`
}

修改空间公告

func (NoticeSet) RawURL

func (NoticeSet) RawURL() string

type NoticeSetResponse

type NoticeSetResponse struct {
	Error
}

func PostNoticeSet

func PostNoticeSet(notice string, credential *Credential) (result NoticeSetResponse, err error)

修改空间公告

type Now

type Now struct {
	req.Get
}

获取当前时间戳

func (Now) RawURL

func (Now) RawURL() string

type NowResponse

type NowResponse struct {
	Error
	Data struct {
		Now int `json:"now"` // 1735223842
	} `json:"data"`
}

func GetNow

func GetNow() (result NowResponse, err error)

获取当前时间戳

type OfficialVerify

type OfficialVerify struct {
	// 用户认证类型
	// (-1)无
	// (0)UP 主认证
	// (1)机构认证
	Type int `json:"type"`

	// 用户认证信息
	Desc string `json:"desc"`
}

认证信息

type PageReader

type PageReader interface {
	// 将当前页读取至入参中并返回页码和可能产生的错误
	// 完成读取后应当改变页码 下次调用这个方法时能返回新的值
	ReadPage(any) (page int, err error)
}

页读器

type Poll

type Poll struct {
	req.Get
	*Credential

	// 先前生成的二维码密钥
	QRCodeKey string `api:"query" req:"qrcode_key"`
}

扫码登录

登录成功后会自动将 Cookie 值写入该结构体的 *Credential 字段中

func (Poll) RawURL

func (Poll) RawURL() string

type PollResponse

type PollResponse struct {
	Error
	Data struct {
		Error
		URL          string `json:"url"`
		RefreshToken string `json:"refresh_token"`
		Timestamp    int    `json:"timestamp"`
	} `json:"data"`
}

func GetPoll

func GetPoll(qrcodeKey string, credential *Credential) (result PollResponse, err error)

登录成功后会自动将 Cookie 值写入 credential 变量中

func (PollResponse) Unwrap

func (r PollResponse) Unwrap() error

type PostCSRF

type PostCSRF struct{}

func (PostCSRF) Method

func (PostCSRF) Method() string

func (PostCSRF) NewRequestWithContext

func (PostCSRF) NewRequestWithContext(ctx context.Context, cli *req.Client, api req.APIData) (r *http.Request, err error)

type QueryRelation

type QueryRelation struct {
	// 目标用户 UID
	MID int `json:"mid"`

	// 关系属性
	// (0)未关注
	// (2)已关注
	// (6)已互粉
	// (128)已拉黑
	Attribute int `json:"attribute"`

	// 关注对方时间 秒级时间戳
	Mtime int `json:"mtime"`

	// 分组 id
	Tag []int `json:"tag"`

	// 特别关注标志
	// (0)否
	// (1)是
	Special int `json:"special"`
}

查询关系属性

type RealnameStatus

type RealnameStatus struct {
	req.Get
	*Credential
}

查询账号实名认证状态

func (RealnameStatus) RawURL

func (RealnameStatus) RawURL() string

type RealnameStatusResponse

type RealnameStatusResponse struct {
	Error

	Data struct {
		Status int `json:"status"`
	} `json:"data"`
}

func GetRealnameStatus

func GetRealnameStatus(credential *Credential) (result RealnameStatusResponse, err error)

查询账号实名认证状态

type Relation

type Relation struct {
	req.Get
	*Credential

	// 目标用户 UID
	FID int `api:"query"`
}

查询用户与自己关系(仅关注)

func (Relation) RawURL

func (Relation) RawURL() string

type RelationFollowings

type RelationFollowings struct {
	req.Get
	*Credential

	// 目标用户 UID
	Vmid int `api:"query"`

	// 排序方式 当目标用户为自己时有效
	// ("")按照关注顺序排列
	// ("attention")按照最常访问排列
	OrderType string `api:"query,omitempty"`

	// 分页页数
	Pn int `api:"query:1"`

	// 分页大小
	Ps int `api:"query:50"`
}

查询用户关注明细

func (RelationFollowings) RawURL

func (RelationFollowings) RawURL() string

func (*RelationFollowings) ReadPage

func (api *RelationFollowings) ReadPage(v any) (int, error)

type RelationFollowingsResponse

type RelationFollowingsResponse struct {
	Error
	Data struct {
		List      []RelationItem `json:"list"`
		ReVersion int            `json:"re_version"` // 0
		Total     int            `json:"total"`      // 207
	} `json:"data"`
}

func GetRelationFollowings

func GetRelationFollowings(uid int, credential *Credential) (result RelationFollowingsResponse, err error)

查询用户关注明细

func (RelationFollowingsResponse) More

type RelationItem

type RelationItem struct {
	// 用户 UID
	MID int64 `json:"mid"`

	// 对方对于自己的关系属性
	// (0)未关注
	// (1)悄悄关注(现已下线)
	// (2)已关注
	// (6)已互粉
	// (128)已拉黑
	Attribute int `json:"attribute"`

	// 对方关注目标用户时间
	// 秒级时间戳 互关后刷新
	Mtime int `json:"mtime"`

	// 目标用户将对方分组到的 id
	Tag []int `json:"tag"`

	// 特别关注标志
	// (0)否
	// (1)是
	Special int `json:"special"`

	// 契约计划相关信息
	ContractInfo ContractInfo `json:"contract_info"`

	// 用户昵称
	Uname string `json:"uname"`

	// 用户头像 URL
	Face string `json:"face"`

	// 用户签名
	Sign string `json:"sign"`

	// 是否为 NFT 头像
	// (0)非 NFT 头像
	// (1)是 NFT 头像
	FaceNFT int `json:"face_nft"`

	// 认证信息
	OfficialVerify OfficialVerify `json:"official_verify"`

	// 会员信息
	VIP VIP `json:"vip"`

	// 直播信息
	Live Live `json:"live"`

	NameRender struct {
	} `json:"name_render"`
	NFTIcon    string `json:"nft_icon"`
	RecReason  string `json:"rec_reason"`
	TrackID    string `json:"track_id"`
	FollowTime string `json:"follow_time"`
}

关系列表对象

func (RelationItem) String

func (r RelationItem) String() string

type RelationModify

type RelationModify struct {
	PostCSRF
	*Credential
}

操作用户关系

func (RelationModify) RawURL

func (RelationModify) RawURL() string

type RelationResponse

type RelationResponse struct {
	Error
	Data QueryRelation `json:"data"`
}

func GetRelation

func GetRelation(uid int, credential *Credential) (result RelationResponse, err error)

查询用户与自己关系(仅关注)

type RelationStat

type RelationStat struct {
	req.Get
	*Credential

	// 目标用户 UID
	Vmid int `api:"query"`
}

关系状态数

func (RelationStat) RawURL

func (RelationStat) RawURL() string

type RelationStatResponse

type RelationStatResponse struct {
	Error
	Data struct {
		MID       int `json:"mid"`       // 434334701
		Following int `json:"following"` // 592
		Whisper   int `json:"whisper"`   // 0
		Black     int `json:"black"`     // 0
		Follower  int `json:"follower"`  // 1057173
	} `json:"data"`
}

func GetRelationStat

func GetRelationStat(uid int, credential *Credential) (result RelationStatResponse, err error)

关系状态数

type Relations

type Relations struct {
	req.Get
	*Credential

	// 目标用户 UID 用(,)间隔
	FIDs string `api:"query"`
}

批量查询用户与自己关系

func (Relations) RawURL

func (Relations) RawURL() string

type RelationsResponse

type RelationsResponse struct {
	Error
	Data map[string]QueryRelation `json:"data"`
}

func GetRelations

func GetRelations(uid []int, credential *Credential) (result RelationsResponse, err error)

批量查询用户与自己关系

type Reward

type Reward struct {
	req.Get
	*Credential
}

查询每日奖励状态

func (Reward) RawURL

func (Reward) RawURL() string

type RewardResponse

type RewardResponse struct {
	Error

	Data struct {
		Login        bool `json:"login"`
		Watch        bool `json:"watch"`
		Coins        int  `json:"coins"`
		Share        bool `json:"share"`
		Email        bool `json:"email"`
		Tel          bool `json:"tel"`
		SafeQuestion bool `json:"safe_question"`
		IdentifyCard bool `json:"identify_card"`
	} `json:"data"`
}

func GetReward

func GetReward(credential *Credential) (result RewardResponse, err error)

查询每日奖励状态

type RoomInfo

type RoomInfo struct {
	req.Get

	// 直播间号	可以为短号
	RoomID int `api:"query"`
}

获取直播间信息

func (RoomInfo) RawURL

func (RoomInfo) RawURL() string

type RoomInfoResponse

type RoomInfoResponse struct {
	Error
	Msg  string `json:"msg"` // "ok"
	Data struct {
		UID              int      `json:"uid"`         // 434334701
		RoomID           int      `json:"room_id"`     // 21452505
		ShortID          int      `json:"short_id"`    // 0
		Attention        int      `json:"attention"`   // 1057100
		Online           int      `json:"online"`      // 0
		IsPortrait       bool     `json:"is_portrait"` // false
		Description      string   `json:"description"`
		LiveStatus       int      `json:"live_status"`        // 0
		AreaID           int      `json:"area_id"`            // 745
		ParentAreaID     int      `json:"parent_area_id"`     // 9
		ParentAreaName   string   `json:"parent_area_name"`   // "虚拟主播"
		OldAreaID        int      `json:"old_area_id"`        // 6
		Background       string   `json:"background"`         // "https://i0.hdslb.com/bfs/live/636d66a97d5f55099a9d8d6813558d6d4c95fd61.jpg"
		Title            string   `json:"title"`              // "看看大家的24年最值购物"
		UserCover        string   `json:"user_cover"`         // "https://i0.hdslb.com/bfs/live/new_room_cover/ef9375fd23aefb03e3c2fd48934fa51a30caacbc.jpg"
		Keyframe         string   `json:"keyframe"`           // ""
		IsStrictRoom     bool     `json:"is_strict_room"`     // false
		LiveTime         string   `json:"live_time"`          // "0000-00-00 00:00:00"
		Tags             string   `json:"tags"`               // "七海,海子姐,VirtuaReal"
		IsAnchor         int      `json:"is_anchor"`          // 0
		RoomSilentType   string   `json:"room_silent_type"`   // ""
		RoomSilentLevel  int      `json:"room_silent_level"`  // 0
		RoomSilentSecond int      `json:"room_silent_second"` // 0
		AreaName         string   `json:"area_name"`          // "虚拟Gamer"
		Pendants         string   `json:"pendants"`           // ""
		AreaPendants     string   `json:"area_pendants"`      // ""
		HotWords         []string `json:"hot_words"`
		HotWordsStatus   int      `json:"hot_words_status"` // 0
		Verify           string   `json:"verify"`           // ""
		NewPendants      struct {
			Frame struct {
				Name       string `json:"name"`         // "长红计划-Topstar"
				Value      string `json:"value"`        // "https://i0.hdslb.com/bfs/live/62e62f657d379aaaec2bbd4a6a16a938bcba76e6.png"
				Position   int    `json:"position"`     // 0
				Desc       string `json:"desc"`         // ""
				Area       int    `json:"area"`         // 0
				AreaOld    int    `json:"area_old"`     // 0
				BgColor    string `json:"bg_color"`     // ""
				BgPic      string `json:"bg_pic"`       // ""
				UseOldArea bool   `json:"use_old_area"` // false
			} `json:"frame"`
			Badge struct {
				Name     string `json:"name"`     // "v_person"
				Position int    `json:"position"` // 3
				Value    string `json:"value"`    // ""
				Desc     string `json:"desc"`     // "虚拟UP主、bilibili直播高能主播"
			} `json:"badge"`
			MobileFrame struct {
				Name       string `json:"name"`         // "长红计划-Topstar"
				Value      string `json:"value"`        // "https://i0.hdslb.com/bfs/live/62e62f657d379aaaec2bbd4a6a16a938bcba76e6.png"
				Position   int    `json:"position"`     // 0
				Desc       string `json:"desc"`         // ""
				Area       int    `json:"area"`         // 0
				AreaOld    int    `json:"area_old"`     // 0
				BgColor    string `json:"bg_color"`     // ""
				BgPic      string `json:"bg_pic"`       // ""
				UseOldArea bool   `json:"use_old_area"` // false
			} `json:"mobile_frame"`
			MobileBadge any `json:"mobile_badge"`
		} `json:"new_pendants"`
		UpSession            string `json:"up_session"`              // ""
		PkStatus             int    `json:"pk_status"`               // 0
		PkID                 int    `json:"pk_id"`                   // 0
		BattleID             int    `json:"battle_id"`               // 0
		AllowChangeAreaTime  int    `json:"allow_change_area_time"`  // 0
		AllowUploadCoverTime int    `json:"allow_upload_cover_time"` // 0
		StudioInfo           struct {
			Status     int   `json:"status"` // 0
			MasterList []any `json:"master_list"`
		} `json:"studio_info"`
	} `json:"data"`
}

func GetRoomInfo

func GetRoomInfo(roomid int) (result RoomInfoResponse, err error)

获取直播间信息

type SPI

type SPI struct {
	req.Get
}

接口获取 buvid3 / buvid4

func (SPI) RawURL

func (SPI) RawURL() string

type SPIResponse

type SPIResponse struct {
	Error
	Data struct {
		B3 string `json:"b_3"` // "E225B4F4-615F-F3D4-6AD3-EA4CDD9B3D5389718infoc"
		B4 string `json:"b_4"` // "160D49C2-BDF9-6152-15B5-3607E9641BF789718-024122614-kzVGhgiChnkj56LAFFA0BA=="
	} `json:"data"`
}

func GetSPI

func GetSPI() (result SPIResponse, err error)

接口获取 buvid3 / buvid4

type SameFollowings

type SameFollowings struct {
	req.Get
	*Credential

	// 目标用户 UID
	Vmid int `api:"query"`

	// 分页页数
	Pn int `api:"query:1"`

	// 分页大小
	Ps int `api:"query:50"`
}

查询共同关注明细

func (SameFollowings) RawURL

func (SameFollowings) RawURL() string

func (*SameFollowings) ReadPage

func (api *SameFollowings) ReadPage(v any) (int, error)

type SameFollowingsResponse

type SameFollowingsResponse struct {
	Error
	Data struct {
		List      []RelationItem `json:"list"`
		ReVersion string         `json:"re_version"` // ""
		Total     int            `json:"total"`      // 7
	} `json:"data"`
}

func GetSameFollowings

func GetSameFollowings(uid int, credential *Credential) (result SameFollowingsResponse, err error)

查询共同关注明细

func (SameFollowingsResponse) More

func (r SameFollowingsResponse) More() bool

type SendMsg

type SendMsg struct {
	PostCSRF
	MixinKey
	*Credential

	// 发送者 UID
	WSenderUID int `api:"query"`

	// 接收者 UID
	WReceiverID int `api:"query"`

	// 发送者 UID
	SenderUID int `api:"body" req:"msg[sender_uid]"`

	// 接收者 UID
	ReceiverID int `api:"body" req:"msg[receiver_id]"`

	// 固定为 1
	ReceiverType int `api:"body:1" req:"msg[receiver_type]"`

	// 消息类型 详见 content.go
	MsgType int `api:"body" req:"msg[msg_type]"`

	// 设备信息
	DeviceID string `api:"body:88A68CB6-CEFC-49BE-87DE-D2A22E549C1E" req:"msg[dev_id]"`

	// 秒级时间戳
	Timestamp int `api:"body" req:"msg[timestamp]"`

	// 消息内容
	Content Content `api:"body" req:"msg[content]"`

	// 未知 非必要
	MsgStatus int `api:"body:0" req:"msg[msg_status]"`

	// 表情包版本 非必要
	NewFaceVersion int `api:"body:0" req:"msg[new_face_version]"`
}

发送私信

不知道叔叔发什么颠要求 query 和 body 都要写收发方 UID 猜测是为了加上 WBI 验证 因为这个验证是用 query 里的字段进行的

func (SendMsg) RawURL

func (SendMsg) RawURL() string

type SendMsgResponse

type SendMsgResponse struct {
	Error

	Data struct {
		MsgKey int64 `json:"msg_key"`
		EInfos []struct {
			Text string `json:"text"`
			URL  string `json:"url"`
			Size int    `json:"size"`
		} `json:"e_infos"`
		MsgContent  string `json:"msg_content"`
		KeyHitInfos struct {
		} `json:"key_hit_infos"`
	} `json:"data"`
}

func PostSendMsg

func PostSendMsg(receiver int, content Content, credential *Credential) (result SendMsgResponse, err error)

发送私信

type Set

type Set struct {
	PostCSRF
	*Credential

	// 置顶目标稿件 avid
	// 与 bvid 任选一个
	AID int `api:"body"`

	// 置顶目标稿件 bvid
	// 与 avid 任选一个
	BVID string `api:"body" req:"bvid"`

	// 置顶视频备注 最大 40 字符
	Reason string `api:"body"`
}

设置置顶视频

func (Set) RawURL

func (Set) RawURL() string

type SetResponse

type SetResponse struct {
	Error
}

func PostSet

func PostSet(bvid, reason string, credential *Credential) (result SetResponse, err error)

设置置顶视频

type SetToutu

type SetToutu struct {
	PostCSRF
	*Credential

	// 头图 ID
	ID int `api:"body"`
}

设置空间头图 (Web端)

func (SetToutu) RawURL

func (SetToutu) RawURL() string

type SetToutuResponse

type SetToutuResponse struct {
	Status bool   `json:"status"`
	Data   string `json:"data"`
}

func PostSetToutu

func PostSetToutu(id int, credential *Credential) (result SetToutuResponse, err error)

设置空间头图 (Web端)

type Settings

type Settings struct {
	req.Get

	// 用户 UID
	MID int `api:"query"`
}

查询空间设置

func (Settings) RawURL

func (Settings) RawURL() string

type SettingsResponse

type SettingsResponse struct {
	Status bool `json:"status"` // true
	Data   struct {
		Privacy struct {
			Bangumi           int `json:"bangumi"`             // 0
			Bbq               int `json:"bbq"`                 // 1
			Channel           int `json:"channel"`             // 1
			ChargeVideo       int `json:"charge_video"`        // 1
			CloseSpaceMedal   int `json:"close_space_medal"`   // 0
			CoinsVideo        int `json:"coins_video"`         // 1
			Comic             int `json:"comic"`               // 0
			DisableFollowing  int `json:"disable_following"`   // 1
			DisableShowFans   int `json:"disable_show_fans"`   // 0
			DisableShowNft    int `json:"disable_show_nft"`    // 0
			DisableShowSchool int `json:"disable_show_school"` // 0
			DressUp           int `json:"dress_up"`            // 1
			FavVideo          int `json:"fav_video"`           // 0
			Groups            int `json:"groups"`              // 0
			LessonVideo       int `json:"lesson_video"`        // 1
			LikesVideo        int `json:"likes_video"`         // 1
			LivePlayback      int `json:"live_playback"`       // 0
			OnlyShowWearing   int `json:"only_show_wearing"`   // 1
			PlayedGame        int `json:"played_game"`         // 0
			Tags              int `json:"tags"`                // 0
			UserInfo          int `json:"user_info"`           // 1
		} `json:"privacy"`
		ShowNftSwitch bool `json:"show_nft_switch"` // true
		IndexOrder    []struct {
			ID   int    `json:"id"`   // 1
			Name string `json:"name"` // "我的稿件"
		} `json:"index_order"`
		Theme               string `json:"theme"`                  // "default"
		ThemePreviewImgPath string `json:"theme_preview_img_path"` // ""
		Toutu               struct {
			Sid          int    `json:"sid"`           // 1
			Expire       int64  `json:"expire"`        // 2996777597
			SImg         string `json:"s_img"`         // "bfs/space/768cc4fd97618cf589d23c2711a1d1a729f42235.png"
			LImg         string `json:"l_img"`         // "bfs/space/cb1c3ef50e22b6096fde67febe863494caefebad.png"
			AndroidImg   string `json:"android_img"`   // ""
			IphoneImg    string `json:"iphone_img"`    // ""
			IpadImg      string `json:"ipad_img"`      // ""
			ThumbnailImg string `json:"thumbnail_img"` // ""
			Platform     int    `json:"platform"`      // 0
		} `json:"toutu"`
	} `json:"data"`
}

func GetSettings

func GetSettings(uid int) (result SettingsResponse, err error)

查询空间设置

type SignUpdate

type SignUpdate struct {
	PostCSRF
	*Credential

	// 要设置的签名内容 可为空
	UserSign string `api:"body"`
}

修改个人签名

func (SignUpdate) RawURL

func (SignUpdate) RawURL() string

type SignUpdateResponse

type SignUpdateResponse struct {
	Error
}

func PostSignUpdate

func PostSignUpdate(sign string, credential *Credential) (result SignUpdateResponse, err error)

修改个人签名

type SingleUnread

type SingleUnread struct {
	req.Get
	*Credential

	Build      int    `api:"query,omitempty"`
	MobiApp    string `api:"query,omitempty"`
	UnreadType int    `api:"query,omitempty"`
}

未读私信数

func (SingleUnread) RawURL

func (SingleUnread) RawURL() string

type SingleUnreadResponse

type SingleUnreadResponse struct {
	Error
	Msg  string `json:"msg"`
	Data struct {
		UnfollowUnread       int `json:"unfollow_unread"`
		FollowUnread         int `json:"follow_unread"`
		UnfollowPushMsg      int `json:"unfollow_push_msg"`
		DustbinPushMsg       int `json:"dustbin_push_msg"`
		DustbinUnread        int `json:"dustbin_unread"`
		BizMsgUnfollowUnread int `json:"biz_msg_unfollow_unread"`
		BizMsgFollowUnread   int `json:"biz_msg_follow_unread"`
		CustomUnread         int `json:"custom_unread"`
	} `json:"data"`
}

func GetSingleUnread

func GetSingleUnread(credential *Credential) (result SingleUnreadResponse, err error)

未读私信数

type SiteUserInfo

type SiteUserInfo struct {
	req.Get
	*Credential
}

查询账号安全情况

func (SiteUserInfo) RawURL

func (SiteUserInfo) RawURL() string

type SiteUserInfoResponse

type SiteUserInfoResponse struct {
	Error
	Data struct {
		AccountInfo struct {
			HideTel           string `json:"hide_tel"`
			HideMail          string `json:"hide_mail"`
			BindTel           bool   `json:"bind_tel"`
			BindMail          bool   `json:"bind_mail"`
			TelVerify         bool   `json:"tel_verify"`
			MailVerify        bool   `json:"mail_verify"`
			UnneededCheck     bool   `json:"unneeded_check"`
			RealnameCertified bool   `json:"realname_certified"`
		} `json:"account_info"`
		AccountSafe struct {
			Score    int  `json:"Score"`
			ScoreNew int  `json:"score_new"`
			PwdLevel int  `json:"pwd_level"`
			Security bool `json:"security"`
		} `json:"account_safe"`
		AccountSns struct {
			WeiboBind  int `json:"weibo_bind"`
			QqBind     int `json:"qq_bind"`
			WechatBind int `json:"wechat_bind"`
		} `json:"account_sns"`
		AccountOther struct {
			SkipVerify bool `json:"skipVerify"`
		} `json:"account_other"`
	} `json:"data"`
}

func GetSiteUserInfo

func GetSiteUserInfo(credential *Credential) (result SiteUserInfoResponse, err error)

查询账号安全情况

type Special

type Special struct {
	req.Get
	*Credential
}

查询所有特别关注 UID

func (Special) RawURL

func (Special) RawURL() string

type SpecialResponse

type SpecialResponse struct {
	Error
	Data []int `json:"data"`
}

func GetSpecial

func GetSpecial(credential *Credential) (result SpecialResponse, err error)

查询所有特别关注 UID

type Tag

type Tag struct {
	req.Get
	*Credential

	// 分组 id
	TagID int `api:"query" req:"tagid"`

	// 排序方式 当目标用户为自己时有效
	// ("")按照关注顺序排列
	// ("attention")按照最常访问排列
	OrderType string `api:"query,omitempty"`

	// 分页页数
	Pn int `api:"query:1"`

	// 分页大小
	Ps int `api:"query:20"`
}

查询关注分组明细

func (Tag) RawURL

func (Tag) RawURL() string

func (*Tag) ReadPage

func (api *Tag) ReadPage(v any) (int, error)

type TagResponse

type TagResponse struct {
	Error
	Data []RelationItem `json:"data"`
}

func GetTag

func GetTag(tagid int, credential *Credential) (result TagResponse, err error)

查询关注分组明细

type Tags

type Tags struct {
	req.Get
	*Credential
}

查询关注分组列表

func (Tags) RawURL

func (Tags) RawURL() string

type TagsResponse

type TagsResponse struct {
	Error
	Data []struct {
		TagID int    `json:"tagid"` // -10
		Name  string `json:"name"`  // "特别关注"
		Count int    `json:"count"` // 2
		Tip   string `json:"tip"`   // "第一时间收到该分组下用户更新稿件的通知"
	} `json:"data"`
}

func GetTags

func GetTags(credential *Credential) (result TagsResponse, err error)

查询关注分组列表

func (TagsResponse) More

func (r TagsResponse) More() bool

type TagsSet

type TagsSet struct {
	PostCSRF
	*Credential

	// 要设置的 TAG 内容 用(,)间隔
	Tags string `api:"body"`
}

修改个人 TAG

func (TagsSet) RawURL

func (TagsSet) RawURL() string

type TagsSetResponse

type TagsSetResponse struct {
	Error
}

func PostTagsSet

func PostTagsSet(tags []string, credential *Credential) (result TagsSetResponse, err error)

修改个人 TAG

type TaskSign

type TaskSign struct {
	PostCSRF
	*Credential
}

大积分签到

func (TaskSign) RawURL

func (TaskSign) RawURL() string

type TaskSignResponse

type TaskSignResponse struct {
	Error
}

func PostTaskSign

func PostTaskSign(credential *Credential) (result TaskSignResponse, err error)

大积分签到

type TextContent

type TextContent string

纯文本内容

func (TextContent) MarshalString

func (c TextContent) MarshalString() (string, error)

func (TextContent) MsgType

func (TextContent) MsgType() int

type Timestamp

type Timestamp struct {
	req.Get
}

获取适用于 RTC 的时间戳

func (Timestamp) RawURL

func (Timestamp) RawURL() string

type TimestampResponse

type TimestampResponse struct {
	Error
	Data struct {
		Timestamp int   `json:"timestamp"` // 1735223942
		Microtime int64 `json:"microtime"` // 1735223942970
	} `json:"data"`
}

func GetTimestamp

func GetTimestamp() (result TimestampResponse, err error)

获取适用于 RTC 的时间戳

type TopPhotoList

type TopPhotoList struct {
	req.Get

	// 用户 UID
	MID int `api:"query"`
}

查询可用头图列表 (Web端)

func (TopPhotoList) RawURL

func (TopPhotoList) RawURL() string

type TopPhotoListResponse

type TopPhotoListResponse struct {
	Status bool `json:"status"` // true
	Data   []struct {
		ID           int    `json:"id"`            // 1
		ProductName  string `json:"product_name"`  // "bilibili春"
		Price        int    `json:"price"`         // 0
		CoinType     int    `json:"coin_type"`     // 0
		VipFree      int    `json:"vip_free"`      // 0
		SImg         string `json:"s_img"`         // "bfs/space/768cc4fd97618cf589d23c2711a1d1a729f42235.png"
		LImg         string `json:"l_img"`         // "bfs/space/cb1c3ef50e22b6096fde67febe863494caefebad.png"
		ThumbnailImg string `json:"thumbnail_img"` // ""
		SortNum      int    `json:"sort_num"`      // 19
		IsDisable    int    `json:"is_disable"`    // 0
		Expire       int64  `json:"expire"`        // 2890206564
		Had          int    `json:"had"`           // 1
	} `json:"data"`
}

func GetTopPhotoList

func GetTopPhotoList(uid int) (result TopPhotoListResponse, err error)

查询可用头图列表 (Web端)

type UPStat

type UPStat struct {
	req.Get
	*Credential

	// 目标用户 UID
	MID int `api:"query"`
}

UP 主状态数

func (UPStat) RawURL

func (UPStat) RawURL() string

type UPStatResponse

type UPStatResponse struct {
	Error
	Data struct {
		Archive struct {
			EnableVt int `json:"enable_vt"` // 0
			View     int `json:"view"`      // 57937010
			Vt       int `json:"vt"`        // 0
		} `json:"archive"`
		Article struct {
			View int `json:"view"` // 123793
		} `json:"article"`
		Likes int `json:"likes"` // 9789775
	} `json:"data"`
}

func GetUPStat

func GetUPStat(uid int, credential *Credential) (result UPStatResponse, err error)

UP 主状态数

type Unread

type Unread struct {
	req.Get
	*Credential
}

未读消息数

func (Unread) RawURL

func (Unread) RawURL() string

type UnreadResponse

type UnreadResponse struct {
	Error

	Data struct {
		At          int `json:"at"`
		Chat        int `json:"chat"`
		Coin        int `json:"coin"`
		Danmu       int `json:"danmu"`
		Favorite    int `json:"favorite"`
		Like        int `json:"like"`
		RecvLike    int `json:"recv_like"`
		RecvReply   int `json:"recv_reply"`
		Reply       int `json:"reply"`
		SysMsg      int `json:"sys_msg"`
		SysMsgStyle int `json:"sys_msg_style"`
		Up          int `json:"up"`
	} `json:"data"`
}

func GetUnread

func GetUnread(credential *Credential) (result UnreadResponse, err error)

未读消息数

type Update

type Update struct {
	PostCSRF
	*Credential

	// 分组 id
	TagID int `api:"body" req:"tagid"`

	// 新分组名 最长 16 字符
	Name string `api:"body"`
}

重命名分组

func (Update) RawURL

func (Update) RawURL() string

type UpdateResponse

type UpdateResponse struct {
	Error
}

func PostUpdate

func PostUpdate(tag int, name string, credential *Credential) (result UpdateResponse, err error)

重命名分组

type UploadCount

type UploadCount struct {
	req.Get

	// 目标用户 UID
	UID int `api:"query"`
}

相簿投稿数

func (UploadCount) RawURL

func (UploadCount) RawURL() string

type UploadCountResponse

type UploadCountResponse struct {
	Error
	Data struct {
		AllCount   int `json:"all_count"`   // 1018
		DrawCount  int `json:"draw_count"`  // 0
		PhotoCount int `json:"photo_count"` // 0
		DailyCount int `json:"daily_count"` // 1018
	} `json:"data"`
}

func GetUploadCount

func GetUploadCount(uid int) (result UploadCountResponse, err error)

相簿投稿数

type User

type User struct {
	req.Get
	*Credential

	// 目标用户 UID
	FID int `api:"query"`
}

查询目标用户所在的分组

func (User) RawURL

func (User) RawURL() string

type UserResponse

type UserResponse struct {
	Error
	Data map[string]string `json:"data"`
}

func GetUser

func GetUser(uid int, credential *Credential) (result UserResponse, err error)

查询目标用户所在的分组

type VIP

type VIP struct {
	// 会员类型
	// (0)无
	// (1)月度大会员
	// (2)年度以上大会员
	VIPType int `json:"vipType"`

	// 会员到期时间	毫秒级时间戳
	VIPDueDate int64 `json:"vipDueDate"`

	DueRemark    string `json:"dueRemark"`
	AccessStatus int    `json:"accessStatus"`

	// 大会员状态
	// (0)无
	// (1)有
	VIPStatus int `json:"vipStatus"`

	VIPStatusWarn string `json:"vipStatusWarn"`
	ThemeType     int    `json:"themeType"`
	Label         struct {
		Path        string `json:"path"`
		Text        string `json:"text"`
		LabelTheme  string `json:"label_theme"`
		TextColor   string `json:"text_color"`
		BgStyle     int    `json:"bg_style"`
		BgColor     string `json:"bg_color"`
		BorderColor string `json:"border_color"`
	} `json:"label"`
	AvatarSubscript    int    `json:"avatar_subscript"`
	NicknameColor      string `json:"nickname_color"`
	AvatarSubscriptURL string `json:"avatar_subscript_url"`
}

会员信息

type VIPCenterCombine

type VIPCenterCombine struct {
	req.Get
	*Credential

	// 平台 web端(web) 安卓APP(android)
	Platform string `api:"query,omitempty"`

	Build   int    `api:"query,omitempty"`
	MobiApp string `api:"query,omitempty"`
}

大会员中心信息

func (VIPCenterCombine) RawURL

func (VIPCenterCombine) RawURL() string

type VIPCenterCombineResponse

type VIPCenterCombineResponse struct {
	Error
	Data struct {
		User struct {
			Account struct {
				MID            int    `json:"mid"`              // 188888131
				Name           string `json:"name"`             // "脆鲨12138"
				Sex            string `json:"sex"`              // "女"
				Face           string `json:"face"`             // "https://i1.hdslb.com/bfs/face/86faab4844dd2c45870fdafa8f2c9ce7be3e999f.jpg"
				Sign           string `json:"sign"`             // "虚拟艺人团体Vcslive成员,喜欢宅在家打游戏的脆鲨12138!!!"
				Rank           int    `json:"rank"`             // 10000
				Birthday       int    `json:"birthday"`         //
				IsFakeAccount  int    `json:"is_fake_account"`  // 0
				IsDeleted      int    `json:"is_deleted"`       // 0
				InRegAudit     int    `json:"in_reg_audit"`     // 0
				IsSeniorMember int    `json:"is_senior_member"` // 0
				NameRender     any    `json:"name_render"`
			} `json:"account"`
			Vip struct {
				MID        int   `json:"mid"`          // 188888131
				VipType    int   `json:"vip_type"`     // 2
				VipStatus  int   `json:"vip_status"`   // 1
				VipDueDate int64 `json:"vip_due_date"` // 1797264000000
				VipPayType int   `json:"vip_pay_type"` // 1
				ThemeType  int   `json:"theme_type"`   // 0
				Label      struct {
					Text                  string `json:"text"`                      // "年度大会员"
					LabelTheme            string `json:"label_theme"`               // "annual_vip"
					TextColor             string `json:"text_color"`                // "#FFFFFF"
					BgStyle               int    `json:"bg_style"`                  // 1
					BgColor               string `json:"bg_color"`                  // "#FB7299"
					BorderColor           string `json:"border_color"`              // ""
					UseImgLabel           bool   `json:"use_img_label"`             // true
					ImgLabelURIHans       string `json:"img_label_uri_hans"`        // ""
					ImgLabelURIHant       string `json:"img_label_uri_hant"`        // ""
					ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"` // "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png"
					ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"` // "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png"
				} `json:"label"`
				AvatarSubscript    int    `json:"avatar_subscript"`     // 1
				AvatarSubscriptURL string `json:"avatar_subscript_url"` // "https://i0.hdslb.com/bfs/activity-plat/static/20231122/a5480f18ac08c1e30876e3fde84db784/r9dln6E2Uo.png"
				NicknameColor      string `json:"nickname_color"`       // "#FB7299"
				IsNewUser          bool   `json:"is_new_user"`          // false
				TipMaterial        any    `json:"tip_material"`
				VipIsAnnual        bool   `json:"vip_is_annual"`   // true
				VipIsMonth         bool   `json:"vip_is_month"`    // false
				IsAutoRenew        bool   `json:"is_auto_renew"`   // true
				VipIsValid         bool   `json:"vip_is_valid"`    // true
				VipIsOverdue       bool   `json:"vip_is_overdue"`  // false
				VipKeepTime        int    `json:"vip_keep_time"`   // 0
				VipExpireDays      int    `json:"vip_expire_days"` // 717
			} `json:"vip"`
			Tv struct {
				Type       int `json:"type"`         // 0
				VipPayType int `json:"vip_pay_type"` // 0
				Status     int `json:"status"`       // 0
				DueDate    int `json:"due_date"`     // 0
			} `json:"tv"`
			BackgroundImageSmall string `json:"background_image_small"` // ""
			BackgroundImageBig   string `json:"background_image_big"`   // ""
			PanelTitle           string `json:"panel_title"`            // "脆鲨12138"
			PanelSubTitle        string `json:"panel_sub_title"`        // ""
			AvatarPendant        struct {
				Image             string `json:"image"`               // "https://i0.hdslb.com/bfs/garb/item/7061b098537482bb78242a16cba5d44b426b429d.png"
				ImageEnhance      string `json:"image_enhance"`       // "https://i0.hdslb.com/bfs/garb/item/7061b098537482bb78242a16cba5d44b426b429d.png"
				ImageEnhanceFrame string `json:"image_enhance_frame"` // ""
			} `json:"avatar_pendant"`
			VipOverdueExplain    string `json:"vip_overdue_explain"`    // "年度大会员有效期 2026/12/15"
			TvOverdueExplain     string `json:"tv_overdue_explain"`     // "超级大会员未开通"
			AccountExceptionText string `json:"account_exception_text"` // ""
			IsAutoRenew          bool   `json:"is_auto_renew"`          // true
			IsTvAutoRenew        bool   `json:"is_tv_auto_renew"`       // false
			SurplusSeconds       int    `json:"surplus_seconds"`        // 61897858
			VipKeepTime          int    `json:"vip_keep_time"`          // 1600185600
			Renew                struct {
				Text string `json:"text"` // ""
				Link string `json:"link"` // ""
			} `json:"renew"`
			Notice struct {
				Text             string `json:"text"`               // ""
				TvText           string `json:"tv_text"`            // ""
				Type             int    `json:"type"`               // 0
				CanClose         bool   `json:"can_close"`          // false
				SurplusSeconds   int    `json:"surplus_seconds"`    // 0
				TvSurplusSeconds int    `json:"tv_surplus_seconds"` // 0
			} `json:"notice"`
			Face struct {
				ContainerSize struct {
					Width  float64 `json:"width"`  // 1.375
					Height float64 `json:"height"` // 1.375
				} `json:"container_size"`
				FallbackLayers struct {
					Layers []struct {
						Visible     bool `json:"visible"` // true
						GeneralSpec struct {
							PosSpec struct {
								CoordinatePos int     `json:"coordinate_pos"` // 2
								AxisX         float64 `json:"axis_x"`         // 0.6875
								AxisY         float64 `json:"axis_y"`         // 0.6875
							} `json:"pos_spec"`
							SizeSpec struct {
								Width  float64 `json:"width"`  // 0.787
								Height float64 `json:"height"` // 0.787
							} `json:"size_spec"`
							RenderSpec struct {
								Opacity int `json:"opacity"` // 1
							} `json:"render_spec"`
						} `json:"general_spec"`
						LayerConfig struct {
							Tags struct {
								AVATARLAYER struct {
								} `json:"AVATAR_LAYER"`
								GENERALCFG struct {
									ConfigType    int `json:"config_type"` // 1
									GeneralConfig struct {
										WebCSSStyle struct {
											BorderRadius string `json:"borderRadius"` // "50%"
										} `json:"web_css_style"`
									} `json:"general_config"`
								} `json:"GENERAL_CFG"`
							} `json:"tags"`
							IsCritical bool `json:"is_critical"` // true
						} `json:"layer_config"`
						Resource struct {
							ResType  int `json:"res_type"` // 3
							ResImage struct {
								ImageSrc struct {
									SrcType     int `json:"src_type"`    // 1
									Placeholder int `json:"placeholder"` // 6
									Remote      struct {
										URL      string `json:"url"`       // "https://i1.hdslb.com/bfs/face/86faab4844dd2c45870fdafa8f2c9ce7be3e999f.jpg"
										BfsStyle string `json:"bfs_style"` // "widget-layer-avatar"
									} `json:"remote"`
								} `json:"image_src"`
							} `json:"res_image"`
						} `json:"resource"`
					} `json:"layers"`
					IsCriticalGroup bool `json:"is_critical_group"` // true
				} `json:"fallback_layers"`
				MID string `json:"mid"` // "188888131"
			} `json:"face"`
		} `json:"user"`
		Wallet struct {
			Coupon            int  `json:"coupon"`             // 0
			Point             int  `json:"point"`              // 0
			PrivilegeReceived bool `json:"privilege_received"` // false
		} `json:"wallet"`
		UnionVip      any `json:"union_vip"`
		OtherOpenInfo any `json:"other_open_info"`
		Privileges    []struct {
			ID              int    `json:"id"`   // 3
			Name            string `json:"name"` // "视听特权"
			ChildPrivileges []struct {
				FirstID            int    `json:"first_id"`             // 3
				ReportID           string `json:"report_id"`            // "clearwatch"
				Name               string `json:"name"`                 // "超清看"
				Desc               string `json:"desc"`                 // "会员用户超清晰观看"
				Explain            string `json:"explain"`              // "大会员可专享高帧率、高码率画质(最高可达超清4k),觉醒超凡视觉体验。"
				IconURL            string `json:"icon_url"`             // "http://i0.hdslb.com/bfs/vip/b0faebe1b6b5178c49d6d9500c0ded88c0d677ad.png"
				IconGrayURL        string `json:"icon_gray_url"`        // ""
				BackgroundImageURL string `json:"background_image_url"` // "http://i0.hdslb.com/bfs/vip/21d79540e10618ee9bbaf8874ae711442d10edf0.png"
				Link               string `json:"link"`                 // "https://big.bilibili.com/mobile/explainDetails?name=%E8%B6%85%E6%B8%85%E7%9C%8B&closable=1&navhide=1"
				ImageURL           string `json:"image_url"`            // "http://i0.hdslb.com/bfs/vip/fbe4cf2288571d7b0a509c7014d5182789ffdd74.png"
				Type               int    `json:"type"`                 // 0
				HotType            int    `json:"hot_type"`             // 0
				NewType            int    `json:"new_type"`             // 1
				ID                 int    `json:"id"`                   // 3
			} `json:"child_privileges"`
		} `json:"privileges"`
		Banners any `json:"banners"`
		Welfare struct {
			Count int `json:"count"` // 6
			List  []struct {
				ID          int    `json:"id"`           // 120
				Name        string `json:"name"`         // "移动免费领4G流量"
				HomepageURI string `json:"homepage_uri"` // "https://i1.hdslb.com/bfs/vip/abec6a734d8ca1a2b8bf2cc036aafe28d43c0e99.png"
				BackdropURI string `json:"backdrop_uri"` // "https://i1.hdslb.com/bfs/vip/202df1b0786c66c2d5e41db1b048f0a8cdc219ac.png"
				TID         int    `json:"tid"`          // 0
				Rank        int    `json:"rank"`         // 1
				ReceiveURI  string `json:"receive_uri"`  // "https://wx.10086.cn/qwhdhub/leadin/1024120650?A_C_CODE=KXGxyMb60d"
			} `json:"list"`
		} `json:"welfare"`
		RecommendPendants struct {
			List []struct {
				ID      int    `json:"id"`       // 1758
				Name    string `json:"name"`     // "至尊戒"
				Image   string `json:"image"`    // "https://i0.hdslb.com/bfs/garb/item/025d07fa04d38236bc2258be2faf2867e2c48fe1.png"
				JumpURL string `json:"jump_url"` // "https://www.bilibili.com/h5/mall/preview/pendant/1758?navhide=1"
			} `json:"list"`
			JumpURL string `json:"jump_url"` // "https://www.bilibili.com/h5/mall/pendant/home?navhide=1&tab_id=22"
		} `json:"recommend_pendants"`
		RecommendCards struct {
			List []struct {
				ID      int    `json:"id"`       // 18
				Name    string `json:"name"`     // "阿维"
				Image   string `json:"image"`    // "https://i0.hdslb.com/bfs/vip/ffa3e8c1cf92eb0c01db61abe5741419e9302a70.png"
				JumpURL string `json:"jump_url"` // "https://www.bilibili.com/h5/mall/preview/feed/18?navhide=1"
			} `json:"list"`
			JumpURL string `json:"jump_url"` // "https://www.bilibili.com/h5/mall/card/detail?navhide=1&tab_id=5"
		} `json:"recommend_cards"`
		Sort []struct {
			Key  string `json:"key"`  // "union_vip"
			Sort int    `json:"sort"` // 1
		} `json:"sort"`
		InReview bool `json:"in_review"` // false
		BigPoint struct {
			PointInfo struct {
				Point       int `json:"point"`        // 0
				ExpirePoint int `json:"expire_point"` // 0
				ExpireTime  int `json:"expire_time"`  // 0
				ExpireDays  int `json:"expire_days"`  // 0
			} `json:"point_info"`
			SignInfo struct {
				SignRemind   bool `json:"sign_remind"`   // true
				Benefit      int  `json:"benefit"`       // 5
				BonusBenefit int  `json:"bonus_benefit"` // 200
				NormalRemind bool `json:"normal_remind"` // true
				MuggleTask   bool `json:"muggle_task"`   // true
				ExpValue     int  `json:"exp_value"`     // -1
			} `json:"sign_info"`
			SkuInfo struct {
				Skus []struct {
					Base struct {
						Token            string   `json:"token"`   // "1126774380639117732"
						Title            string   `json:"title"`   // "百草味50元礼盒直减券"
						Picture          string   `json:"picture"` // "https://i0.hdslb.com/bfs/activity-plat/9f7fe43bb6cd1692f10b9c0a2892ea63fc80041e.jpg"
						RotationPictures []string `json:"rotation_pictures"`
						Price            struct {
							Origin    int `json:"origin"` // 188
							Promotion any `json:"promotion"`
							Sale      int `json:"sale"` // 188
						} `json:"price"`
						Inventory struct {
							AvailableNum int `json:"available_num"` // 50000
							UsedNum      int `json:"used_num"`      // 44
							SurplusNum   int `json:"surplus_num"`   // 49956
						} `json:"inventory"`
						UserType          int `json:"user_type"`           // 2
						ExchangeLimitType int `json:"exchange_limit_type"` // 2
						ExchangeLimitNum  int `json:"exchange_limit_num"`  // 5
						StartTime         int `json:"start_time"`          // 1735198320
						EndTime           int `json:"end_time"`            // 1753977599
						State             int `json:"state"`               // 2
						Priority          int `json:"priority"`            // 90
					} `json:"base"`
				} `json:"skus"`
			} `json:"sku_info"`
			PointSwitchOff bool `json:"point_switch_off"` // false
			Tips           []struct {
				Content string `json:"content"` // "200大积分待领取"
			} `json:"tips"`
		} `json:"big_point"`
		HotList struct {
			Taps []struct {
				OID       string `json:"oid"`            // "{season_type:0,style_id:0,day:3,rank_type:5}"
				RankID    int    `json:"rank_id"`        // 279
				RankTitle string `json:"rank_title"`     // "会员"
				Type      int    `json:"type,omitempty"` // 1
			} `json:"taps"`
		} `json:"hot_list"`
		IntegrationTask bool `json:"integration_task"` // false
		FreeWelfare     []struct {
			ID             int    `json:"id"`             // 4290081
			Icon           string `json:"icon"`           // "https://i0.hdslb.com/bfs/bangumi/image/5a0027a21d5298fe62266968a0b65f1ab84efa72.png"
			Title          string `json:"title"`          // "开通联通王卡"
			TitleColor     string `json:"titleColor"`     // "#000000"
			Subtitle       string `json:"subtitle"`       // "每年享960G流量"
			SubtitleColor  string `json:"subtitleColor"`  // "#9499A0"
			Subtitle2      string `json:"subtitle2"`      // "领24个月大会员"
			Subtitle2Color string `json:"subtitle2Color"` // "#FF6699"
			TaskState      int    `json:"task_state"`     // 1
			Link           string `json:"link"`           // "https://www.bilibili.com/blackboard/activity-amrPj9oRBu.html?taskId=4290081&channel=cucc_king"
			Channel        string `json:"channel"`        // "cucc_king"
		} `json:"free_welfare"`
		ExtraParamas struct {
			SwitchOn            bool   `json:"switch_on"`               // false
			BirthdaySkuSwitchOn bool   `json:"birthday_sku_switch_on"`  // false
			IsBuyBirthdaySku    bool   `json:"is_buy_birthday_sku"`     // false
			IsBirthdayOff       bool   `json:"is_birthday_off"`         // false
			PhoneBindState      int    `json:"phone_bind_state"`        // 3
			AppTimes            int    `json:"app_times"`               // 0
			NaAb                int    `json:"na_ab"`                   // 0
			NaAbGroupID         string `json:"na_ab_group_id"`          // ""
			IsSameToLastSession bool   `json:"is_same_to_last_session"` // false
			IsWhiteList         bool   `json:"is_white_list"`           // false
			CloudAb             int    `json:"cloud_ab"`                // 0
			CloudAbGroupID      string `json:"cloud_ab_group_id"`       // ""
			BannerAb            int    `json:"banner_ab"`               // 0
			BannerAbGroupID     string `json:"banner_ab_group_id"`      // ""
			NowTime             int    `json:"now_time"`                // 0
			FreeWelfareAb       int    `json:"free_welfare_ab"`         // 0
			DeviceLimitAb       int    `json:"device_limit_ab"`         // 0
		} `json:"extra_paramas"`
		HitAb bool `json:"hit_ab"` // false
	} `json:"data"`
}

func GetVIPCenterCombine

func GetVIPCenterCombine(credential *Credential) (result VIPCenterCombineResponse, err error)

大会员中心信息

type VIPEXPAdd

type VIPEXPAdd struct {
	PostCSRF
	*Credential
}

大会员每日经验

func (VIPEXPAdd) RawURL

func (VIPEXPAdd) RawURL() string

type VIPEXPAddResponse

type VIPEXPAddResponse struct {
	Error
	Data struct {
		Type    int  `json:"type"`     // 0
		IsGrant bool `json:"is_grant"` // true
	} `json:"data"`
}

func PostVIPEXPAdd

func PostVIPEXPAdd(credential *Credential) (result VIPEXPAddResponse, err error)

大会员每日经验

type VIPPointList

type VIPPointList struct {
	req.Get
	*Credential

	// 改变类型
	// (0)所有类型
	// (1)获取记录
	// (2)消耗记录
	ChangeType int `api:"query:0"`

	// 分页页数
	Pn int `api:"query:0"`

	// 分页大小
	Ps int `api:"query:20"`
}

大积分改变记录

func (VIPPointList) RawURL

func (VIPPointList) RawURL() string

func (*VIPPointList) ReadPage

func (api *VIPPointList) ReadPage(v any) (int, error)

type VIPPointListResponse

type VIPPointListResponse struct {
	Error
	Data struct {
		Total        int `json:"total"` // 2
		BigPointList []struct {
			Point      int    `json:"point"`       // 50
			ChangeTime int    `json:"change_time"` // 1680253998
			Remark     string `json:"remark"`      // "领取大会员卡券包权益"
			OrderNo    string `json:"order_no"`    // "nt-s-c-1018922562"
			ImageURL   string `json:"image_url"`   // ""
		} `json:"big_point_list"`
	} `json:"data"`
}

func GetVIPPointList

func GetVIPPointList(credential *Credential) (result VIPPointListResponse, err error)

大积分改变记录

func (VIPPointListResponse) More

func (r VIPPointListResponse) More() bool

type VideoInfo

type VideoInfo struct {
	AID       int    `json:"aid"`       // 78090377
	Videos    int    `json:"videos"`    // 1
	TID       int    `json:"tid"`       // 47
	Tname     string `json:"tname"`     // "同人·手书"
	Copyright int    `json:"copyright"` // 1
	Pic       string `json:"pic"`       // "http://i2.hdslb.com/bfs/archive/7fe8272ef4c90d07ba2dba968638392f8d5bf490.jpg"
	Title     string `json:"title"`     // "【七海】七海的偶像宣言/私、アイドル宣言【手书PV】"
	Pubdate   int    `json:"pubdate"`   // 1575540036
	Ctime     int    `json:"ctime"`     // 1575483142
	Desc      string `json:"desc"`      // "本家:sm32825363 ...
	State     int    `json:"state"`     // 0
	Attribute int    `json:"attribute"` // 16793984
	Duration  int    `json:"duration"`  // 268
	Rights    struct {
		Bp            int `json:"bp"`              // 0
		Elec          int `json:"elec"`            // 0
		Download      int `json:"download"`        // 0
		Movie         int `json:"movie"`           // 0
		Pay           int `json:"pay"`             // 0
		Hd5           int `json:"hd5"`             // 1
		NoReprint     int `json:"no_reprint"`      // 1
		Autoplay      int `json:"autoplay"`        // 1
		UgcPay        int `json:"ugc_pay"`         // 0
		IsCooperation int `json:"is_cooperation"`  // 1
		UgcPayPreview int `json:"ugc_pay_preview"` // 0
		NoBackground  int `json:"no_background"`   // 0
		ArcPay        int `json:"arc_pay"`         // 0
		PayFreeWatch  int `json:"pay_free_watch"`  // 0
	} `json:"rights"`
	Owner struct {
		MID  int    `json:"mid"`  // 434334701
		Name string `json:"name"` // "七海Nana7mi"
		Face string `json:"face"` // "https://i2.hdslb.com/bfs/face/3adb26401cfab0fe6b1a0d5b2c09220499108d64.jpg"
	} `json:"owner"`
	Stat struct {
		AID      int `json:"aid"`      // 78090377
		View     int `json:"view"`     // 403958
		Danmaku  int `json:"danmaku"`  // 1325
		Reply    int `json:"reply"`    // 1181
		Favorite int `json:"favorite"` // 10626
		Coin     int `json:"coin"`     // 13492
		Share    int `json:"share"`    // 1273
		NowRank  int `json:"now_rank"` // 0
		HisRank  int `json:"his_rank"` // 0
		Like     int `json:"like"`     // 18030
		Dislike  int `json:"dislike"`  // 0
		Vt       int `json:"vt"`       // 518998
		Vv       int `json:"vv"`       // 403958
	} `json:"stat"`
	Dynamic   string `json:"dynamic"` // "脆脆鲨组从我关注数到1w的时候就开始企划的手书 ...
	CID       int    `json:"cid"`     // 133606284
	Dimension struct {
		Width  int `json:"width"`  // 1920
		Height int `json:"height"` // 1080
		Rotate int `json:"rotate"` // 0
	} `json:"dimension"`
	ShortLinkV2      string `json:"short_link_v2"`     // "https://b23.tv/BV1vJ411B7ng"
	VtDisplay        string `json:"vt_display"`        // "51.9万"
	Cover43          string `json:"cover43"`           // ""
	TIDv2            int    `json:"tidv2"`             // 2020
	Tnamev2          string `json:"tnamev2"`           // "翻唱"
	BVID             string `json:"bvid"`              // "BV1vJ411B7ng"
	Reason           string `json:"reason"`            // ""
	InterVideo       bool   `json:"inter_video"`       // false
	IsChargingArc    bool   `json:"is_charging_arc"`   // false
	ElecArcType      int    `json:"elec_arc_type"`     // 0
	EnableVt         int    `json:"enable_vt"`         // 0
	PlaybackPosition int    `json:"playback_position"` // 0
	IsSelfView       bool   `json:"is_self_view"`      // false
}

视频信息

type WebUserInfo

type WebUserInfo struct {
	req.Get
	*Credential
}

查询大会员状态

func (WebUserInfo) RawURL

func (WebUserInfo) RawURL() string

type WebUserInfoResponse

type WebUserInfoResponse struct {
	Error
	Data struct {
		VipPayType         int    `json:"vip_pay_type"`
		VipIsAnnual        bool   `json:"vip_is_annual"`
		VipKeepTime        int    `json:"vip_keep_time"`
		MID                int    `json:"mid"`
		VipIsValid         bool   `json:"vip_is_valid"`
		AvatarSubscriptURL string `json:"avatar_subscript_url"`
		IsAutoRenew        bool   `json:"is_auto_renew"`
		NicknameColor      string `json:"nickname_color"`
		IsNewUser          bool   `json:"is_new_user"`
		VipDueDate         int64  `json:"vip_due_date"`
		VipIsOverdue       bool   `json:"vip_is_overdue"`
		VipType            int    `json:"vip_type"`
		Label              struct {
			Text                  string `json:"text"`
			LabelTheme            string `json:"label_theme"`
			ImgLabelURIHans       string `json:"img_label_uri_hans"`
			ImgLabelURIHantStatic string `json:"img_label_uri_hant_static"`
			TextColor             string `json:"text_color"`
			BgStyle               int    `json:"bg_style"`
			BorderColor           string `json:"border_color"`
			BgColor               string `json:"bg_color"`
			UseImgLabel           bool   `json:"use_img_label"`
			ImgLabelURIHant       string `json:"img_label_uri_hant"`
			ImgLabelURIHansStatic string `json:"img_label_uri_hans_static"`
		} `json:"label"`
		VipStatus       int  `json:"vip_status"`
		AvatarSubscript int  `json:"avatar_subscript"`
		VipExpireDays   int  `json:"vip_expire_days"`
		ThemeType       int  `json:"theme_type"`
		TipMaterial     any  `json:"tip_material"`
		VipIsMonth      bool `json:"vip_is_month"`
	} `json:"data"`
}

func GetWebUserInfo

func GetWebUserInfo(credential *Credential) (result WebUserInfoResponse, err error)

查询大会员状态

type Whispers

type Whispers struct {
	req.Get
	*Credential
}

查询悄悄关注明细

func (Whispers) RawURL

func (Whispers) RawURL() string

type WhispersResponse

type WhispersResponse struct {
	Error
	Data struct {
		List      []RelationItem `json:"list"`
		ReVersion int            `json:"re_version"` // 0
	} `json:"data"`
}

func GetWhispers

func GetWhispers(credential *Credential) (result WhispersResponse, err error)

查询悄悄关注明细

type WithdrawContent

type WithdrawContent string

撤回消息内容

func (WithdrawContent) MarshalString

func (c WithdrawContent) MarshalString() (string, error)

func (WithdrawContent) MsgType

func (WithdrawContent) MsgType() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL