api.proto 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. syntax = "proto3";
  2. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  3. // use {app_id}.{version} as package name
  4. package archive.service.v1;
  5. option go_package = "api";
  6. // Archive grpc
  7. service Archive {
  8. // Types 获取所有分区列表
  9. rpc Types(NoArgRequest) returns(TypesReply);
  10. // 获取单个稿件信息
  11. rpc Arc(ArcRequest) returns(ArcReply);
  12. // 批量获取稿件信息
  13. rpc Arcs(ArcsRequest) returns(ArcsReply);
  14. // 获取单个稿件计数信息
  15. rpc Stat(StatRequest) returns(StatReply);
  16. // 批量获取稿件计数信息
  17. rpc Stats(StatsRequest) returns(StatsReply);
  18. // 获取单个稿件+分P信息
  19. rpc View(ViewRequest) returns(ViewReply);
  20. // 批量获取稿件+分P信息
  21. rpc Views(ViewsRequest) returns(ViewsReply);
  22. // 获取稿件在各平台的点击数
  23. rpc Click(ClickRequest) returns(ClickReply);
  24. // 获取稿件的所有分P信息
  25. rpc Page(PageRequest) returns(PageReply);
  26. // 获取Up主绑定的相关推荐 *几乎废弃
  27. rpc Recommend(RecommendRequest) returns(RecommendReply);
  28. // 获取aid&cid对应的视频信息
  29. rpc Video(VideoRequest) returns(VideoReply);
  30. // 获取当前最大的aid,各子业务防刷、防脏数据时使用
  31. rpc MaxAid(NoArgRequest) returns(MaxAidReply);
  32. // 获取稿件的长简介信息
  33. rpc Description(DescriptionRequest) returns(DescriptionReply);
  34. // 内部方法,管理稿件服务缓存,请勿使用-----------------------------------------------------------------------
  35. rpc ArcFieldCache(ArcFieldCacheRequest) returns(NoReply);
  36. rpc ArcCache(ArcCacheRequest) returns(NoReply);
  37. rpc UpVideoCache(UpVideoCacheRequest) returns(NoReply);
  38. rpc DelVideoCache(DelVideoCacheRequest) returns(NoReply);
  39. rpc SetStat(SetStatRequest) returns(NoReply);
  40. // 内部方法,管理稿件服务缓存,请勿使用-----------------------------------------------------------------------
  41. }
  42. // NoArgReq
  43. message NoArgRequest{}
  44. // NoReply
  45. message NoReply{}
  46. message DescriptionRequest {
  47. int64 aid = 1;
  48. }
  49. message DescriptionReply {
  50. string desc = 1;
  51. }
  52. message MaxAidReply {
  53. int64 aid = 1;
  54. }
  55. message ArcRequest {
  56. int64 aid = 1;
  57. }
  58. message ArcReply {
  59. Arc arc = 1;
  60. }
  61. message ArcsRequest {
  62. repeated int64 aids = 1;
  63. }
  64. message ArcsReply {
  65. map<int64, Arc> arcs = 1;
  66. }
  67. message ViewRequest {
  68. int64 aid = 1;
  69. }
  70. message StatRequest {
  71. int64 aid = 1;
  72. }
  73. message StatReply {
  74. Stat Stat = 1;
  75. }
  76. message StatsRequest {
  77. repeated int64 aids = 1;
  78. }
  79. message StatsReply {
  80. map<int64, Stat> Stats = 1;
  81. }
  82. message ViewReply {
  83. Arc arc = 1 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""];
  84. repeated Page pages = 2;
  85. }
  86. message ViewsRequest {
  87. repeated int64 aids = 1;
  88. }
  89. message ViewsReply {
  90. map<int64, ViewReply> views = 1;
  91. }
  92. message TypesReply {
  93. map<int32, Tp> types = 1;
  94. }
  95. message ClickRequest {
  96. int64 aid = 1;
  97. }
  98. message ClickReply {
  99. Click click = 1;
  100. }
  101. message PageRequest {
  102. int64 aid = 1;
  103. }
  104. message PageReply {
  105. repeated Page pages = 1;
  106. }
  107. message RecommendRequest {
  108. int64 aid = 1;
  109. }
  110. message RecommendReply {
  111. repeated Arc arcs = 1;
  112. }
  113. message VideoRequest {
  114. int64 aid = 1;
  115. int64 cid = 2;
  116. }
  117. message VideoReply {
  118. Page page = 1;
  119. }
  120. message Tp {
  121. // 分区id
  122. int32 ID = 1 [(gogoproto.jsontag) = "id"];
  123. // 该分区的父级id
  124. int32 pid = 2 [(gogoproto.jsontag) = "pid"];
  125. // 该分区对应的名称
  126. string name = 3 [(gogoproto.jsontag) = "name"];
  127. }
  128. message AidVideos {
  129. int64 Aid = 1 [(gogoproto.jsontag) = "aid"];
  130. // 分P信息
  131. repeated Page Pages = 2 [(gogoproto.jsontag) = "pages"];
  132. }
  133. message Arc {
  134. int64 Aid = 1 [(gogoproto.jsontag) = "aid"];
  135. // 稿件一共有多少分P
  136. int64 Videos = 2 [(gogoproto.jsontag) = "videos"];
  137. // 分区ID
  138. int32 TypeID = 3 [(gogoproto.jsontag) = "tid"];
  139. // 分区名
  140. string TypeName = 4 [(gogoproto.jsontag) = "tname"];
  141. // 是否转载 1=原创 2=转载 0=历史上可能遗留的脏数据
  142. int32 Copyright = 5 [(gogoproto.jsontag) = "copyright"];
  143. // 稿件封面图地址,绝对地址 如 http://i0.hdslb.com/bfs/xxx.jpg
  144. string Pic = 6 [(gogoproto.jsontag) = "pic"];
  145. // 稿件标题
  146. string Title = 7 [(gogoproto.jsontag) = "title"];
  147. // 稿件发布时间 对外展示的标准时间 时间戳格式
  148. int64 PubDate = 8 [(gogoproto.jsontag) = "pubdate", (gogoproto.casttype) = "go-common/library/time.Time"];
  149. // 用户提交稿件的时间 一般不对外展示 时间戳格式
  150. int64 Ctime = 9 [(gogoproto.jsontag) = "ctime", (gogoproto.casttype) = "go-common/library/time.Time"];
  151. // 稿件简介
  152. string Desc = 10 [(gogoproto.jsontag) = "desc"];
  153. // 稿件状态,>=0为前台用户可见状态,其他值详见 http://info.bilibili.co/pages/viewpage.action?pageId=3686597#id-%E7%A8%BF%E4%BB%B6%E5%AD%97%E6%AE%B5%E6%9E%9A%E4%B8%BE%E5%80%BC%E5%B1%9E%E6%80%A7%E8%AF%B4%E6%98%8E-%E7%A8%BF%E4%BB%B6%E7%8A%B6%E6%80%81state&access
  154. int32 State = 11 [(gogoproto.jsontag) = "state"];
  155. // 稿件访问属性 0=全员可见 10000=登录用户可见(极少)
  156. int32 Access = 12 [(gogoproto.jsontag) = "access,omitempty"];
  157. // 稿件属性 详见State字段的文档
  158. int32 Attribute = 13 [(gogoproto.jsontag) = "attribute,omitempty"];
  159. // 废弃字段
  160. string Tag = 14 [(gogoproto.jsontag) = "-"];
  161. // 废弃字段
  162. repeated string Tags = 15 [(gogoproto.jsontag) = "tags,omitempty"];
  163. // 稿件总时长(所有分P加起来的) 单位=秒
  164. int64 Duration = 16 [(gogoproto.jsontag) = "duration"];
  165. // 稿件绑定的活动id
  166. int64 MissionID = 17 [(gogoproto.jsontag) = "mission_id,omitempty"];
  167. // 稿件绑定的商单id
  168. int64 OrderID = 18 [(gogoproto.jsontag) = "order_id,omitempty"];
  169. // 稿件后台设置的强制跳转地址,如果该值不为空,则必须调转到它对应的页面上
  170. string RedirectURL = 19 [(gogoproto.jsontag) = "redirect_url,omitempty"];
  171. int64 Forward = 20 [(gogoproto.jsontag) = "forward,omitempty"];
  172. // 见Rights字段说明
  173. Rights Rights = 21 [(gogoproto.jsontag) = "rights", (gogoproto.nullable) = false];
  174. // 稿件作者信息,详见Author字段说明
  175. Author Author = 22 [(gogoproto.jsontag) = "owner", (gogoproto.nullable) = false];
  176. // 稿件计数信息,详见Stat字段说明
  177. Stat Stat = 23 [(gogoproto.jsontag) = "stat", (gogoproto.nullable) = false];
  178. string ReportResult = 24 [(gogoproto.jsontag) = "report_result,omitempty"];
  179. // 发布稿件时Up主设置的动态描述(仅在动态展示)
  180. string Dynamic = 25 [(gogoproto.jsontag) = "dynamic"];
  181. // 稿件第一P的cid,供秒开使用
  182. int64 FirstCid = 26 [(gogoproto.jsontag) = "cid,omitempty"];
  183. // 稿件第一P的分辨率,详见Dimession字段说明
  184. Dimension Dimension = 27 [(gogoproto.jsontag) = "dimension,omitempty", (gogoproto.nullable) = false];
  185. // 联合投稿信息,内部使用,详见StaffInfo说明
  186. repeated StaffInfo StaffInfo = 28 [(gogoproto.jsontag) = "-"];
  187. }
  188. message StaffInfo {
  189. // 联合投稿的成员Up主id
  190. int64 Mid = 1 [(gogoproto.jsontag) = "mid"];
  191. // 联合投稿的成员角色(如 声优、字幕)
  192. string Title = 2 [(gogoproto.jsontag) = "title"];
  193. }
  194. // Dimension 视频分辨率
  195. message Dimension {
  196. // 宽 如 1920
  197. int64 Width = 1 [(gogoproto.jsontag) = "width"];
  198. // 高 如 1080
  199. int64 Height = 2 [(gogoproto.jsontag) = "height"];
  200. // 是否竖屏 0=否 1=是
  201. int64 Rotate = 3 [(gogoproto.jsontag) = "rotate"];
  202. }
  203. // Rights 稿件各常用属性 0=否 1=是
  204. message Rights {
  205. // 老版是否付费
  206. int32 Bp = 1 [(gogoproto.jsontag) = "bp"];
  207. // 是否支持充电 (不可直接使用,网关层请求业务方后才有值)
  208. int32 Elec = 2 [(gogoproto.jsontag) = "elec"];
  209. // 是否下载(不可直接使用,网关层请求业务方后才有值)
  210. int32 Download = 3 [(gogoproto.jsontag) = "download"];
  211. // 是否电影
  212. int32 Movie = 4 [(gogoproto.jsontag) = "movie"];
  213. // 是否PGC付费
  214. int32 Pay = 5 [(gogoproto.jsontag) = "pay"];
  215. // 无用
  216. int32 HD5 = 6 [(gogoproto.jsontag) = "hd5"];
  217. // 是否允许转发
  218. int32 NoReprint = 7 [(gogoproto.jsontag) = "no_reprint"];
  219. // 是否可以自动播放
  220. int32 Autoplay = 8 [(gogoproto.jsontag) = "autoplay"];
  221. // 是否UGC付费
  222. int32 UGCPay = 9 [(gogoproto.jsontag) = "ugc_pay"];
  223. // 是否联合投稿
  224. int32 IsCooperation = 10 [(gogoproto.jsontag) = "is_cooperation"];
  225. }
  226. // Author 稿件作者信息
  227. message Author {
  228. // Up主mid
  229. int64 Mid = 1 [(gogoproto.jsontag) = "mid"];
  230. // Up主名称
  231. string Name = 2 [(gogoproto.jsontag) = "name"];
  232. // Up主头像地址 绝对地址
  233. string Face = 3 [(gogoproto.jsontag) = "face"];
  234. }
  235. // Stat 稿件的所有计数信息
  236. message Stat {
  237. int64 Aid = 1 [(gogoproto.jsontag) = "aid"];
  238. // 播放数
  239. int32 View = 2 [(gogoproto.jsontag) = "view"];
  240. // 弹幕数
  241. int32 Danmaku = 3 [(gogoproto.jsontag) = "danmaku"];
  242. // 评论数
  243. int32 Reply = 4 [(gogoproto.jsontag) = "reply"];
  244. // 收藏数
  245. int32 Fav = 5 [(gogoproto.jsontag) = "favorite"];
  246. // 投币数
  247. int32 Coin = 6 [(gogoproto.jsontag) = "coin"];
  248. // 分享数
  249. int32 Share = 7 [(gogoproto.jsontag) = "share"];
  250. // 当前排名
  251. int32 NowRank = 8 [(gogoproto.jsontag) = "now_rank"];
  252. // 历史最高排名
  253. int32 HisRank = 9 [(gogoproto.jsontag) = "his_rank"];
  254. // 点赞数
  255. int32 Like = 10 [(gogoproto.jsontag) = "like"];
  256. // 点踩数 已取消前台展示,现在均返回0
  257. int32 DisLike = 11 [(gogoproto.jsontag) = "dislike"];
  258. }
  259. // Click 点击数详情,老版本播放器使用
  260. message Click {
  261. int64 Aid = 1 [(gogoproto.jsontag) = "aid"];
  262. // web端播放数
  263. int32 Web = 2 [(gogoproto.jsontag) = "web"];
  264. // iOS端播放数
  265. int32 Ios = 3 [(gogoproto.jsontag) = "ios"];
  266. // android端播放数
  267. int32 Android = 4 [(gogoproto.jsontag) = "android"];
  268. // h5端播放数
  269. int32 H5 = 5 [(gogoproto.jsontag) = "h5"];
  270. // 站外播放数
  271. int32 Outter = 6 [(gogoproto.jsontag) = "outter"];
  272. }
  273. // Page 分P信息
  274. message Page {
  275. // 视频的cid
  276. int64 Cid = 1 [(gogoproto.jsontag) = "cid"];
  277. // 视频的序号顺序,从小到大
  278. int32 Page = 2 [(gogoproto.jsontag) = "page"];
  279. // 视频的来源,99%为vupload=B站自己的,少部分为腾讯(qq)、湖南tv(hunan)
  280. string From = 3 [(gogoproto.jsontag) = "from"];
  281. // 视频的标题
  282. string Part = 4 [(gogoproto.jsontag) = "part"];
  283. // 视频的时长 单位=秒
  284. int64 Duration = 5 [(gogoproto.jsontag) = "duration"];
  285. // 站外视频才有vid属性
  286. string Vid = 6 [(gogoproto.jsontag) = "vid"];
  287. // 视频的简介,多P视频才可填写简介
  288. string Desc = 7 [(gogoproto.jsontag) = "description,omitempty"];
  289. // 站外视频跳转地址
  290. string WebLink = 8 [(gogoproto.jsontag) = "weblink"];
  291. // 视频分辨率信息
  292. Dimension Dimension = 9 [(gogoproto.jsontag) = "dimension", (gogoproto.nullable) = false];
  293. }
  294. // !!!Note: only response message defined, since we put pb into http response body
  295. message VideoFileInfo {
  296. uint64 filesize = 1 [(gogoproto.jsontag) = "filesize", (gogoproto.casttype) = "int64"];
  297. uint64 timelength = 2 [(gogoproto.jsontag) = "timelength", (gogoproto.casttype) ="int64"];
  298. string ahead = 3 [(gogoproto.jsontag) = "ahead"];
  299. string vhead = 4 [(gogoproto.jsontag) = "vhead"];
  300. }
  301. message VideoFormatFileInfo {
  302. repeated VideoFileInfo infos = 1 [(gogoproto.jsontag) = "infos"];
  303. }
  304. message DashItem {
  305. uint32 id = 1 [(gogoproto.jsontag) = "id", (gogoproto.casttype) = "int64"];
  306. string baseUrl = 2 [(gogoproto.jsontag) = "base_url"];
  307. uint32 bandwidth = 3 [(gogoproto.jsontag) = "bandwidth", (gogoproto.casttype) = "int64"];
  308. uint32 codecid = 4 [(gogoproto.jsontag) = "codecid", (gogoproto.casttype) = "int64"];
  309. }
  310. message ResponseDash {
  311. repeated DashItem video = 1 [(gogoproto.jsontag) = "video"];
  312. repeated DashItem audio = 2 [(gogoproto.jsontag) = "audio"];
  313. }
  314. message BvcVideoItem {
  315. uint64 expire_time = 1 [(gogoproto.jsontag) = "expire_time", (gogoproto.casttype) = "int64"];
  316. uint32 cid = 2 [(gogoproto.jsontag) = "cid", (gogoproto.casttype) ="int64"];
  317. repeated uint32 support_quality = 3 [(gogoproto.jsontag) = "support_quality", (gogoproto.casttype) = "int"];
  318. repeated string support_formats = 4 [(gogoproto.jsontag) = "support_formats"];
  319. repeated string support_description = 5 [(gogoproto.jsontag) = "support_description"];
  320. uint32 quality = 6 [(gogoproto.jsontag) = "quality", (gogoproto.casttype) = "int"];
  321. string url = 7 [(gogoproto.jsontag) = "url"];
  322. map<uint32, VideoFormatFileInfo> file_info = 8 [(gogoproto.jsontag) = "file_info"];
  323. uint32 video_codecid = 9 [(gogoproto.jsontag) = "video_codecid"];
  324. bool video_project = 10 [(gogoproto.jsontag) = "video_project"];
  325. uint32 fnver = 11 [(gogoproto.jsontag) = "fnver", (gogoproto.casttype) = "int"];
  326. uint32 fnval = 12 [(gogoproto.jsontag) = "fnval", (gogoproto.casttype) = "int"];
  327. ResponseDash dash = 13 [(gogoproto.jsontag) = "dash"];
  328. }
  329. message BvcResponseMsg {
  330. uint32 code = 1 [(gogoproto.jsontag) = "code", (gogoproto.casttype) = "int64"];
  331. map<uint32, BvcVideoItem> data = 2 [(gogoproto.jsontag) = "data"];
  332. }
  333. // 内部方法 请勿使用--------------------------------------------------------------------------------------------
  334. message ArcCacheRequest {
  335. int64 aid = 1;
  336. string tp = 2;
  337. int64 OldMid = 3;
  338. }
  339. message ArcFieldCacheRequest {
  340. int64 aid = 1;
  341. int32 typeID = 2;
  342. int32 oldTypeID = 3;
  343. }
  344. message UpVideoCacheRequest {
  345. int64 aid = 1;
  346. int64 cid = 2;
  347. }
  348. message DelVideoCacheRequest {
  349. int64 aid = 1;
  350. int64 cid = 2;
  351. }
  352. message SetStatRequest {
  353. Stat stat = 1;
  354. }
  355. // 内部方法 请勿使用--------------------------------------------------------------------------------------------