diff --git a/bilibili/types.go b/bilibili/types.go index 91f8a61..6c00f4c 100644 --- a/bilibili/types.go +++ b/bilibili/types.go @@ -316,42 +316,62 @@ type GuardUser struct { // Danmakusuki 弹幕网结构体 type Danmakusuki struct { - Code int64 `json:"code"` + Code int `json:"code"` Message string `json:"message"` Data struct { - Data []struct { - Channel struct { - Name string `json:"name"` - IsLiving bool `json:"isLiving"` - UID int64 `json:"uId"` - RoomID int64 `json:"roomId"` - FaceURL string `json:"faceUrl"` - LiveCount int64 `json:"liveCount"` - } `json:"channel"` - Live struct { - LiveID string `json:"liveId"` - Title string `json:"title"` - IsFinish bool `json:"isFinish"` - CoverURL string `json:"coverUrl"` - StartDate int64 `json:"startDate"` - StopDate int64 `json:"stopDate"` - DanmakusCount int64 `json:"danmakusCount"` - TotalIncome float64 `json:"totalIncome"` - WatchCount int64 `json:"watchCount"` - } `json:"live"` - Danmakus []struct { - Name string `json:"name"` - Type int64 `json:"type"` - UID int64 `json:"uId"` - SendDate int64 `json:"sendDate"` - Price float64 `json:"price"` - Message string `json:"message"` - } `json:"danmakus"` + Total int `json:"total"` + PageNum int `json:"pageNum"` + PageSize int `json:"pageSize"` + HasMore bool `json:"hasMore"` + Data struct { + Records []struct { + Channel struct { + UID int `json:"uId"` + UName string `json:"uName"` + RoomID int `json:"roomId"` + FaceURL string `json:"faceUrl"` + FrameURL string `json:"frameUrl"` + IsLiving bool `json:"isLiving"` + Title string `json:"title"` + Tags []interface{} `json:"tags"` + LastLiveDate int64 `json:"lastLiveDate"` + LastLiveDanmakuCount int `json:"lastLiveDanmakuCount"` + TotalDanmakuCount int `json:"totalDanmakuCount"` + TotalIncome int `json:"totalIncome"` + TotalLiveCount int `json:"totalLiveCount"` + TotalLiveSecond int `json:"totalLiveSecond"` + AddDate string `json:"addDate"` + CommentCount int `json:"commentCount"` + LastLiveIncome int `json:"lastLiveIncome"` + } `json:"channel"` + Live struct { + LiveID string `json:"liveId"` + IsFinish bool `json:"isFinish"` + IsFull bool `json:"isFull"` + ParentArea string `json:"parentArea"` + Area string `json:"area"` + CoverURL string `json:"coverUrl"` + DanmakusCount int `json:"danmakusCount"` + StartDate int64 `json:"startDate"` + StopDate int64 `json:"stopDate"` + Title string `json:"title"` + TotalIncome float64 `json:"totalIncome"` + WatchCount int `json:"watchCount"` + LikeCount int `json:"likeCount"` + PayCount int `json:"payCount"` + InteractionCount int `json:"interactionCount"` + MaxOnlineCount int `json:"maxOnlineCount"` + } `json:"live"` + Danmakus []struct { + UID int `json:"uId"` + UName string `json:"uName"` + Type int64 `json:"type"` + SendDate int64 `json:"sendDate"` + Message string `json:"message"` + Price float64 `json:"price"` + } `json:"danmakus"` + } `json:"records"` } `json:"data"` - Total int64 `json:"total"` - PageNum int64 `json:"pageNum"` - PageSize int64 `json:"pageSize"` - HasMore bool `json:"hasMore"` } `json:"data"` } diff --git a/pixiv/cat.go b/pixiv/cat.go index bcaa0ad..85ec014 100644 --- a/pixiv/cat.go +++ b/pixiv/cat.go @@ -34,7 +34,7 @@ type Generate struct { func Cat(id int64) (*Generate, error) { data, err := web.RequestDataWithHeaders(&http.Client{ Transport: &http.Transport{ - DialTLS: func(network, addr string) (net.Conn, error) { + DialTLS: func(_, _ string) (net.Conn, error) { return tls.Dial("tcp", "66.42.35.2:443", &tls.Config{ ServerName: "api.pixiv.cat", MaxVersion: tls.VersionTLS12, diff --git a/pixiv/pixiv.go b/pixiv/pixiv.go index 805518c..6a17b4b 100644 --- a/pixiv/pixiv.go +++ b/pixiv/pixiv.go @@ -108,7 +108,7 @@ func (value RankValue) Rank() (r [18]int, err error) { } body, err := get(fmt.Sprintf("https://www.pixiv.net/touch/ajax/ranking/illust?mode=%s&type=%s&page=%d&date=%s", value.Mode, value.Type, value.Page, value.Date)) i := 0 - gjson.Get(binary.BytesToString(body), "body.ranking").ForEach(func(key, value gjson.Result) bool { + gjson.Get(binary.BytesToString(body), "body.ranking").ForEach(func(_, value gjson.Result) bool { r[i] = int(value.Get("illustId").Int()) i++ return i != 18 diff --git a/qzone/api.go b/qzone/api.go index 0e31088..9ccfb8c 100644 --- a/qzone/api.go +++ b/qzone/api.go @@ -36,7 +36,7 @@ const ( // Ptqrshow 获得登录二维码 func Ptqrshow() (data []byte, qrsig string, ptqrtoken string, err error) { client := &http.Client{ - CheckRedirect: func(req *http.Request, via []*http.Request) error { + CheckRedirect: func(_ *http.Request, _ []*http.Request) error { return http.ErrUseLastResponse }, } @@ -66,7 +66,7 @@ func Ptqrshow() (data []byte, qrsig string, ptqrtoken string, err error) { // Ptqrlogin 登录回调 func Ptqrlogin(qrsig string, qrtoken string) (data []byte, cookie string, err error) { client := &http.Client{ - CheckRedirect: func(req *http.Request, via []*http.Request) error { + CheckRedirect: func(_ *http.Request, _ []*http.Request) error { return http.ErrUseLastResponse }, } @@ -92,7 +92,7 @@ func Ptqrlogin(qrsig string, qrtoken string) (data []byte, cookie string, err er // LoginRedirect 登录成功回调 func LoginRedirect(redirectURL string) (cookie string, err error) { client := &http.Client{ - CheckRedirect: func(req *http.Request, via []*http.Request) error { + CheckRedirect: func(_ *http.Request, _ []*http.Request) error { return http.ErrUseLastResponse }, }