Skip to content

Commit 1b80acb

Browse files
committed
update upload
1 parent 2d6c493 commit 1b80acb

File tree

3 files changed

+189
-7
lines changed

3 files changed

+189
-7
lines changed

bilibili-webapp/archive.proto

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ service ArchiveService {
3434
body: "body",
3535
};
3636
}
37+
// 获取分区
38+
rpc GetArchiveTypeList(GetArchiveTypeListReq) returns (GetArchiveTypeListRes) {
39+
option (google.api.http) = {
40+
get: "/arcopen/fn/archive/type/list",
41+
};
42+
}
43+
// 视频稿件提交
44+
rpc AddArchive(AddArchiveReq) returns (AddArchiveRes) {
45+
option (google.api.http) = {
46+
post: "/arcopen/fn/archive/add-by-utoken",
47+
body: "body",
48+
};
49+
}
3750
}
3851

3952
message GetArchiveReq {
@@ -132,4 +145,39 @@ message ArchiveInfo {
132145
int64 ptime = 9;
133146
VideoInfo video_info = 10;
134147
AdditInfo addit_info = 11;
148+
string title = 12;
149+
}
150+
151+
message GetArchiveTypeListReq {
152+
string client_id = 1;
153+
string access_token = 2;
154+
}
155+
156+
message ArchiveType {
157+
int64 id = 1;
158+
int64 parent = 2;
159+
string name = 3;
160+
string description = 4;
161+
repeated ArchiveType children = 5;
162+
}
163+
164+
message GetArchiveTypeListRes {
165+
int32 code = 1;
166+
string message = 2;
167+
int32 ttl = 3;
168+
repeated ArchiveType data = 10;
169+
}
170+
171+
message AddArchiveReq {
172+
string client_id = 1;
173+
string access_token = 2;
174+
string upload_token = 3;
175+
ArchiveInfo body = 10;
176+
}
177+
178+
message AddArchiveRes {
179+
int32 code = 1;
180+
string message = 2;
181+
int32 ttl = 3;
182+
ArchiveInfo data = 10;
135183
}

bilibili-webapp/upload.proto

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
// B站开放接口 - 视频稿件投递 bilibili-webapp
2+
3+
syntax = "proto3";
4+
package member.bilibili.com ;
5+
import "google/api/annotations.proto";
6+
7+
option go_package = "github.com/dev-openapi/bilibili-webapp";
8+
9+
service UploadService {
10+
// 文件上传预处理 https://openhome.bilibili.com/doc/4/0c532c6a-e6fb-0aff-8021-905ae2409095
11+
rpc InitPart(InitPartReq) returns (InitPartRes) {
12+
option (google.api.http) = {
13+
post: "/arcopen/fn/archive/video/init",
14+
body: "body",
15+
};
16+
}
17+
// 文件分片上传 域名用 https://openupos.bilivideo.com https://openhome.bilibili.com/doc/4/733a520a-c50f-7bb4-17cb-35338ba20500
18+
rpc UploadPart(UploadPartReq) returns (UploadPartRes) {
19+
option (google.api.http) = {
20+
post: "/video/v2/part/upload",
21+
};
22+
}
23+
// 分片合并 https://openhome.bilibili.com/doc/4/0828e499-38d8-9e58-2a70-a7eaebf9dd64
24+
rpc CompletePart(CompletePartReq) returns (CompletePartRes) {
25+
option (google.api.http) = {
26+
post: "/arcopen/fn/archive/video/complete",
27+
};
28+
}
29+
// 封面上传 https://openhome.bilibili.com/doc/4/8243399e-50e3-4058-7f01-1ebe4c632cf8
30+
rpc UploadCover(UploadCoverReq) returns (UploadCoverRes) {
31+
option (google.api.http) = {
32+
post: "/arcopen/fn/archive/cover/upload",
33+
body: "body,multi",
34+
};
35+
}
36+
// 单次上传 域名用 https://openupos.bilivideo.com https://openhome.bilibili.com/doc/4/f22a0eee-c92d-0f1d-f69c-be170cf533c7
37+
rpc Upload(UploadReq) returns (UploadRes) {
38+
option (google.api.http) = {
39+
post: "/video/v2/upload",
40+
body: "body",
41+
};
42+
}
43+
// 上传图片 https://openhome.bilibili.com/doc/4/0eaa4d3e-c4c0-f874-6f3c-e083aa939a1b
44+
rpc UploadImage(UploadImageReq) returns (UploadImageRes) {
45+
option (google.api.http) = {
46+
post: "/arcopen/fn/article/upload/image",
47+
body: "body,multi",
48+
};
49+
}
50+
}
51+
52+
message InitPartReq {
53+
string client_id = 1;
54+
string access_token = 2;
55+
message Body {
56+
string name = 1;
57+
string utype = 2;
58+
}
59+
Body body = 10;
60+
}
61+
62+
message Uptoken {
63+
string upload_token = 1;
64+
}
65+
66+
message InitPartRes {
67+
int32 code = 1;
68+
string message = 2;
69+
int32 ttl = 3;
70+
Uptoken data = 10;
71+
}
72+
73+
message UploadPartReq {
74+
string upload_token = 1;
75+
int64 part_number = 2;
76+
}
77+
message UploadPartRes {
78+
int32 code = 1;
79+
string message = 2;
80+
int32 ttl = 3;
81+
}
82+
83+
message CompletePartReq {
84+
string upload_token = 1;
85+
}
86+
87+
message CompletePartRes {
88+
int32 code = 1;
89+
string message = 2;
90+
int32 ttl = 3;
91+
}
92+
93+
message UploadCoverReq {
94+
string client_id = 1;
95+
string access_token = 2;
96+
message Body {
97+
bytes file = 1;
98+
}
99+
Body body = 10;
100+
}
101+
message UploadCoverRes {
102+
int32 code = 1;
103+
string message = 2;
104+
int32 ttl = 3;
105+
message Data {
106+
string url = 1;
107+
}
108+
Data data = 10;
109+
}
110+
111+
message UploadReq {
112+
string upload_token = 1;
113+
bytes body = 2;
114+
}
115+
116+
message UploadRes {
117+
int32 code = 1;
118+
string message = 2;
119+
int32 ttl = 3;
120+
}
121+
122+
message UploadImageReq {
123+
string client_id = 1;
124+
string access_token = 2;
125+
message Body {
126+
bytes file = 1;
127+
bool watermark = 2;
128+
}
129+
Body body = 10;
130+
}
131+
132+
message UploadImageRes {
133+
int32 code = 1;
134+
string message = 2;
135+
int32 ttl = 3;
136+
message Data {
137+
string url = 1;
138+
int64 size = 2;
139+
}
140+
Data data = 10;
141+
}

bilibili-webapp/upvideo.proto

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)