- group为admin特殊显示,评论接口已返回group信息
- 评论楼中楼
- 评论通知(浏览器通知)
- 最新评论(id为-1)
- 联合搜索,当本地数据库搜索不到数据时,会返回extra字段
- 添加资源API
- 联合搜索:字幕侠、new字幕组、追新番
- 评论通知,需要新接口
- grafana面板
- 豆瓣接口
- 用户体系(添加邮箱,邮件支持,找回密码)
- GET
/api/resource?id=10004
数据结构参考 sample.json
- GET
/api/resource?keyword=逃避
{
"data": [
{
"data": {
"info": {
"id": 34812,
"cnname": "逃避可耻却有用",
"enname": "NIGERUHA HAJIDAGA YAKUNITATSU",
"aliasname": "逃避虽可耻但有用 / 雇佣妻子(港) / 月薪娇妻(台) / 逃跑是可耻但是有用 / 逃避虽可耻但很有用 / 逃避可耻但有用",
"channel": "tv",
"channel_cn": "日剧",
"area": "日本",
"show_type": "",
"expire": "1610399344",
"views": 1201,
"year": [
2016,
2017,
2021
]
}
}
},
{
"data": {
"info": {
"id": 29540,
"cnname": "无法逃避",
"enname": "Inescapable",
"aliasname": "无法避免",
"channel": "movie",
"channel_cn": "电影",
"area": "加拿大",
"show_type": "",
"expire": "1610396227",
"views": 1,
"year": [
2012
]
}
}
},
{
"data": {
"info": {
"id": 37089,
"cnname": "逃避者",
"enname": "Shirkers",
"aliasname": "",
"channel": "movie",
"channel_cn": "电影",
"area": "美国",
"show_type": "",
"expire": "1610400512",
"views": 0,
"year": [
2018
]
}
}
}
]
}
当数据库搜索不到资源时,会尝试从字幕侠、new字幕组和追新番搜索,返回如下
{
"data": [],
"extra": {
"name": "东城梦魇",
"url": "https://www.zimuxia.cn/portfolio/%e4%b8%9c%e5%9f%8e%e6%a2%a6%e9%ad%87"
}
}
获取top信息,每类返回15条访问量最高的数据
- GET
/api/top
{
"ALL": [
{
"data": {
"info": {
"id": 39894,
"cnname": "速度与激情9",
"enname": "F9: The Fast Saga",
"aliasname": "F9狂野时速(港)/玩命关头9(台)/狂野时速9/速激9/FF9/Fast & Furious 9",
"channel": "movie",
"channel_cn": "电影",
"area": "美国",
"show_type": "",
"expire": "1610401946",
"views": 47466,
"year": [
2021
]
}
}
},
{
"data": {
"info": {
"id": 38413,
"cnname": "致命女人",
"enname": "Why Women Kill",
"aliasname": "女人为什么杀人/女人为何杀戮",
"channel": "tv",
"channel_cn": "美剧",
"area": "美国",
"show_type": "",
"expire": "1610401185",
"views": 39040,
"year": [
2019
]
}
}
}
],
"US": [],
"JP": [],
"KR": [],
"UK": [],
"class": {
"ALL": "全部",
"US": "美国",
"JP": "日本",
"KR": "韩国",
"UK": "英国"
}
}
获取个人收藏
- GET
/api/like
{
"LIKE": [
{
"data": {
"info": {
"id": 39523,
"cnname": "禁忌女孩",
"enname": "เด็กใหม่",
"aliasname": "来路不明的转校生/Girl from Nowhere",
"channel": "tv",
"channel_cn": "泰剧",
"area": "泰国",
"show_type": "",
"expire": "1610401752",
"views": 979,
"year": [
2020
]
}
}
}
]
}
- POST
/api/user
,提交json,字段username
,password
登录用户可用,未登录会返回401
- GET
/api/user
{
"username": "Benny",
"date": "2021-03-12 11:11:11",
"lastDate": "2021-03-15 13:11:18",
"ip": "1.1.1.1",
"lastIP": "2.2.2.2",
"browser": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.85 Safari/537.36",
"like": [
11133
],
"group": [
"admin",
"user"
]
}
- GET
/api/name
- GET
/api/name?human=1
人类可读
- PATCH
/api/user
,提交json,字段resource_id
评论的基本数据格式: children
字段为 array/list,可套娃另外一条评论,目前暂时只支持两层(也不打算支持更多的啦)。
评论的 resource_id
必须相同
{
"username": "Benny",
"date": "2021-06-17 10:54:19",
"browser": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.13; rv:85.1) Gecko/20100101 Firefox/85.1",
"content": "test",
"resource_id": 233,
"id": "60cab95baa7f515ea291392b",
"children": [
],
"children_count": 0
}
{
"username": "Benny",
"date": "2021-06-17 10:54:19",
"browser": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.13; rv:85.1) Gecko/20100101 Firefox/85.1",
"content": "test",
"resource_id": 233,
"id": "60cab95baa7f515ea291392b",
"children": [
{
"username": "Alex",
"date": "2021-05-31 16:58:21",
"browser": "PostmanRuntime/7.28.0",
"content": "评论17",
"id": "60c838a12a5620b7e4ba5dfc",
"resource_id": 233
},
{
"username": "Paul",
"date": "2021-05-22 16:58:21",
"browser": "PostmanRuntime/7.28.0",
"content": "评论14",
"id": "60c838a12a5620b7e4ba1111",
"resource_id": 233
}
],
"children_count": 2
}
- GET
/api/comment
分页,支持URL参数:
- resource_id: 资源id,id为233是留言板,id为-1会返回最新评论
- size: 每页评论数量,默认5
- page: 当前页,默认1
- inner_size: 内嵌评论数量,默认5
- inner_page: 内嵌评论当前页,默认1
返回 楼中楼评论,group表示用户所属组,admin是管理员,user是普通用户
{
"data": [
{
"username": "Benny",
"date": "2021-06-22 18:26:42",
"browser": "PostmanRuntime/7.28.0",
"content": "父评论benny",
"resource_id": 233,
"type": "parent",
"id": "60d1bae2d87ce6e9a2934a0f",
"group": [
"admin"
]
},
{
"username": "Benny",
"date": "2021-06-22 18:24:44",
"browser": "PostmanRuntime/7.28.0",
"content": "父评论benny",
"resource_id": 233,
"type": "parent",
"group": [
"admin"
],
"children": [
{
"username": "test",
"date": "2021-06-22 18:25:12",
"browser": "PostmanRuntime/7.28.0",
"content": "admin子评2论2",
"resource_id": 233,
"type": "child",
"id": "60d1ba88d87ce6e9a2934a0c",
"group": [
"user"
]
},
{
"username": "admin",
"date": "2021-06-22 18:25:08",
"browser": "PostmanRuntime/7.28.0",
"content": "admin子评论2",
"resource_id": 233,
"type": "child",
"id": "60d1ba84d87ce6e9a2934a0a",
"group": [
"user"
]
}
],
"id": "60d1ba6cd87ce6e9a2934a08"
}
],
"count": 2,
"resource_id": 233
}
- GET
/api/captcha?id=1234abc
,id是随机生成的字符串 API 返回字符串,形如data:image/png;base64,iVBORw0KGgoAAA....
- POST
/api/comment
只有登录用户才可以发表评论,检查cookieusername
是否为空来判断是否为登录用户;未登录用户提示“请登录后发表评论”
resource_id
从URL中获取,id是上一步验证码的那个随机字符串id, captcha
是用户输入的验证码
只需要提供如下四项信息即可
{
"resource_id": 39301,
"content": "评论内容",
"id": "1234abc",
"captcha": "38op"
}
返回 HTTP 201添加评论成功,403/401遵循HTTP语义
{
"message": "评论成功/评论失败/etc"
}
还需要额外提供一个 comment_id
,也就是 UUID,如 60c838a12a5620b7e4ba5dfc
{
"resource_id": 39301,
"content": "评论内容",
"id": "1234abc",
"captcha": "38op",
"comment_id": "60c838a12a5620b7e4ba5dfc"
}
- DELETE
/api/comment
,提交json数据
{
"comment_id": "60cab935e9f929e09c91392a"
}
不用关心comment_id是子评论还是父评论,会自动删除
返回被删除的数量,HTTP 200表示删除成功,404表示未找到这条留言
{
"status_code": 404,
"message": "",
"count": 0
}
- POST
/api/metrics
, json,字段type
- GET
/api/metrics
,默认返回最近7天数据,可选URL参数from
,to
,如 `from=2021-03-12&to=2021-03=18
- GET
/api/grafana/
- GET
/api/grafana/search
- GET
/api/grafana/query
- GET
/api/blacklist
- GET
/api/db_dump
{
"yyets_mongo.gz": {
"checksum": "b32e9d8e24c607a9f29889a926c15179d9179791",
"date": "2021-06-14 12:59:51",
"size": "6.0B"
},
"yyets_mysql.zip": {
"checksum": "6b24ae7cb7cef42951f7e2df183f0825512029e0",
"date": "2021-06-14 12:59:51",
"size": "11.0B"
},
"yyets_sqlite.zip": {
"checksum": "7e1659ab5cbc98b21155c3debce3015c39f1ec05",
"date": "2021-06-14 12:59:51",
"size": "15.0B"
}
}
- POST
/api/announcement
, json 字段 content
- GET
/api/announcmement
,接受URL参数 size、page
{
"data": [
{
"username": "Benny",
"date": "2021-06-15 16:28:16",
"browser": "PostmanRuntime/7.28.0",
"content": "hello"
}
],
"count": 1
}