Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update:bilibili API #1096

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions plugin/bilibili/bilibili.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@
return
}
ctx.SendChain(message.Text(
"uid: ", card.Mid, "\n",
"name: ", card.Name, "\n",
"sex: ", card.Sex, "\n",
"sign: ", card.Sign, "\n",
"level: ", card.LevelInfo.CurrentLevel, "\n",
"birthday: ", card.Birthday,
"uid: ", card.Data.Card.Mid, "\n",

Check failure on line 85 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 85 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 85 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 85 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 85 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
"name: ", card.Data.Card.Name, "\n",

Check failure on line 86 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 86 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 86 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 86 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 86 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
"sex: ", card.Data.Card.Sex, "\n",

Check failure on line 87 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 87 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 87 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 87 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 87 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
"sign: ", card.Data.Card.Sign, "\n",

Check failure on line 88 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 88 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 88 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 88 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 88 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
"level: ", card.Data.Card.LevelInfo.CurrentLevel, "\n",

Check failure on line 89 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 89 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 89 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 89 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 89 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
"birthday: ", card.Data.Card.Birthday,

Check failure on line 90 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 90 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 90 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 90 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 90 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

card.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
))
})

Expand Down Expand Up @@ -128,7 +128,7 @@
ctx.SendChain(message.Text("ERROR: ", err))
return
}
vups, err := vdb.filterVup(u.Attentions)
vups, err := vdb.filterVup(u.Data.Card.Attentions)

Check failure on line 131 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 131 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 131 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 131 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 131 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
Expand Down Expand Up @@ -158,12 +158,12 @@
i--
}
}
facePath := cachePath + id + "vupFace" + path.Ext(u.Face)
facePath := cachePath + id + "vupFace" + path.Ext(u.Data.Card.Face)

Check failure on line 161 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 161 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 161 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 161 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 161 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
backX := 500
backY := 500
var back image.Image
if path.Ext(u.Face) != ".webp" {
err = initFacePic(facePath, u.Face)
if path.Ext(u.Data.Card.Face) != ".webp" {

Check failure on line 165 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 165 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 165 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 165 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 165 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
err = initFacePic(facePath, u.Data.Card.Face)

Check failure on line 166 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (windows, amd64)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 166 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, arm)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 166 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, 386)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 166 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / Build binary CI (linux, amd64)

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)

Check failure on line 166 in plugin/bilibili/bilibili.go

View workflow job for this annotation

GitHub Actions / lint

