bangumi / server Goto Github PK
View Code? Open in Web Editor NEWThe next-generation api backend server for bgm.tv
Home Page: https://bangumi.github.io/api/
License: GNU Affero General Public License v3.0
The next-generation api backend server for bgm.tv
Home Page: https://bangumi.github.io/api/
License: GNU Affero General Public License v3.0
大概的路由
GET /v0/indices/{index_id}
GET /v0/indices/{index_id}/subjects
支持 type
参数进行条目类型筛选,应该支持分页。
GET /v0/indices/{index_id}/comments
(这个参照帖子详情的响应)
如果包含任何一个 NSFW 条目,本目录应该被认为是 NSFW 目录,不允许没有 NSFW 条目查看权限的人查看目录,返回HTTP 404。
SQL 表这里 https://github.com/bangumi/dev-env/blob/master/un-processed/bangumi_index%20(2).sql
因为小组/讨论贴涉及部分用户权限的问题(某些帖子的隐藏,下沉,关闭),所以先做用户鉴权相关的内容再做讨论贴相关的内容。
调用需要授权的新API还是通过原有的OAuth流程获取一个access token,然后用token来请求新API。新旧API的用户鉴权方法相同。
GET /v0/subjects/:subjectId/topics
获取条目下全部讨论GET /v0/subjects-topics/:topicId
获取条目讨论内容There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Cannot find preset's package (@trim21)
描述
{
"level":"error","time":"2022-04-23T00:43:43.863269623Z",
"logger":"user.mysqlRepo",
"caller":"user/mysql_repository.go:100",
"msg":"unexpected error happened",
"error":"sql: Scan error on column index 17, name \"interest_private\": sql/driver: couldn't convert 2 into type bool","trace":"github.com/bangumi/server/user.mysqlRepo.ListCollections
/home/runner/work/server/server/user/mysql_repository.go:100
github.com/bangumi/server/web/handler.Handler.listCollection
/home/runner/work/server/server/web/handler/collection.go:90
github.com/bangumi/server/web/handler.Handler.ListCollection
/home/runner/work/server/server/web/handler/collection.go:66
github.com/bangumi/server/web.ResistRouter.func1.1
/home/runner/work/server/server/web/handler.go:42
github.com/gofiber/fiber/v2.(*App).next
/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/router.go:132
github.com/gofiber/fiber/v2.(*Ctx).Next
/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/ctx.go:792
github.com/bangumi/server/web/handler.Handler.MiddlewareAccessUser.func2
/home/runner/work/server/server/web/handler/auth.go:54
github.com/gofiber/fiber/v2.(*App).next
/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/router.go:132
github.com/gofiber/fiber/v2.(*Ctx).Next
/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/ctx.go:792
github.com/bangumi/server/web/middleware/recovery.New.func1
/home/runner/work/server/server/web/middleware/recovery/new.go:52
github.com/gofiber/fiber/v2.(*Ctx).Next
/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/ctx.go:789
github.com/bangumi/server/web.New.func1
/home/runner/work/server/server/web/index.go:58
github.com/gofiber/fiber/v2.(*App).next
/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/router.go:132
github.com/gofiber/fiber/v2.(*App).handler
/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/router.go:160
github.com/valyala/fasthttp.(*Server).serveConn
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/server.go:2341
github.com/valyala/fasthttp.(*workerPool).workerFunc
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:224
github.com/valyala/fasthttp.(*workerPool).getCh.func1
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:196"
}
如何重现
预期
实际行为
额外信息
CF-Ray
: ``User-Agent
: ``返回中出现多个「入坑作」,但实际上只有一个条目的 comment 如此。
复现:https://api.bgm.tv/v0/users/317704/collections?limit=30&offset=90
下游相关链接:jerrylususu/bangumi-takeout-py#5
你想添加的新功能
私有小组概览接口
你希望的解决方案
新增接口
GET /p/group/${name}
期望返回:
字段 | 类型 | 意义 |
---|---|---|
title |
string |
小组名称 |
created_at |
string |
创建时间,格式 YYYY-MM-DD HH:mm |
description |
string |
小组介绍 |
total_members |
number |
小组成员数量 |
new_members |
User[] |
最近加入的小组成员,最多 10 个 |
related_groups |
Group[] |
成员喜欢去的小组,最多 6 个 |
new_topics |
Topic[] |
最新讨论,最多 10 个 |
其他可能的替代方案
其他相关信息
帖子内容等东西不一定要渲染成html, 直接返回bbcode就行
/subjects/{subject_id}/revisions
id
为表中 rev_id
。按时间倒叙,不允许任何过滤。{
"total": 1,
"limit": 100,
"offset": 0,
"data": [
{
"id": 1,
"creator": {
"id": 2,
"username": "abc",
"nickname": "def",
"avatar": "..."
},
"timestamp": "2021-11-20T15:06:03+00:00",
"summary": ""
}
]
}
/subjects/{subject_id}/revisions/{rev_id}
获取用户收藏的 GET /v0/users/{username}/collections
其中 limit 参数接收最大值 100,默认值 30。
当 limit 参数大于 用户总收藏数 时会 Bad Request,产生了无意义的失败请求,徒增 API 使用难度,也为服务器增大了压力。
{
"title": "Bad Request",
"details": {
"error": "limit should less equal than 40",
"path": "/v0/users/{username}/collections",
"query_string": "limit=50&offset=0"
},
"description": "limit should less equal than 40"
}
个人认为当前可行的解决方案,采用一个小于 100 的 limit 参数进行请求,如果出现 Bad Request,从信息中拿到 limit 允许的最大值(即上面 description
中的数字),并进行第二次请求。
描述
简短的表述你遇到的问题
使用 API https://api.bgm.tv/v0/persons/13565/characters
获取到的关联角色与 页面角色列表不一致 https://bgm.tv/person/13565/works/voice
如何重现
直接对比上述两个链接返回结果
预期
API获取结果应该与页面一致
实际行为
API获取的可能是其他人物的关联角色
额外信息
我随便试了几个角色似乎都有问题
CF-Ray
: ``User-Agent
: ``今天看错误日志看到有服务重启,检查了下log,没明白是为啥发生的。
对应的是这个 commit https://github.com/bangumi/server/tree/v0.17.1
runtime: marked free object in span 0x7fbb8e183db8, elemsize=2048 freeindex=1 (bad use of unsafe.Pointer? try -d=checkptr)
0xc000724000 alloc marked
0xc000724800 free unmarked
0xc000725000 free marked zombie
0x000000c000725000: 0x0000000000000000 0x0000000000000000
0x000000c000725010: 0x0000000000000000 0x0000000000000000
0x000000c000725020: 0x0000000000000000 0x0000000000000000
0x000000c000725030: 0x0000000000000000 0x0000000000000000
0x000000c000725040: 0x0000000000000000 0x0000000000000000
0x000000c000725050: 0x0000000000000000 0x0000000000000000
0x000000c000725060: 0x0000000000000000 0x0000000000000000
0x000000c000725070: 0x0000000000000000 0x0000000000000000
0x000000c000725080: 0x0000000000000000 0x0000000000000000
0x000000c000725090: 0x0000000000000000 0x0000000000000000
0x000000c0007250a0: 0x0000000000000000 0x0000000000000000
0x000000c0007250b0: 0x0000000000000000 0x0000000000000000
0x000000c0007250c0: 0x0000000000000000 0x0000000000000000
0x000000c0007250d0: 0x0000000000000000 0x0000000000000000
0x000000c0007250e0: 0x0000000000000000 0x0000000000000000
0x000000c0007250f0: 0x0000000000000000 0x0000000000000000
0x000000c000725100: 0x0000000000000000 0x0000000000000000
0x000000c000725110: 0x0000000000000000 0x0000000000000000
0x000000c000725120: 0x0000000000000000 0x0000000000000000
0x000000c000725130: 0x0000000000000000 0x0000000000000000
0x000000c000725140: 0x0000000000000000 0x0000000000000000
0x000000c000725150: 0x0000000000000000 0x0000000000000000
0x000000c000725160: 0x0000000000000000 0x0000000000000000
0x000000c000725170: 0x0000000000000000 0x0000000000000000
0x000000c000725180: 0x0000000000000000 0x0000000000000000
0x000000c000725190: 0x0000000000000000 0x0000000000000000
0x000000c0007251a0: 0x0000000000000000 0x0000000000000000
0x000000c0007251b0: 0x0000000000000000 0x0000000000000000
0x000000c0007251c0: 0x0000000000000000 0x0000000000000000
0x000000c0007251d0: 0x0000000000000000 0x0000000000000000
0x000000c0007251e0: 0x0000000000000000 0x0000000000000000
0x000000c0007251f0: 0x0000000000000000 0x0000000000000000
0x000000c000725200: 0x0000000000000000 0x0000000000000000
0x000000c000725210: 0x0000000000000000 0x0000000000000000
0x000000c000725220: 0x0000000000000000 0x0000000000000000
0x000000c000725230: 0x0000000000000000 0x0000000000000000
0x000000c000725240: 0x0000000000000000 0x0000000000000000
0x000000c000725250: 0x0000000000000000 0x0000000000000000
0x000000c000725260: 0x0000000000000000 0x0000000000000000
0x000000c000725270: 0x0000000000000000 0x0000000000000000
0x000000c000725280: 0x0000000000000000 0x0000000000000000
0x000000c000725290: 0x0000000000000000 0x0000000000000000
0x000000c0007252a0: 0x0000000000000000 0x0000000000000000
0x000000c0007252b0: 0x0000000000000000 0x0000000000000000
0x000000c0007252c0: 0x0000000000000000 0x0000000000000000
0x000000c0007252d0: 0x0000000000000000 0x0000000000000000
0x000000c0007252e0: 0x0000000000000000 0x0000000000000000
0x000000c0007252f0: 0x0000000000000000 0x0000000000000000
0x000000c000725300: 0x0000000000000000 0x0000000000000000
0x000000c000725310: 0x0000000000000000 0x0000000000000000
0x000000c000725320: 0x0000000000000000 0x0000000000000000
0x000000c000725330: 0x0000000000000000 0x0000000000000000
0x000000c000725340: 0x0000000000000000 0x0000000000000000
0x000000c000725350: 0x0000000000000000 0x0000000000000000
0x000000c000725360: 0x0000000000000000 0x0000000000000000
0x000000c000725370: 0x0000000000000000 0x0000000000000000
0x000000c000725380: 0x0000000000000000 0x0000000000000000
0x000000c000725390: 0x0000000000000000 0x0000000000000000
0x000000c0007253a0: 0x0000000000000000 0x0000000000000000
0x000000c0007253b0: 0x0000000000000000 0x0000000000000000
0x000000c0007253c0: 0x0000000000000000 0x0000000000000000
0x000000c0007253d0: 0x0000000000000000 0x0000000000000000
0x000000c0007253e0: 0x0000000000000000 0x0000000000000000
0x000000c0007253f0: 0x0000000000000000 0x0000000000000000
0xc000725800 free unmarked
fatal error: found pointer to free object
runtime stack:
runtime.throw({0x113fa1f, 0xc000725400})
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/panic.go:1198 +0x71
runtime.(*mspan).reportZombies(0x7fbb8e183db8)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgcsweep.go:691 +0x2e5
runtime.(*sweepLocked).sweep(0x0, 0x0)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgcsweep.go:519 +0x33a
runtime.(*mcentral).uncacheSpan(0xc000061e60, 0xc000061e50)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mcentral.go:223 +0xa9
runtime.(*mcache).releaseAll(0x7fbbb4f59108)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mcache.go:279 +0x125
runtime.(*mcache).prepareForSweep(0x7fbbb4f59108)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mcache.go:317 +0x39
runtime.procresize(0x2)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/proc.go:5060 +0x476
runtime.startTheWorldWithSema(0x1)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/proc.go:1256 +0x8b
runtime.gcMarkTermination.func3()
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:1032 +0x1e
runtime.systemstack()
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/asm_amd64.s:383 +0x49
goroutine 5 [running]:
runtime.systemstack_switch()
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/asm_amd64.s:350 fp=0xc000048560 sp=0xc000048558 pc=0x464a60
runtime.gcMarkTermination(0x1c38fa0)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:1032 +0x4fa fp=0xc000048708 sp=0xc000048560 pc=0x41b93a
runtime.gcMarkDone()
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:902 +0x27d fp=0xc000048760 sp=0xc000048708 pc=0x41b33d
runtime.gcBgMarkWorker()
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:1330 +0x2f1 fp=0xc0000487e0 sp=0xc000048760 pc=0x41c4d1
runtime.goexit()
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0000487e8 sp=0xc0000487e0 pc=0x466b41
created by runtime.gcBgMarkStartWorkers
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/mgc.go:1124 +0x25
goroutine 1 [chan receive, 359 minutes]:
go.uber.org/fx.(*App).run(0xc00007f380, 0x0)
/home/runner/go/pkg/mod/go.uber.org/[email protected]/app.go:618 +0x91
go.uber.org/fx.(*App).Run(0xc00007f380)
/home/runner/go/pkg/mod/go.uber.org/[email protected]/app.go:605 +0x2b
main.start()
/home/runner/work/server/server/main.go:89 +0x615
main.main()
/home/runner/work/server/server/main.go:48 +0x2b
goroutine 22 [select, 2 minutes]:
github.com/uber-go/tally/v4.(*scope).reportLoop(0xc000414900, 0x0)
/home/runner/go/pkg/mod/github.com/uber-go/tally/[email protected]/scope.go:238 +0xd6
github.com/uber-go/tally/v4.newRootScope.func1()
/home/runner/go/pkg/mod/github.com/uber-go/tally/[email protected]/scope.go:180 +0x65
created by github.com/uber-go/tally/v4.newRootScope
/home/runner/go/pkg/mod/github.com/uber-go/tally/[email protected]/scope.go:178 +0x78d
goroutine 25 [select, 359 minutes]:
database/sql.(*DB).connectionOpener(0xc0000a4c30, {0x139ded0, 0xc00065c140})
/opt/hostedtoolcache/go/1.17.10/x64/src/database/sql/sql.go:1196 +0x93
created by database/sql.OpenDB
/opt/hostedtoolcache/go/1.17.10/x64/src/database/sql/sql.go:794 +0x188
goroutine 26 [select, 2 minutes]:
github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1()
/home/runner/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:614 +0xb0
created by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher
/home/runner/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:611 +0x105
goroutine 27 [select, 359 minutes]:
database/sql.(*DB).connectionCleaner(0xc0000a4c30, 0x0)
/opt/hostedtoolcache/go/1.17.10/x64/src/database/sql/sql.go:1068 +0xbd
created by database/sql.(*DB).startCleanerLocked
/opt/hostedtoolcache/go/1.17.10/x64/src/database/sql/sql.go:1055 +0x105
goroutine 30 [select, 2 minutes]:
github.com/go-redis/redis/v8/internal/pool.(*ConnPool).reaper(0xc0005c7860, 0xc0000b9860)
/home/runner/go/pkg/mod/github.com/go-redis/redis/[email protected]/internal/pool/pool.go:485 +0xda
created by github.com/go-redis/redis/v8/internal/pool.NewConnPool
/home/runner/go/pkg/mod/github.com/go-redis/redis/[email protected]/internal/pool/pool.go:111 +0x229
goroutine 35 [IO wait, 2 minutes]:
internal/poll.runtime_pollWait(0x7fbb8e2f6278, 0x72)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/netpoll.go:303 +0x85
internal/poll.(*pollDesc).wait(0xc000684000, 0xc0006e9000, 0x0)
/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc000684000, {0xc0006e9000, 0x1000, 0x1000})
/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc000684000, {0xc0006e9000, 0xc000684000, 0xc000778000})
/opt/hostedtoolcache/go/1.17.10/x64/src/net/fd_posix.go:56 +0x29
net.(*conn).Read(0xc0006e6008, {0xc0006e9000, 0xfd7000, 0xc0006f9350})
/opt/hostedtoolcache/go/1.17.10/x64/src/net/net.go:183 +0x45
bufio.(*Reader).fill(0xc0006fe300)
/opt/hostedtoolcache/go/1.17.10/x64/src/bufio/bufio.go:101 +0x103
bufio.(*Reader).Peek(0xc0006fe300, 0x1)
/opt/hostedtoolcache/go/1.17.10/x64/src/bufio/bufio.go:139 +0x5d
github.com/valyala/fasthttp.(*Server).serveConn(0xc00065ab40, {0x13b9990, 0xc0006e6008})
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/server.go:2155 +0x5d1
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0007fe000, 0xc0006ec000)
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:224 +0xa9
github.com/valyala/fasthttp.(*workerPool).getCh.func1()
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:196 +0x38
created by github.com/valyala/fasthttp.(*workerPool).getCh
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:195 +0x1b5
goroutine 8 [syscall, 359 minutes]:
os/signal.signal_recv()
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/sigqueue.go:169 +0x98
os/signal.loop()
/opt/hostedtoolcache/go/1.17.10/x64/src/os/signal/signal_unix.go:24 +0x19
created by os/signal.Notify.func1.1
/opt/hostedtoolcache/go/1.17.10/x64/src/os/signal/signal.go:151 +0x2c
goroutine 11 [sleep, 2 minutes]:
time.Sleep(0x2540be400)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/time.go:193 +0x12e
github.com/valyala/fasthttp.(*workerPool).Start.func2()
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:67 +0x56
created by github.com/valyala/fasthttp.(*workerPool).Start
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:59 +0xde
goroutine 10 [IO wait, 2 minutes]:
internal/poll.runtime_pollWait(0x7fbb8e2f6368, 0x72)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/netpoll.go:303 +0x85
internal/poll.(*pollDesc).wait(0xc0007bad00, 0xc000040800, 0x0)
/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Accept(0xc0007bad00)
/opt/hostedtoolcache/go/1.17.10/x64/src/internal/poll/fd_unix.go:402 +0x22c
net.(*netFD).accept(0xc0007bad00)
/opt/hostedtoolcache/go/1.17.10/x64/src/net/fd_unix.go:173 +0x35
net.(*TCPListener).accept(0xc0003e45b8)
/opt/hostedtoolcache/go/1.17.10/x64/src/net/tcpsock_posix.go:140 +0x28
net.(*TCPListener).Accept(0xc0003e45b8)
/opt/hostedtoolcache/go/1.17.10/x64/src/net/tcpsock.go:262 +0x3d
github.com/valyala/fasthttp.acceptConn(0xc00065ab40, {0x1395818, 0xc0003e45b8}, 0xc000804e80)
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/server.go:1913 +0x62
github.com/valyala/fasthttp.(*Server).Serve(0xc00065ab40, {0x1395818, 0xc0003e45b8})
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/server.go:1826 +0x4ea
github.com/gofiber/fiber/v2.(*App).Listener(0xc00000a780, {0x1395818, 0xc0003e45b8})
/home/runner/go/pkg/mod/github.com/gofiber/fiber/[email protected]/app.go:776 +0xd0
github.com/bangumi/server/internal/web.Listen.func1.1()
/home/runner/work/server/server/internal/web/index.go:88 +0x37
created by github.com/bangumi/server/internal/web.Listen.func1
/home/runner/work/server/server/internal/web/index.go:87 +0x1da
goroutine 39 [sleep]:
time.Sleep(0x3b9aca00)
/opt/hostedtoolcache/go/1.17.10/x64/src/runtime/time.go:193 +0x12e
github.com/valyala/fasthttp.updateServerDate.func1()
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/header.go:2050 +0x1e
created by github.com/valyala/fasthttp.updateServerDate
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/header.go:2048 +0x27
goroutine 22000 [select, 2 minutes]:
github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1()
/home/runner/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:614 +0xb0
created by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher
/home/runner/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection.go:611 +0x105
goroutine 32742 [chan receive, 2 minutes]:
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc0007fe000, 0xc0003380c0)
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:219 +0x65
github.com/valyala/fasthttp.(*workerPool).getCh.func1()
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:196 +0x38
created by github.com/valyala/fasthttp.(*workerPool).getCh
/home/runner/go/pkg/mod/github.com/valyala/[email protected]/workerpool.go:195 +0x1b5
@Sai 老板建议改成 AGPL 授权,目前代码库包括我共有6个 contributors。由于agpl和bsd并不相容,所以希望能征得大家的同意,一次性修改掉,避免复杂的问题。
希望mogucloud看到这个issue回复一下,emoji没有通知提醒…
编辑历史API拥有一个公用前缀 /v0/revisions/
, 按照不同的编辑种类分成不同的子路由
/v0/revsions/subjects?subject_id=$value
/v0/revsions/subjects/{rev_id}
其他wiki类型如人物/角色/章节类似。
稍微做了一点,把现在的各种时间线type和对应的类型整理出来了 master...feature/timeline
和 bangumi/api#70 相同的问题,sai只修改了老API。
如果API返回422,响应缺少 Access-Control-Allow-Origin header
重现方法:
主要分为两部分,条目进度管理和单集进度管理。
两部分有些耦合,修改剧集收藏状态时应该同时修改条目的进度状态。反之亦然。
同时还要生成对应的时间线。
以名侦探柯南为例。
官网的章节信息已经更新到了1000以上。
https://bangumi.tv/subject/899/ep
api中只返回到第1000章(这可能是为了限制返回数据的大小),应该有一个分页参数。
https://api.bgm.tv/subject/899/ep/
How to reproduce:
{
"title": "Invalid Request",
"description": "One or more parameters to your request was invalid.",
"detail": [
{
"loc": [
"query",
"type"
],
"msg": "value is not a valid enumeration member; permitted: 1, 2, 3",
"type": "type_error.enum",
"ctx": {
"enum_values": [
1,
2,
3
]
}
}
]
}
目前这个搜索功能感觉有点弱。
之前没有用python写过后端,底层数据库用的是mysql么?方便后续做复杂查询吗?
search 分支,大概会用 meilisearch 来做。
能不能有一个api能302到指定subject的图片,比如
/api/subject/xxx/image?type=large
在某些只有标题id没有其他信息的地方能用上
角色和人物同理
应该是有入库,但目前的前端没有查看方法
在这个表中 https://github.com/bangumi/dev-env/blob/main/sql/schema/chii_rev_history.sql
各种 type 的定义在这个php文件中 https://gist.github.com/Trim21/2f12d92b04ee65dcd9026ffdb1bfb800
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are awaiting their schedule. Click on a checkbox to get an update now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
etc/Dockerfile
gcr.io/distroless/static sha256:41972110a1c1a5c0b6adb283e8aa092c43c31f7c5d79b8656fbffff2c3e61f05
.github/workflows/build.yaml
actions/checkout v4
actions/setup-go v5
actions/cache v4
arduino/setup-task v2
ubuntu 22.04
.github/workflows/lint-review.yaml
actions/checkout v4
actions/setup-node v4
actions/setup-go v5
autofix-ci/action dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a
.github/workflows/lint.yaml
actions/checkout v4
actions/setup-go v5
actions/cache v4
golangci/golangci-lint-action v6
ubuntu 22.04
.github/workflows/release-docker.yaml
actions/checkout v4
actions/setup-go v5
actions/cache v4
arduino/setup-task v2
docker/metadata-action v5
docker/login-action v3
docker/build-push-action v6
ubuntu 22.04
.github/workflows/release-openapi.yaml
actions/checkout v4
actions/setup-node v4
actions/checkout v4
peter-evans/create-pull-request v6
actions/checkout v4
ubuntu 22.04
.github/workflows/release.yaml
actions/checkout v4
requarks/changelog-action v1.10.2
ubuntu 22.04
.github/workflows/test-openapi.yaml
actions/checkout v4
actions/setup-node v4
.github/workflows/test.yaml
actions/checkout v4
actions/setup-go v5
arduino/setup-task v2
actions/cache v4
codecov/codecov-action v4
ubuntu 22.04
go.mod
github.com/avast/retry-go/v4 v4.6.0
github.com/aws/aws-sdk-go v1.54.11
github.com/davecgh/go-spew v1.1.1
github.com/elliotchance/phpserialize v1.4.0
github.com/go-playground/locales v0.14.1
github.com/go-playground/universal-translator v0.18.1
github.com/go-playground/validator/v10 v10.22.0
github.com/go-redis/redismock/v9 v9.2.0
github.com/go-resty/resty/v2 v2.13.1
github.com/go-sql-driver/mysql v1.8.1
github.com/ilyakaznacheev/cleanenv v1.5.0
github.com/jarcoal/httpmock v1.3.1
github.com/labstack/echo/v4 v4.12.0
github.com/mattn/go-colorable v0.1.13
github.com/meilisearch/meilisearch-go v0.26.3
github.com/mitchellh/mapstructure v1.5.0
github.com/prometheus/client_golang v1.19.1
github.com/redis/go-redis/v9 v9.5.3
github.com/samber/lo v1.44.0
github.com/segmentio/kafka-go v0.4.47
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
github.com/trim21/errgo v0.0.2
github.com/trim21/go-phpserialize v0.0.22
github.com/trim21/go-redis-prometheus v0.0.0
github.com/trim21/htest v0.0.4
github.com/trim21/pkg v0.0.3
go.etcd.io/etcd/client/v3 v3.5.14
go.uber.org/fx v1.22.1
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.24.0
google.golang.org/grpc v1.64.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/mysql v1.5.7
gorm.io/gen v0.3.26
gorm.io/gorm v1.25.10
gorm.io/plugin/dbresolver v1.5.2
gorm.io/plugin/soft_delete v1.2.1
package.json
@apidevtools/json-schema-ref-parser ^11.7.0
js-yaml ^4.1.0
lodash ^4.17.21
colors ^1.4.0
oas-validator ^5.0.8
prettier ^3.3.3
隔壁客户端经常被谷歌商店下架(bgm38)
subject列表请求也需要带上过滤或者标记,类似于
api.bgm.tv/subject/search?key=xxx&filter=nsfw,eq,0
最好是小组和讨论也能带上
见 https://bgm.tv/group/topic/366561#post_1921543
是不是可以到时候把bangumi-data的关联条目一起整合起来?或者更进一步,把数据系统化,和bangumi-data的数据做融合?(毕竟同时存在多套轮子也会产生不便)
以及,关于数据关联数据,是不是可以考虑对每一个分集都做关联。因为会有很多特殊情况,如:
响应和分页大致参照人物API。
path:
/v0/characters
/v0/characters/{character_id}
/v0/characters/{character_id}/subjects
查询数据的表不同
虚拟角色的关联只有三种,
$typeList = array(
1 => '主角',
2 => '配角',
3 => '客串',
);
不带token请求 https://api.bgm.tv/v0/subjects/198693/subjects
会返回不带token无法访问的 https://api.bgm.tv/v0/subjects/126255
最好一并过滤了
/v0/subjects/{subject_id}
话说有个小建议,旧api读条目信息,只能获取到作品原名(name)和中文名(name_cn),获取不到“别名”信息。比如条目14435,只能读到原名いろとりどりのセカイ与中文名 五彩斑斓的世界 ,读不到别名 色鸟鸟 。
要命的是,很多游戏条目的汉化名实际上是写在别名栏里的;这样用api就永远读不到作品的中文名(bgm38)
万望新api能改善(bgm106)
https://bgm.tv/group/topic/366500#post_1916978
参照人物使用 pol.wiki.parse()
解析 infobox 并且作为一个字段返回
/v0/subjects/{subject_id}/persons
/v0/subjects/{subject_id}/characters
/v0/subjects/{subject_id}/episodes
参照原有的分页api /v0/persons
,以相同的参数支持分页。
以名侦探柯南为例。
官网的章节信息已经更新到了1000以上。
https://bangumi.tv/subject/899/ep
api中只返回到第1000章(这可能是为了限制返回数据的大小),应该有一个分页参数。
https://api.bgm.tv/subject/899/ep/
描述
简短的表述你遇到的问题
角色关联人物没有显示正确的条目id
如何重现
预期
关联人物信息应该包含上述条目的id
实际行为
关联人物信息的条目id是错误的
额外信息
CF-Ray
: ``User-Agent
: ``参照人物编辑历史issue
需要通知
你想添加的新功能
网页上,角色的出演列表,以及人物的角色列表,均包含了作品中,角色的类别:按照源码看,有三个类别:
1: 主角
2: 配角
3: 客串
这个字段目前只能从/v0/subjects/{subject_id}/characters或者characters/{character_id}/subjects结果获得。
那么实现网页上的效果,就要请求两次
你希望的解决方案
在上述API中加入staff字段
其他可能的替代方案
GraphQL(长远考虑
其他相关信息
https://api.bgm.tv/v0/episodes?subject_id=86895&limit=50&offset=0
{
"total": 2,
"limit": 50,
"offset": 0,
"data": [
{
"id": 357730,
"type": 0,
"name": "沖縄へ行くことになった",
"name_cn": "",
"sort": 13.0,
"ep": 1.0,
"airdate": "2014-07-23",
"comment": 37,
"duration": "",
"desc": "脚本:吉田玲子 分镜/演出:川面真也",
"disc": 0
},
{
"id": 602249,
"type": 0,
"name": "",
"name_cn": "",
"sort": 13.0,
"ep": 1.0,
"airdate": "2016-09-23",
"comment": 0,
"duration": "",
"desc": "",
"disc": 0
}
]
}
id为602249的数据是无效的,直接用id访问网站也会报错 https://bgm.tv/ep/602249
I'm requesting MAL Sync to add support for Bangumi but they need the following APIs to be implemented. Detailed discussions can be found at MALSync/MALSync#792.
lolamtisch commented on Jul 9
This should prety much be all informations needed per api call.
Single Entry internalId: any malId: number type: 'anime' | 'manga' url: string userStatus: 'watching' | 'pantowatch' | 'completed' .... userScore: any userWatchedEpisode / chapter: number userWatchedVolumens: number totalEpisodes: number totalVolumes: number image: string globalScore: any // possible to filter by userState list[] internalId: any malId: number type: 'anime' | 'manga' title: string url: string totalEp: number userWatchedEpisode / chapter: number userStatus: 'watching' | 'pantowatch' | 'completed' .... userScore: any image: string Search[] id: number; name: string; altNames: string[]; url: string; image: string; Overview metadata: Just metadata not important
看了open-api里貌似没有类似的接口,这个可不可以支持一下呢?
你想添加的新功能
以这个漫画系列为例 https://bgm.tv/subject/135218 该条目为 漫画 系列 其下有若干个单行本条目
你希望的解决方案
可为subject增加一个property: isSet (或者isSeries, isCollection)
对于系列类subject,增加一个API,查找其所有的单行本的subject
其他可能的替代方案
暂未找到其他API可以替代, 从数据库角度可以找关联条目只有该系列条目的条目,但API似乎没找到反过来查的
其他相关信息
关联到 bangumi/dev-docs#1 的 Stage 2
SQL Schema:
模块:
枚举日志
a} 在 /user/{uid}/blog 中枚举
b} 在 /{category}/blog 中枚举
与仅好友可见相关功能
新增日志 /blog/create
修改日志 /blog/{id}/edit
删除日志 /erase/entry/{id}
展示日志 /blog/{id}
/episodes/{episode_id}/revisions
id
为表中 rev_id
。按时间倒叙,不允许任何过滤。{
"total": 1,
"limit": 100,
"offset": 0,
"data": [
{
"id": 1,
"creator": {
"id": 2,
"username": "abc",
"nickname": "def",
"avatar": "..."
},
"timestamp": "2021-11-20T15:06:03+00:00",
"summary": ""
}
]
}
/episodes/{episode_id}/revisions/{rev_id}
客户端里是解析网页的,在功能没有完全覆盖之前客户端需要存两套登录信息非常麻烦,如果可以那就太方便了
Bangumi 的讨论贴仅支持二级回复,目前考虑了两种可能的响应结构:
跟网页一样返回一个树装(最多二级)的结构,分页仅针对顶级回复。
{
"title": "请教大神R2为什么节奏没有R1好",
"created_at": "2021-08-10T10:06:09+00:00",
"content": "请教大神R2为什么节奏没有R1好 我R2通篇看完下来没觉着有啥不妥的",
"creator": $Creator,
"replies": {
"total": 0,
"limit": 0,
"offset": 0,
"data": [
{
"id": 171126,
"text": "不好意思 没有熟悉操作发送了两遍",
"created_at": "2021-08-10T10:07:04+00:00",
"creator": $Creator
},
{
"id": 171127,
"text": "凭空出现的设定、暴风般的剧情进展、语焉不详的心理活动。",
"created_at": "2021-08-10T10:19:09+00:00",
"reply_to": 0,
"creator": null,
"replies": [
{
"id": 171128,
"text": "凭空设定出自哪集? 是什么设定?",
"created_at": "2021-08-10T10:21:29+00:00",
"creator": $Creator
},
{
"id": 171129,
"text": "[quote][b]翔の意识[/b] 说: 凭空设定出自哪集? 是什么设定?[/quote]\n“C的世界”整集都是在神棍式地乱抛设定。",
"created_at": "2021-08-10T10:39:05+00:00",
"creator": $Creator
},
]
},
{
"id": 171148,
"text": "据一位业内人士说是大人的原因……\r\n好像原本预定有三季还是怎么回事,结果做了几集突然被金主告知要在两季内结束。",
"created_at": "2021-08-11T01:56:40+00:00",
"creator": $Creator
}
]
}
}
返回一个一维结构,由客户端进一步处理。
这样一来分页仅按照时间顺序进行。
{
"title": "请教大神R2为什么节奏没有R1好",
"created_at": "2021-08-10T10:06:09+00:00",
"content": "请教大神R2为什么节奏没有R1好 我R2通篇看完下来没觉着有啥不妥的",
"creator": $Creator,
"replies": {
"total": 0,
"limit": 0,
"offset": 0,
"data": [
{
"id": 171126,
"text": "不好意思 没有熟悉操作发送了两遍",
"created_at": "2021-08-10T10:07:04+00:00",
"reply_to": 0,
"creator": $Creator
},
{
"id": 171127,
"text": "凭空出现的设定、暴风般的剧情进展、语焉不详的心理活动。",
"created_at": "2021-08-10T10:19:09+00:00",
"reply_to": 0,
"creator": null
},
{
"id": 171128,
"text": "凭空设定出自哪集? 是什么设定?",
"created_at": "2021-08-10T10:21:29+00:00",
"reply_to": 171127,
"creator":$Creator
},
{
"id": 171129,
"text": "[quote][b]翔の意识[/b] 说: 凭空设定出自哪集? 是什么设定?[/quote]\n“C的世界”整集都是在神棍式地乱抛设定。",
"created_at": "2021-08-10T10:39:05+00:00",
"reply_to": 171127,
"creator": $Creator
},
{
"id": 171148,
"text": "据一位业内人士说是大人的原因……\r\n好像原本预定有三季还是怎么回事,结果做了几集突然被金主告知要在两季内结束。",
"created_at": "2021-08-11T01:56:40+00:00",
"reply_to": 0,
"creator": $Creator
}
]
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.