From 65da316b48edb83f6832b038ca393061b912f387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=AF=92=E5=BD=A4?= <70561268+cxw620@users.noreply.github.com> Date: Wed, 29 Mar 2023 00:28:46 +0000 Subject: [PATCH] add: new united view grpc interface (#644) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add: new united view grpc interface * add: 补全proto --- .../bilibili/account/fission/v1/fission.proto | 126 ++-- grpc_api/bilibili/api/probe/v1/probe.proto | 330 ++++++----- .../bilibili/app/click/v1/heartbeat.proto | 121 ++++ .../v1/{playurl.proto => playerunite.proto} | 0 .../app/show/mixture/v1/mixture.proto | 53 ++ .../bilibili/app/viewunite/pgcanymodel.proto | 11 + .../bilibili/app/viewunite/ugcanymodel.proto | 10 + .../bilibili/app/viewunite/v1/viewunite.proto | 539 ++++++++++++++++++ grpc_api/bilibili/render/render.proto | 18 +- 9 files changed, 1007 insertions(+), 201 deletions(-) create mode 100644 grpc_api/bilibili/app/click/v1/heartbeat.proto rename grpc_api/bilibili/app/playerunite/v1/{playurl.proto => playerunite.proto} (100%) create mode 100644 grpc_api/bilibili/app/show/mixture/v1/mixture.proto create mode 100644 grpc_api/bilibili/app/viewunite/pgcanymodel.proto create mode 100644 grpc_api/bilibili/app/viewunite/ugcanymodel.proto create mode 100644 grpc_api/bilibili/app/viewunite/v1/viewunite.proto diff --git a/grpc_api/bilibili/account/fission/v1/fission.proto b/grpc_api/bilibili/account/fission/v1/fission.proto index 18eca65..051d6b7 100644 --- a/grpc_api/bilibili/account/fission/v1/fission.proto +++ b/grpc_api/bilibili/account/fission/v1/fission.proto @@ -1,62 +1,64 @@ -syntax = "proto3"; - -package bilibili.account.fission.v1; - -// Fission裂变 -service Fission { - // 活动入口 - rpc Entrance (EntranceReq) returns (EntranceReply); - // 首页弹窗 - rpc Window (WindowReq) returns (WindowReply); - // - rpc Privacy(PrivacyReq) returns (PrivacyReply); -} - -// 动画效果 -message AnimateIcon { - // icon文件 - string icon = 1; - // 动效json文件 - string json = 2; -} - -// 活动入口-响应 -message EntranceReply { - // 展示图标 - string icon = 1; - // 活动名称 - string name = 2; - // 活动跳转链接 - string url = 3; - // 动画效果 - AnimateIcon animate_icon = 4; -} - -// 活动入口-请求 -message EntranceReq {} - -// -message PrivacyReply { - // - string message = 1; -} - -// -message PrivacyReq { - // - string activity_uid = 1; -} - -//首页弹窗-响应 -message WindowReply { - // 弹窗类型 - // 0:弹窗 1:普通页面 - int32 type = 1; - // 跳转链接 - string url = 2; - // 上报数据字段 - string report_data = 3; -} - -// 首页弹窗-请求 -message WindowReq {} \ No newline at end of file +syntax = "proto3"; + +package bilibili.account.fission.v1; + +// Fission裂变 +service Fission { + // 活动入口 + rpc Entrance (EntranceReq) returns (EntranceReply); + // 首页弹窗 + rpc Window (WindowReq) returns (WindowReply); + // + rpc Privacy (PrivacyReq) returns (PrivacyReply); +} + +// 动画效果 +message AnimateIcon { + // icon文件 + string icon = 1; + // 动效json文件 + string json = 2; +} + +// 活动入口-响应 +message EntranceReply { + // 展示图标 + string icon = 1; + // 活动名称 + string name = 2; + // 活动跳转链接 + string url = 3; + // 动画效果 + AnimateIcon animate_icon = 4; +} + +// 活动入口-请求 +message EntranceReq {} + +// +message PrivacyReply { + // + string message = 1; +} + +// +message PrivacyReq { + // + string activity_uid = 1; +} + +//首页弹窗-响应 +message WindowReply { + // 弹窗类型 + // 0:弹窗 1:普通页面 + int32 type = 1; + // 跳转链接 + string url = 2; + // 上报数据字段 + string report_data = 3; +} + +// 首页弹窗-请求 +message WindowReq { + +} \ No newline at end of file diff --git a/grpc_api/bilibili/api/probe/v1/probe.proto b/grpc_api/bilibili/api/probe/v1/probe.proto index eb3c2ec..93ff315 100644 --- a/grpc_api/bilibili/api/probe/v1/probe.proto +++ b/grpc_api/bilibili/api/probe/v1/probe.proto @@ -1,138 +1,192 @@ -syntax = "proto3"; - -package bilibili.api.probe.v1; - -// -service Probe { - // - rpc TestCode (CodeReq) returns (CodeReply); - // - rpc TestReq (ProbeReq) returns (ProbeReply); - // - rpc TestStream (ProbeStreamReq) returns (ProbeStreamReply); - // - rpc TestSub (ProbeSubReq) returns (ProbeSubReply); -} - -// -enum Category { - CATEGORY_UNSPECIFIED = 0; // - CATEGORY_ONE = 1; // - CATEGORY_TWO = 2; // - CATEGORY_THREE = 3; // -} - -// -message CodeReply {} - -// -message CodeReq { - // - int64 code = 1; -} - -// -message DynamicMessageUpdate { - // - SimpleMessage body = 1; -} - -// -message Embedded { - // - bool bool_val = 1; - // - int32 int32_val = 2; - // - int64 int64_val = 3; - // - float float_val = 4; - // - double double_val = 5; - // - string string_val = 6; - // - repeated int32 repeated_int32_val = 8; - // - repeated string repeated_string_val = 12; - // - map map_string_val = 13; - // - map map_error_val = 14; -} - -// -message ErrorMessage { - // - int64 code = 1; - // - string reason = 2; - // - string message = 3; -} - -// -enum ErrorReason { - PROBE_UNSPECIFIED = 0; // - PROBE_CATEGORY_NOTFOUND = 1; // -} - -// -message ProbeReply { - // - string content = 1; - // - int64 timestamp = 2; -} - -// -message ProbeReq { - // - int64 mid = 1; - // - string buvid = 2; -} - -// -message ProbeStreamReply { - // - int64 sequence = 1; - // - int64 timestamp = 2; - // - string content = 3; -} - -// -message ProbeStreamReq { - // - int64 mid = 1; - // - int64 sequence = 2; -} - -// -message ProbeSubReply { - // - int64 message_id = 1; -} - -// -message ProbeSubReq { - // - int64 buvid = 1; -} - -// -message SimpleMessage { - // - int32 id = 1; - // - int64 num = 2; - // - string lang = 3; - // - int32 cate = 4; - // - Embedded embedded = 5; -} +syntax = "proto3"; + +package bilibili.api.probe.v1; + +// 服务可用性探针 +service Probe { + // + rpc TestCode (CodeReq) returns (CodeReply); + // + rpc TestReq (ProbeReq) returns (ProbeReply); + // + rpc TestStream (ProbeStreamReq) returns (ProbeStreamReply); + // + rpc TestSub (ProbeSubReq) returns (ProbeSubReply); +} + +// 服务可用性探针 +service ProbeService { + // + rpc Echo(SimpleMessage) returns (SimpleMessage); + // + rpc EchoBody(SimpleMessage) returns (SimpleMessage); + // + rpc EchoDelete(SimpleMessage) returns (SimpleMessage); + // + rpc EchoError(ErrorMessage) returns (ErrorMessage); + // + rpc EchoPatch(DynamicMessageUpdate) returns (DynamicMessageUpdate); +} + +// +enum Category { + CATEGORY_UNSPECIFIED = 0; // + CATEGORY_ONE = 1; // + CATEGORY_TWO = 2; // + CATEGORY_THREE = 3; // + CATEGORY_FOUR = 4; // +} + +// +message CodeReply { + // + string id = 1; + // + string id1 = 2; + // + int64 code = 3; + // + string message_s = 4; +} + +// +message CodeReq { + // + int64 code = 1; +} + +// +message CreateTopic { + // + int64 id = 1; +} + +// +message CreatTask { + // + string task = 1; +} + +// +message DynamicMessageUpdate { + // + SimpleMessage body = 1; +} + +// +message Embedded { + // + bool bool_val = 1; + // + int32 int32_val = 2; + // + int64 int64_val = 3; + // + float float_val = 4; + // + double double_val = 5; + // + string string_val = 6; + // + repeated bool repeated_bool_val = 7; + // + repeated int32 repeated_int32_val = 8; + // + repeated int64 repeated_int64_val = 9; + // + repeated float repeated_float_val = 10; + // + repeated double repeated_double_val = 11; + // + repeated string repeated_string_val = 12; + // + map map_string_val = 13; + // + map map_error_val = 14; +} + +// +message ErrorMessage { + // + int64 code = 1; + // + string reason = 2; + // + string message = 3; +} + +// Deprecated +enum ErrorReason { + PROBE_UNSPECIFIED = 0; // + PROBE_CATEGORY_NOTFOUND = 1; // +} + +// +message ProbeReply { + // + string content = 1; + // + int64 timestamp = 2; +} + +// +message ProbeReq { + // + int64 mid = 1; + // + string buvid = 2; +} + +// +message ProbeStreamReply { + // + int64 sequence = 1; + // + int64 timestamp = 2; + // + string content = 3; +} + +// +message ProbeStreamReq { + // + int64 mid = 1; + // + int64 sequence = 2; +} + +// +message ProbeSubReply { + // + int64 message_id = 1; +} + +// +message ProbeSubReq { + // + string buvid = 1; +} + +// +message SimpleMessage { + // + int32 id = 1; + // + int64 num = 2; + // + string lang = 3; + // + int32 cate = 4; + // + Embedded embedded = 5; +} + +// +message Task { + // + string name = 1; + // + string author = 2; + // + bool cache = 3; +} \ No newline at end of file diff --git a/grpc_api/bilibili/app/click/v1/heartbeat.proto b/grpc_api/bilibili/app/click/v1/heartbeat.proto new file mode 100644 index 0000000..f89e82f --- /dev/null +++ b/grpc_api/bilibili/app/click/v1/heartbeat.proto @@ -0,0 +1,121 @@ +syntax = "proto3"; + +package bilibili.app.click.v1; + +service Click { + +} + +// 账户信息 +message AccountInfo { + // + uint64 mid = 1; +} + +// +message AppInfo { + // + string top_page_class = 1; + // 客户端首次启动时的毫秒时间戳 + int64 ftime = 2; + // + string did = 3; +} + +// 心跳补充信息 +message Extra { + // + string session = 1; + // + string refer = 2; +} + +message HeartBeatReply {} + +// +message HeartBeatReq { + // + string session_v2 = 1; + // + Stage stage = 2; + // 流加载失败timeout + uint64 stream_timeout = 3; + // + uint64 batch_frequency = 4; + // + float frequency = 5; + // + VideoMeta video_meta = 6; + // + AppInfo app_info = 7; + // + AccountInfo account_info = 8; + // + PreProcessResult pre_process_result = 9; + // + repeated PlayerStatus player_status = 10; + // + VideoInfo video_info = 11; +} + +// +message PlayerStatus { + // + float playback_rate = 1; + // + uint64 progress = 2; + // + PlayState play_state = 3; + // + bool is_buffering = 4; +} + +// +enum PlayState { + // + STATE_UNKNOWN = 0; + // + PREPARING = 1; + // + PREPARED = 2; + // + PLAYING = 3; + // + PAUSED = 4; + // + STOPPED = 5; + // + FAILED = 6; +} + +// +message PreProcessResult { + // + int64 vt = 1; +} + +// +enum Stage { + // + STAGE_UNKNOWN = 0; + // + START = 1; + // + END = 2; + // + SAMPLE = 3; +} + +// +message VideoInfo { + // + uint64 cid_duration = 1; +} + +// +message VideoMeta { + // + uint64 aid = 1; + // + uint64 cid = 2; +} \ No newline at end of file diff --git a/grpc_api/bilibili/app/playerunite/v1/playurl.proto b/grpc_api/bilibili/app/playerunite/v1/playerunite.proto similarity index 100% rename from grpc_api/bilibili/app/playerunite/v1/playurl.proto rename to grpc_api/bilibili/app/playerunite/v1/playerunite.proto diff --git a/grpc_api/bilibili/app/show/mixture/v1/mixture.proto b/grpc_api/bilibili/app/show/mixture/v1/mixture.proto new file mode 100644 index 0000000..1e13127 --- /dev/null +++ b/grpc_api/bilibili/app/show/mixture/v1/mixture.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; + +package bilibili.app.show.mixture.v1; + +// +service Mixture { + // + rpc Widget(WidgetReq) returns (WidgetReply); +} + +// +message RcmdReason { + // + string content = 1; + // + uint32 corner_mark = 2; +} + +// +message WidgetItem { + // + string cover = 1; + // + string view = 2; + // + RcmdReason rcmd_reason = 3; + // + string title = 4; + // + string name = 5; + // + string uri = 6; + // + string goto = 7; + // + int64 id = 8; + // + int32 view_icon = 9; +} + +// +message WidgetReply { + // + repeated WidgetItem item = 1; +} + +// +message WidgetReq { + // + string from_spmid = 1; + // + uint32 page_no = 2; +} \ No newline at end of file diff --git a/grpc_api/bilibili/app/viewunite/pgcanymodel.proto b/grpc_api/bilibili/app/viewunite/pgcanymodel.proto new file mode 100644 index 0000000..99334a5 --- /dev/null +++ b/grpc_api/bilibili/app/viewunite/pgcanymodel.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package bilibili.app.viewunite.pgcanymodel; + +// +message ViewPgcAny { + // + uint64 season_id = 1; + // + int32 season_type = 2; +} \ No newline at end of file diff --git a/grpc_api/bilibili/app/viewunite/ugcanymodel.proto b/grpc_api/bilibili/app/viewunite/ugcanymodel.proto new file mode 100644 index 0000000..0b671f9 --- /dev/null +++ b/grpc_api/bilibili/app/viewunite/ugcanymodel.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package bilibili.app.viewunite.ugcanymodel; + +// +message ViewUgcAny { + +} + +// \ No newline at end of file diff --git a/grpc_api/bilibili/app/viewunite/v1/viewunite.proto b/grpc_api/bilibili/app/viewunite/v1/viewunite.proto new file mode 100644 index 0000000..81276c8 --- /dev/null +++ b/grpc_api/bilibili/app/viewunite/v1/viewunite.proto @@ -0,0 +1,539 @@ +syntax = "proto3"; + +package bilibili.app.viewunite.v1; + +import "bilibili/app/archive/middleware/v1/preload.proto"; + +import "google/protobuf/any.proto"; + +// 统一视频信息接口(7.23启用) +service View { + // + rpc View(ViewRequest) returns (ViewReply); + // + rpc ViewProgress(ViewProgressRequest) returns (ViewProgressReply); +} + +// 业务类型 +enum ArcType { + // + UNKNOWN = 0; + // + PAGES = 1; + // + SERIES = 2; + // + POSITIVE = 3; + // + SECTION = 4; + // + RELATE = 5; + // + PUGV = 6; +} + +// +message AttentionCard { + // + repeated ShowTime show_time = 1; +} + +// +message BadgeType { + // + string text = 1; + // + string text_color = 2; + // + string text_color_night = 3; + // + string bg_color = 4; + // + string bg_color_night = 5; + // + string border_color = 6; + // + string border_color_night = 7; + // + int32 bg_style = 8; +} + +// +message BizFollowVideoParam { + // + int64 season_id = 1; +} + +// +message BizJumpLinkParam { + // + string url = 1; +} + +// +message BizReserveActivityParam { + // + int64 activity_id = 1; + // + string from = 2; + // + string type = 3; + // + int64 oid = 4; + // + int64 reserve_id = 5; +} + +// +message BizReserveGameParam { + // + int64 game_id = 1; +} + +// +enum BizType { + // + BizTypeNone = 0; + // + BizTypeFollowVideo = 1; + // + BizTypeReserveActivity = 2; + // + BizTypeJumpLink = 3; + // + BizTypeFavSeason = 4; + // + BizTypeReserveGame = 5; +} + +// +message Chronos { + // + string md5 = 1; + // + string file = 2; + // + string sign = 3; +} + +// +message ChronosParam { + // + string engine_version = 1; + // + string message_protocol = 2; + // + string service_key = 3; +} + +// +message CommandDm { + // + int64 id = 1; + // + int64 oid = 2; + // + int64 mid = 3; + // + string command = 4; + // + string content = 5; + // + int32 progress = 6; + // + string ctime = 7; + // + string mtime = 8; + // + string extra = 9; + // + string id_str = 10; +} + +// 视频播放时弹出的卡片 +message ContractCard { + // 在第几秒弹出 + float display_progress = 1; + // + int64 display_accuracy = 2; + // 弹出后停留的时间 + int64 display_duration = 3; + // 展示方式, 暂未知对应关系 + int32 show_mode = 4; + // 页面类型, 暂未知对应关系 + int32 page_type = 5; + // + UpperInfos upper = 6; + // + int32 is_follow_display = 7; + // 卡片的文字说明信息 + ContractText text = 8; + // + int64 follow_display_end_duration = 9; + // + int32 is_play_display = 10; + // + int32 is_interact_display = 11; +} + +// 视频播放时弹出的卡片的文字说明信息 +message ContractText { + // + string title = 1; + // + string subtitle = 2; + // + string inline_title = 3; +} + +// +message Dimension { + // + int64 width = 1; + // + int64 height = 2; + // + int64 rotate = 3; +} + +// +message DmResource { + // + repeated CommandDm command_dms = 1; + // + AttentionCard attention = 2; + // + repeated OperationCard cards = 3; +} + +// 素材详情 +message Material { + // + string icon = 1; + // + string text = 2; + // + string url = 3; + // + MaterialBizType type = 4; + // + string param = 5; + // + string static_icon = 6; + // + string bg_color = 7; + // + string bg_pic = 8; + // + int32 jump_type = 9; + // + PageType page_type = 10; + // + bool need_login = 11; +} + +// 素材类型 +enum MaterialBizType { + // + NONE = 0; + // + ACTIVITY = 1; + // + BGM = 2; + // + EFFECT = 3; + // + SHOOT_SAME = 4; + // + SHOOT_TOGETHER = 5; + // + ACTIVITY_ICON = 6; + // + NEW_BGM = 7; +} + +// 素材来源 +enum MaterialSource { + // + UNKNOWN = 0; + // 必剪素材 + BIJIAN = 1; +} + +// +message OperationCard { + // + int64 id = 1; + // + int32 from = 2; + // + int32 to = 3; + // + bool status = 4; + // + BizType biz_type = 5; + // + OperationCardContent content = 6; + // + BizFollowVideoParam follow = 7; + // + BizReserveActivityParam reserve = 8; + // + BizJumpLinkParam jump = 9; + // + BizReserveGameParam game = 10; +} + +// +message OperationCardContent { + // + string title = 1; + // + string subtitle = 2; + // + string icon = 3; + // + string button_title = 4; + // + string button_selected_title = 5; + // + bool show_selected = 6; +} + +// +enum PageCategory { + // + COMMON_PAGE = 0; + // + ACTIVITY_PAGE = 1; +} + +// 页面类型 +enum PageType { + // H5页面(Webview) + H5 = 0; + // 原生页面(native) + NA = 1; +} + +// 播放策略 +message PlayStrategy { + // + repeated string strategies = 1; + // + int32 recommend_show_strategy = 2; + // 自动播放时的提示语 + string auto_play_toast = 3; +} + +// +message PointMaterial { + // + string url = 1; + // + MaterialSource material_source = 2; +} + +// +message Selection { + // + string title = 1; + // + repeated SelectionItem item = 2; + // + ArcType arc_type = 3; + // + SelectionType selection_type = 4; +} + +// +message SelectionItem { + // + uint64 aid = 1; + // + uint64 cid = 2; + // + BadgeType badge_type = 4; + // + string title = 5; + // + string long_title = 6; + // + Dimension dimension = 7; +} + +// +message SelectionModule { + // + repeated Selection selection = 1; + // + repeated SerialSeason serial_season = 2; + // + PlayStrategy play_strategy = 3; +} + +// +enum SelectionType { + // + LONGTITLE = 0; + // + SHORTTITLE = 1; +} + +// +message SerialSeason { + // + uint32 season_id = 1; + // + string season_title = 2; +} + +// +message ShowTime { + // + int32 start_time = 1; + // + int32 end_time = 2; + // + double pos_x = 3; + // + double pos_y = 4; +} + +// +enum UnionType { + // + UGC = 0; + // + OGV = 1; +} + +// UP主信息(可是Upper这个... 程序员英文不过关吧? ) +message UpperInfos { + // 粉丝数 + uint64 fans_count = 1; + // 过去半年内的稿件数 + uint64 arc_count_last_half_year = 2; + // + int64 first_up_dates = 3; + // UP稿件总播放数 + uint64 total_play_count = 4; +} + +// +message VideoGuide { + // + repeated Material material = 1; + // + VideoViewPoint video_point = 2; + // + ContractCard contract_card = 3; +} + +// +message VideoPoint { + // + int32 type = 1; + // + int64 from = 2; + // + int64 to = 3; + // + string content = 4; + // + string cover = 5; + // + string logo_url = 6; +} + +// +message VideoShot { + // + string pv_data = 1; + // + int32 img_x_len = 2; + // + int32 imd_x_size = 3; + // + int32 img_y_len = 4; + // + int32 img_y_size = 5; + // + repeated string image = 6; +} + +// +message VideoViewPoint { + // + repeated VideoPoint points = 1; + // + PointMaterial point_material = 2; + // + bool point_permanent = 3; +} + +// +message ViewBase { + // + UnionType union_type = 1; + // + PageType page_type = 2; +} + +// +message ViewProgressReq { + // + uint64 aid = 1; + // + uint64 cid = 2; + // + uint64 up_mid = 3; + // + ChronosParam chronos_param = 4; + // + UnionType type = 5; +} + +// +message ViewProgressReply { + // + VideoGuide video_guide = 1; + // + Chronos chronos = 2; + // + VideoShot arc_shot = 3; + // + DmResource dm = 4; +} + +// +message ViewReq { + // + uint64 aid = 1; + // + string bvid = 2; + // + string from = 3; + // + string spmid = 4; + // + string from_spmid = 5; + // + string session_id = 6; + // + bilibili.app.archive.middleware.v1.PlayerArgs player_args = 7; + // + string track_id = 8; + // + map extra_content = 9; +} + +// +message ViewReply { + // + ViewBase view_base = 1; + // + SelectionModule selection_module = 3; + // 使用 pgcanymodel / ugcanymodel 进行proto any转换成对应业务码结构体 + google.protobuf.Any supplement = 4; +} \ No newline at end of file diff --git a/grpc_api/bilibili/render/render.proto b/grpc_api/bilibili/render/render.proto index 0ffdd02..1fa0204 100644 --- a/grpc_api/bilibili/render/render.proto +++ b/grpc_api/bilibili/render/render.proto @@ -1 +1,17 @@ -// TODO \ No newline at end of file +syntax = "proto3"; + +package bilibili.render; + +import "google/protobuf/any.proto"; + +// +message Render { + // + int64 code = 1; + // + string message = 2; + // + string ttl = 3; + // + google.protobuf.Any data = 4; +} \ No newline at end of file