u.Data undefined (type "github.com/FloatTech/AnimeAPI/bilibili".MemberCard has no field or method Data)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
Expand All @@ -176,7 +176,7 @@
back = imgfactory.Size(back, backX, backY).Image()
}
if len(vups) > 50 {
ctx.SendChain(message.Text(u.Name + "关注的up主太多了, 只展示前50个up"))
ctx.SendChain(message.Text(u.Data.Card.Name + "关注的up主太多了, 只展示前50个up"))
vups = vups[:50]
}
canvas := gg.NewContext(1500, int(500*(1.1+float64(len(vups))/3)))
Expand All @@ -196,18 +196,18 @@
return
}
sl, _ := canvas.MeasureString("好")
length, h := canvas.MeasureString(u.Mid)
n, _ := canvas.MeasureString(u.Name)
canvas.DrawString(u.Name, 550, 160-h)
length, h := canvas.MeasureString(u.Data.Card.Mid)
n, _ := canvas.MeasureString(u.Data.Card.Name)
canvas.DrawString(u.Data.Card.Name, 550, 160-h)
canvas.DrawRoundedRectangle(600+n-length*0.1, 160-h*2.5, length*1.2, h*2, fontSize*0.2)
canvas.SetRGB255(221, 221, 221)
canvas.Fill()
canvas.SetColor(color.Black)
canvas.DrawString(u.Mid, 600+n, 160-h)
canvas.DrawString(fmt.Sprintf("粉丝:%d", u.Fans), 550, 240-h)
canvas.DrawString(fmt.Sprintf("关注:%d", len(u.Attentions)), 1000, 240-h)
canvas.DrawString(fmt.Sprintf("管人痴成分:%.2f%%(%d/%d)", float64(vupLen)/float64(len(u.Attentions))*100, vupLen, len(u.Attentions)), 550, 320-h)
regtime := time.Unix(u.Regtime, 0).Format("2006-01-02 15:04:05")
canvas.DrawString(u.Data.Card.Mid, 600+n, 160-h)
canvas.DrawString(fmt.Sprintf("粉丝:%d", u.Data.Card.Fans), 550, 240-h)
canvas.DrawString(fmt.Sprintf("关注:%d", len(u.Data.Card.Attentions)), 1000, 240-h)
canvas.DrawString(fmt.Sprintf("管人痴成分:%.2f%%(%d/%d)", float64(vupLen)/float64(len(u.Data.Card.Attentions))*100, vupLen, len(u.Data.Card.Attentions)), 550, 320-h)
regtime := time.Unix(u.Data.Card.Regtime, 0).Format("2006-01-02 15:04:05")
canvas.DrawString("注册日期:"+regtime, 550, 400-h)
canvas.DrawString("查询日期:"+time.Now().Format("2006-01-02"), 550, 480-h)
for i, v := range vups {
Expand Down Expand Up @@ -305,12 +305,12 @@
}
today := time.Now().Format("20060102150415")
drawedFile := cachePath + id + today + "vupLike.png"
facePath := cachePath + id + "vupFace" + path.Ext(u.Face)
facePath := cachePath + id + "vupFace" + path.Ext(u.Data.Card.Face)
backX := 500
backY := 500
var back image.Image
if path.Ext(u.Face) != ".webp" {
err = initFacePic(facePath, u.Face)
if path.Ext(u.Data.Card.Face) != ".webp" {
err = initFacePic(facePath, u.Data.Card.Face)
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
Expand Down Expand Up @@ -359,17 +359,17 @@
if back != nil {
canvas.DrawImage(back, facestart, 0)
}
length, _ := canvas.MeasureString(u.Mid)
n, _ := canvas.MeasureString(u.Name)
canvas.DrawString(u.Name, startWidth, 122.5)
length, _ := canvas.MeasureString(u.Data.Card.Mid)
n, _ := canvas.MeasureString(u.Data.Card.Name)
canvas.DrawString(u.Data.Card.Name, startWidth, 122.5)
canvas.DrawRoundedRectangle(900+n-length*0.1, 66, length*1.2, 75, fontSize*0.2)
canvas.SetRGB255(221, 221, 221)
canvas.Fill()
canvas.SetColor(color.Black)
canvas.DrawString(u.Mid, 900+n, 122.5)
canvas.DrawString(fmt.Sprintf("粉丝:%d 关注:%d", u.Fans, u.Attention), startWidth, 222.5)
canvas.DrawString(u.Data.Card.Mid, 900+n, 122.5)
canvas.DrawString(fmt.Sprintf("粉丝:%d 关注:%d", u.Data.Card.Fans, u.Data.Card.Attention), startWidth, 222.5)
canvas.DrawString(fmt.Sprintf("页码:[%d/%d]", danmaku.Data.PageNum, (danmaku.Data.Total-1)/5), startWidth, 322.5)
canvas.DrawString("网页链接: "+fmt.Sprintf(bz.DanmakuURL, u.Mid), startWidth, 422.5)
canvas.DrawString("网页链接: "+fmt.Sprintf(bz.DanmakuURL, u.Data.Card.Mid), startWidth, 422.5)
var channelStart float64
channelStart = float64(550)
for i := 0; i < len(danmaku.Data.Data.Records); i++ {
Expand Down
2 changes: 1 addition & 1 deletion plugin/bilibili/card2msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func videoCard2msg(card bz.Card) (msg []message.Segment, err error) {
err = nil
msg = append(msg, message.Text("UP主: ", card.Owner.Name, "\n"))
} else {
msg = append(msg, message.Text("UP主: ", card.Owner.Name, " 粉丝: ", bz.HumanNum(mCard.Fans), "\n"))
msg = append(msg, message.Text("UP主: ", card.Owner.Name, " 粉丝: ", bz.HumanNum(mCard.Data.Card.Fans), "\n"))
}
}
msg = append(msg, message.Text("播放: ", bz.HumanNum(card.Stat.View), " 弹幕: ", bz.HumanNum(card.Stat.Danmaku)))
Expand Down
Loading