-
Notifications
You must be signed in to change notification settings - Fork 204
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
添加发送专栏的api #742
Comments
{
"raw_content": "{\"ops\":[{\"insert\":\"test2233\\n\"},{\"attributes\":{\"class\":\"normal-img\"},\"insert\":{\"native-image\":{\"alt\":\"read-normal-img\",\"url\":\"https://article.biliimg.com/bfs/new_dyn/bcdecbbf01b……67389.jpg@.webp\",\"width\":410,\"height\":286,\"size\":81963,\"status\":\"loaded\"}}},{\"insert\":\"\\n\"}]}",
"opus_req": {
"upload_id": "3847……7433",
"opus": {
"opus_source": 2,
"title": "test",
"content": {
"paragraphs": [
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "test2233",
"font_size": 17,
"style": {}
}
}
]
}
},
{
"para_type": 2,
"pic": {
"style": 1,
"pics": [
{
"url": "https://article.biliimg.com/bfs/new_dyn/bcdecbbf01b……84767389.jpg",
"width": 410,
"height": 286,
"size": 80.0419921875
}
]
}
},
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "\n",
"font_size": 17,
"style": {}
}
}
]
}
}
]
},
"article": {
"category_id": 15,
"list_id": 0,
"originality": 0,
"reproduced": 0
},
"pub_info": {}
},
"scene": 12,
"meta": {
"app_meta": {
"from": "create.article.web",
"mobi_app": "web"
}
},
"option": {
"close_comment": 1
}
},
"draft_id_str": "295560",
"ts": 1712889307
} 发布专栏的接口
上传专栏图片的 app上发布旧版专栏的话主要就这俩了吧 感觉要先实现一个专栏json的生成器 |
需要协助的话可以说下,我今天还有点空 |
说实话还没开始,今天休息hh |
我顶多就只有周日了,暑假就真高三了... |
在这里测试不错 {
"ops": [
{
"attributes": {
"color": "#60d837"
},
"insert": "test"
},
{
"attributes": {
"header": 2
},
"insert": "\n"
},
{
"insert": "\ndwdwdaw"
},
{
"attributes": {
"list": "bullet"
},
"insert": "\n"
},
{
"insert": "d4wad444444"
},
{
"attributes": {
"align": "right",
"list": "bullet"
},
"insert": "\n"
},
{
"insert": "dwdw"
},
{
"attributes": {
"align": "center"
},
"insert": "\n"
},
{
"attributes": {
"class": "cut-off"
},
"insert": {
"cut-off": {
"type": "0",
"url": "https://i0.hdslb.com/bfs/article/0117cbba35e51b0bce5f8c2f6a838e8a087e8ee7.png"
}
}
},
{
"attributes": {
"italic": true,
"link": "https://www.bilibili.com/video/BV1xr421b7YG?spm_id_from=333.1007.tianma.1-1-1.click"
},
"insert": "tql"
},
{
"attributes": {
"blockquote": true
},
"insert": "\n"
},
{
"insert": "wdad\n"
},
{
"attributes": {
"class": "normal-img"
},
"insert": {
"native-image": {
"alt": "read-normal-img",
"url": "https://article.biliimg.com/bfs/new_dyn/6e7d28ed54b3f32f8cb78f6fda21d70c558830935.jpg@.webp",
"width": 3840,
"height": 2160,
"size": 213769,
"status": "loaded"
}
}
},
{
"insert": "\n"
},
{
"attributes": {
"blockquote": true
},
"insert": "\n"
},
{
"insert": "\n"
},
{
"attributes": {
"class": "cut-off"
},
"insert": {
"cut-off": {
"type": "5",
"url": "https://i0.hdslb.com/bfs/article/02db465212d3c374a43c60fa2625cc1caeaab796.png"
}
}
},
{
"insert": "\n"
},
{
"attributes": {
"header": 2
},
"insert": "\n"
},
{
"insert": "11"
},
{
"attributes": {
"color": "#ea0077"
},
"insert": "dw"
},
{
"attributes": {
"color": "#fff359"
},
"insert": "dw"
},
{
"attributes": {
"color": "#fff359",
"italic": true
},
"insert": "dwdaw"
},
{
"attributes": {
"header": 2
},
"insert": "\n"
},
{
"insert": "😅❤️❤️\n\n"
},
{
"attributes": {
"class": "cut-off"
},
"insert": {
"cut-off": {
"type": "3",
"url": "https://i0.hdslb.com/bfs/article/db75225feabec8d8b64ee7d3c7165cd639554cbc.png"
}
}
},
{
"insert": "\n"
},
{
"attributes": {
"strike": true,
"italic": true
},
"insert": "dwadw"
},
{
"attributes": {
"strike": true,
"bold": true
},
"insert": "dw"
},
{
"attributes": {
"header": 1
},
"insert": "\n"
}
]
} |
不提交就么有 {
"raw_content": "{\"ops\":[{\"attributes\":{\"strike\":true,\"color\":\"#60d837\",\"bold\":true},\"insert\":\"test\"},{\"attributes\":{\"header\":2},\"insert\":\"\\n\"},{\"insert\":\"\\n\"},{\"attributes\":{\"italic\":true},\"insert\":\"dawhdhaw\"},{\"attributes\":{\"italic\":true,\"bold\":true},\"insert\":\"ohdouhhjkkkkkkk\"},{\"attributes\":{\"italic\":true},\"insert\":\"kkkkkkkkkkkkkkkkkkk\"},{\"attributes\":{\"color\":\"#73fdea\",\"italic\":true},\"insert\":\"kkkkkk\"},{\"attributes\":{\"italic\":true},\"insert\":\"kkkkkkkkk的娃娃对我打击和我觉得家里文化的\"},{\"attributes\":{\"strike\":true,\"italic\":true},\"insert\":\"交流和\"},{\"attributes\":{\"strike\":true,\"color\":\"#60d837\",\"italic\":true},\"insert\":\"挖掘\"},{\"attributes\":{\"strike\":true,\"italic\":true},\"insert\":\"了觉得我很了解啊好了大家好我立即回到老家记得和我交流活动链接和网络江湖大佬\"},{\"attributes\":{\"italic\":true},\"insert\":\"教我\"},{\"insert\":\"\\n测试\\nd4wad444444\"},{\"attributes\":{\"align\":\"right\",\"list\":\"bullet\"},\"insert\":\"\\n\"},{\"insert\":\"dwdw\"},{\"attributes\":{\"align\":\"center\"},\"insert\":\"\\n\"},{\"attributes\":{\"class\":\"cut-off\"},\"insert\":{\"cut-off\":{\"type\":\"0\",\"url\":\"https://article.biliimg.com/bfs/article/0117cbba35e51b0bce5f8c2f6a838e8a087e8ee7.png\"}}},{\"attributes\":{\"italic\":true,\"link\":\"https://www.bilibili.com/video/BV1xr421b7YG?spm_id_from=333.1007.tianma.1-1-1.click\"},\"insert\":\"tql\"},{\"insert\":\" 达瓦达瓦\"},{\"attributes\":{\"blockquote\":true},\"insert\":\"\\n\"},{\"insert\":\"wdad\\n\"},{\"attributes\":{\"class\":\"normal-img\"},\"insert\":{\"native-image\":{\"alt\":\"read-normal-img\",\"url\":\"https://article.biliimg.com/bfs/new_dyn/6e7d28ed54b3f32f8cb78f6fda21d70c558830935.jpg@.webp\",\"width\":3840,\"height\":2160,\"size\":213769,\"status\":\"loaded\"}}},{\"insert\":\"\\n\"},{\"attributes\":{\"blockquote\":true},\"insert\":\"\\n\"},{\"insert\":\"\\n\"},{\"attributes\":{\"class\":\"cut-off\"},\"insert\":{\"cut-off\":{\"type\":\"5\",\"url\":\"https://article.biliimg.com/bfs/article/02db465212d3c374a43c60fa2625cc1caeaab796.png\"}}},{\"insert\":\"\\n\"},{\"attributes\":{\"header\":2},\"insert\":\"\\n\"},{\"insert\":\"11\"},{\"attributes\":{\"color\":\"#ea0077\"},\"insert\":\"dw\"},{\"attributes\":{\"color\":\"#fff359\"},\"insert\":\"dw\"},{\"attributes\":{\"color\":\"#fff359\",\"italic\":true},\"insert\":\"dwdaw\"},{\"attributes\":{\"header\":2},\"insert\":\"\\n\"},{\"insert\":\"😅❤️❤️\\n\\n\"},{\"attributes\":{\"class\":\"cut-off\"},\"insert\":{\"cut-off\":{\"type\":\"3\",\"url\":\"https://article.biliimg.com/bfs/article/db75225feabec8d8b64ee7d3c7165cd639554cbc.png\"}}},{\"insert\":\"\\n\"},{\"attributes\":{\"strike\":true,\"italic\":true},\"insert\":\"dwadw\"},{\"attributes\":{\"strike\":true,\"bold\":true},\"insert\":\"dw\"},{\"attributes\":{\"header\":1},\"insert\":\"\\n\"}]}",
"opus_req": {
"upload_id": "558830935_1713021023_5941",
"opus": {
"opus_source": 2,
"title": "test",
"content": {
"paragraphs": [
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "test",
"font_size": 22,
"style": {
"strikethrough": true,
"bold": true
},
"color": "#60d837"
}
}
]
}
},
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "\n",
"font_size": 17,
"style": {}
}
},
{
"node_type": 1,
"word": {
"words": "dawhdhaw",
"font_size": 17,
"style": {
"italic": true
}
}
},
{
"node_type": 1,
"word": {
"words": "ohdouhhjkkkkkkk",
"font_size": 17,
"style": {
"italic": true,
"bold": true
}
}
},
{
"node_type": 1,
"word": {
"words": "kkkkkkkkkkkkkkkkkkk",
"font_size": 17,
"style": {
"italic": true
}
}
},
{
"node_type": 1,
"word": {
"words": "kkkkkk",
"font_size": 17,
"style": {
"italic": true
},
"color": "#73fdea"
}
},
{
"node_type": 1,
"word": {
"words": "kkkkkkkkk的娃娃对我打击和我觉得家里文化的",
"font_size": 17,
"style": {
"italic": true
}
}
},
{
"node_type": 1,
"word": {
"words": "交流和",
"font_size": 17,
"style": {
"strikethrough": true,
"italic": true
}
}
},
{
"node_type": 1,
"word": {
"words": "挖掘",
"font_size": 17,
"style": {
"strikethrough": true,
"italic": true
},
"color": "#60d837"
}
},
{
"node_type": 1,
"word": {
"words": "了觉得我很了解啊好了大家好我立即回到老家记得和我交流活动链接和网络江湖大佬",
"font_size": 17,
"style": {
"strikethrough": true,
"italic": true
}
}
},
{
"node_type": 1,
"word": {
"words": "教我",
"font_size": 17,
"style": {
"italic": true
}
}
}
]
}
},
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "测试",
"font_size": 17,
"style": {}
}
}
]
}
},
{
"para_type": 6,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "d4wad444444",
"font_size": 17,
"style": {}
}
}
]
},
"format": {
"align": 2,
"list_format": {
"level": 1,
"order": 1
}
}
},
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "dwdw",
"font_size": 17,
"style": {}
}
}
]
},
"format": {
"align": 1
}
},
{
"para_type": 3,
"format": {
"align": 1
},
"line": {
"pic": {
"url": "https://article.biliimg.com/bfs/article/0117cbba35e51b0bce5f8c2f6a838e8a087e8ee7.png",
"height": 1
}
}
},
{
"para_type": 4,
"text": {
"nodes": [
{
"node_type": 4,
"link": {
"link_type": 16,
"style": {
"italic": true
},
"show_text": "tql",
"link": "https://www.bilibili.com/video/BV1xr421b7YG?spm_id_from=333.1007.tianma.1-1-1.click"
}
},
{
"node_type": 1,
"word": {
"words": " 达瓦达瓦",
"font_size": 17,
"style": {}
}
}
]
}
},
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "wdad",
"font_size": 17,
"style": {}
}
}
]
}
},
{
"para_type": 2,
"pic": {
"style": 1,
"pics": [
{
"url": "https://article.biliimg.com/bfs/new_dyn/6e7d28ed54b3f32f8cb78f6fda21d70c558830935.jpg",
"width": 3840,
"height": 2160,
"size": 208.7587890625
}
]
}
},
{
"para_type": 4,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "\n",
"font_size": 17,
"style": {}
}
}
]
}
},
{
"para_type": 3,
"format": {
"align": 1
},
"line": {
"pic": {
"url": "https://article.biliimg.com/bfs/article/02db465212d3c374a43c60fa2625cc1caeaab796.png",
"height": 64
}
}
},
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "\n",
"font_size": 22,
"style": {
"bold": true
}
}
}
]
}
},
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "11",
"font_size": 22,
"style": {
"bold": true
}
}
},
{
"node_type": 1,
"word": {
"words": "dw",
"font_size": 22,
"style": {
"bold": true
},
"color": "#ea0077"
}
},
{
"node_type": 1,
"word": {
"words": "dw",
"font_size": 22,
"style": {
"bold": true
},
"color": "#fff359"
}
},
{
"node_type": 1,
"word": {
"words": "dwdaw",
"font_size": 22,
"style": {
"italic": true,
"bold": true
},
"color": "#fff359"
}
}
]
}
},
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "😅❤️❤️",
"font_size": 17,
"style": {}
}
}
]
}
},
{
"para_type": 3,
"format": {
"align": 1
},
"line": {
"pic": {
"url": "https://article.biliimg.com/bfs/article/db75225feabec8d8b64ee7d3c7165cd639554cbc.png",
"height": 16
}
}
},
{
"para_type": 1,
"text": {
"nodes": [
{
"node_type": 1,
"word": {
"words": "\n",
"font_size": 24,
"style": {
"bold": true
}
}
},
{
"node_type": 1,
"word": {
"words": "dwadw",
"font_size": 24,
"style": {
"strikethrough": true,
"italic": true,
"bold": true
}
}
},
{
"node_type": 1,
"word": {
"words": "dw",
"font_size": 24,
"style": {
"strikethrough": true,
"bold": true
}
}
}
]
}
}
]
},
"article": {
"category_id": 15,
"list_id": 0,
"originality": 0,
"reproduced": 0,
"biz_tags": []
},
"pub_info": {}
},
"scene": 12,
"meta": {
"app_meta": {
"from": "create.article.web",
"mobi_app": "web"
}
},
"option": {}
},
"draft_id_str": "305716"
} 以及不选择旧版编辑器就没法用以下功能,还有调字体 但这些功能必要性有待考究,坑太大,我建议暂时不考虑 |
很明显得做俩 dump...有待分析,zzz |
我主要测的是app这边,我看看有没有 |
现在这还没做 APP 鉴权,APP 接口不太好搞 |
调了,解决,行高0.8刚刚好 |
上传接口应该和音频/视频一样都单独开个模块 |
那我放opus.json了 |
中间的是秒时间戳,前后两段是什么东西 前面是UID,还剩后面四位了 |
我猜随机的,你试试看? |
发起请求的部分代码read-editor.801c8aab5cab33e714b9b0e54b38a631396e82c5.js case 19:
return null != e && null !== (n = e.tags) && void 0 !== n && n.length && (l.opus_req.opus.article.biz_tags = e.tags),
null != e && e.bvid && (l.bv_id = e.bvid),
null != e && e.timing && (u = e.timing / 1e3,
l.opus_req.option.timer_pub_time = u,
l.opus_req.opus.pub_info.timer_pub_time = u),
y = "create",
null != e && e.draftId ? l.draft_id_str = String(e.draftId) : null != e && e.dynId ? (l.dyn_id_str = e.dynId,
y = "edit") : null != e && e.cvid && (l.cvid_str = String(e.cvid),
y = "edit"),
t.next = 26,
d.a.post("/x/dynamic/feed/".concat(y, "/opus?csrf=").concat(M.a.get("bili_jct")), l, {
headers: {
"Content-Type": "application/json"
},
params: {
gaia_source: "main_web"
}
}); |
有 upload_Id 的吗? |
|
自动填,把 api 信息的那个 json,里面的 wbi改成 true 就行 post 请求默认带 csrf 参数 |
了解 新建了俩个data下的json文件( |
麻烦一个模块对应唯一的 json 文件,除非有大量固定的数据(如分区信息)需要归档且不再修改 数据结构指的是返回值示例,这种东西一律不保存?建议贴出来看一眼,不太好确定,麻烦给下文件
|
如果你能开个 pr draft 的话我可以更好的了解情况 plz =-= |
一点点东西而已,晚上回宿舍我直接发这里吧emmm 我觉得和article.json放一块更好其实,但接口path是opus,so哈哈 |
//path: data/article_uploader_meta.json
{
"app_meta": [
{
"from": "create.article.web",
"mobi_app": "web"
}
]
} //path: data/article_uploader.json
{
"para_type": [
{
"para_type": 1,
"text": {
"nodes": "array: node的数组"
},
"comment": "文字段落"
},
{
"para_type": 2,
"pic": {
"style": 1,
"pics": ""
},
"comment": "图片段落"
},
{
"para_type": 3,
"format": {
"align": 1
},
"line": {
"url": "string: 分割线图片链接",
"height": "int: eg: 64"
},
"comment": "分割线段落"
}
],
"node_type": [
{
"node_type": 1,
"word": {
"words": "string: 文字小节",
"font_size": "int: 17 正文 22 标题二",
"style": {
"bold": "bool: 粗体 false",
"italic": "bool: 斜体 false"
},
"color": "string: #18191c #00aeec #4fd3d1 #2ac864 #ffb027 #f85a54 #ff6699"
}
}
]
} ☟这个还有一部分参数没完善,打算慢慢来 "create": {
"url": "https://api.bilibili.com/x/dynamic/feed/create/opus",
"method": "POST",
"verify": true,
"params": {
"csrf": "string: csrf",
"gaia_source": "main_web",
"w_rid": "string: w_rid",
"wts": "int: wts"
},
"data": {
"raw_content": "string: 特殊格式化的opus_req.opus.content.paragraphs",
"opus_req": {
"upload_id": "string: {UID}_{秒时间戳}_{随机四位数字}",
"opus": {
"opus_source": "int: 类型",
"title": "string: 标题",
"content": {
"paragraphs": "para_type[]: para_type按顺序组成的数组"
},
"article": {
"category_id": "int: article_category的id",
"list_id": 0,
"originality": 0,
"reproduced": 0,
"biz_tags": "array: 标签的数组"
},
"pub_info": {}
},
"scene": 12,
"meta": {
"app_meta": {
"from": "create.article.web",
"mobi_app": "web"
}
},
"option": {}
}
},
"json_body": true,
"comment": "创建专栏"
} |
这种参数应该直接写死,没有给其他开发者参考的价值 应该把段落类别放进 meta.json 里面,如果非要放的话 |
正有此意
我觉得段落类别是要提出来的,本身article.py那边就做了一部分这方面的工作 |
现在全部合成一个文件内了 // data/article_uploader.json
{
"para_type": [
{
"para_type": 1,
"text": {
"nodes": "array: node的数组"
},
"comment": "文字段落"
},
{
"para_type": 2,
"pic": {
"style": 1,
"pics": ""
},
"comment": "图片段落"
},
{
"para_type": 3,
"format": {
"align": 1
},
"line": {
"url": "string: 分割线图片链接",
"height": "int: eg: 64"
},
"comment": "分割线段落"
}
],
"node_type": [
{
"node_type": 1,
"word": {
"words": "string: 文本小节",
"font_size": "int: 17 正文 22 标题二",
"style": {
"bold": "bool: 粗体 false",
"italic": "bool: 斜体 false"
},
"color": "string: #18191c #00aeec #4fd3d1 #2ac864 #ffb027 #f85a54 #ff6699"
}
}
],
"insert_type": [
{
"insert": "string: 文本",
"comment": "正文纯文本"
},
{
"attributes": {
"header": "int: 1 标题一 2 标题二",
"blockquote": "bool: 引用",
"color": "string: color",
"bold": "bool: 粗体",
"italic": "bool: 斜体"
},
"insert": "string: 文本",
"comment": "标题"
},
{
"attributes": {
"class": "normal-img"
},
"insert": {
"native-image": {
"alt": "read-normal-img",
"url": "string: url",
"width": 426,
"height": 240,
"size": "int: 图片大小KB",
"status": "loaded"
}
},
"comment": "插入的图片"
},
{
"attributes": {
"class": "cut-off"
},
"insert": {
"cut-off": {
"type": "4",
"url": "https://i0.hdslb.com/bfs/article/4adb9255ada5b97061e610b682b8636764fe50ed.png"
}
},
"comment": "分割线"
}
]
} |
我将目前的更改推送上来了 |
你要不开个 pr main...adk23333:bilibili-api:main |
将那一堆Node类改为Paragraph类内嵌对应的Node类,比较符合这边上传的数据格式。然后保证转json和markdown结果不变即可吧 Article类大体是不变的,涉及的方法可能要有一些改动 |
坐等 review |
怎么测试单个方法,我没能找到#尴尬 |
自己直接调用下算了...建议写完再扔进 tests 常规测试,不然好麻烦 |
在根目录底下开个 test.py 直接 |
@Property装饰器可以使用吗,不可以的话,是哪些版本的py不支持 |
可用 |
opus 相关请阅读 #662 理论上这里每个设计不合理的地方都是合理的,我还是建议你别碰文章解析,坑太大你吃不消...把上传做了就功德无量了 |
抱歉,忘记这个了。 |
新版编辑器发送创建专栏的post请求前是有一个option请求的,我需要去 |
不需要,自己了解下 option HTTP方法是干嘛的... |
这样是否可行? |
终于放假有空了,继续收拾手尾 关于这个的测试你有没有什么idea |
没有,基本上上传这类接口都没做测试,但可以不上传,把上传前的解析测试了 下载文章的倒是需要测试 |
Discussed in #741
Originally posted by adk23333 April 12, 2024
合并图文的议题
是暂时没时间添加还是这里面有坑,无坑的话,我去试试?
The text was updated successfully, but these errors were encountered: