Skip to content

Commit

Permalink
✨ 修改变量 (#43)
Browse files Browse the repository at this point in the history
* ✨ 修改变量

* 🎨 fix-lint

* ✨ 修lint
  • Loading branch information
guohuiyuan authored Apr 1, 2024
1 parent 062dc31 commit a06fe89
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 38 deletions.
86 changes: 53 additions & 33 deletions bilibili/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
2 changes: 1 addition & 1 deletion pixiv/cat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pixiv/pixiv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions qzone/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
}
Expand Down Expand Up @@ -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
},
}
Expand All @@ -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
},
}
Expand Down

0 comments on commit a06fe89

Please sign in to comment.