diff --git a/danmaku/danmaku_proto.md b/danmaku/danmaku_proto.md index 9e50a47..9f96835 100644 --- a/danmaku/danmaku_proto.md +++ b/danmaku/danmaku_proto.md @@ -66,12 +66,12 @@ porto定义见:[bilibili.community.service.dm.v1.DmSegMobileReply](../grpc_api 获取视频`av810872(CID=1176840)`(炮姐)的实时弹幕分包1 -**注:proto定义需要编译** +**注:[proto定义](../grpc_api/bilibili/community/service/dm/v1/dm.proto)需要编译,`bilibili.community.service.dm.v1.dm_pb2`并非通过pypi安装** ```python import requests import google.protobuf.text_format as text_format -import bilibili.community.service.dm.v1_pb2 as Danmaku +import bilibili.community.service.dm.v1.dm_pb2 as Danmaku url = 'http://api.bilibili.com/x/v2/dm/web/seg.so' params = { diff --git a/grpc_api/bilibili/app/interfaces/v1.proto b/grpc_api/bilibili/app/interfaces/v1.proto deleted file mode 100644 index eb76884..0000000 --- a/grpc_api/bilibili/app/interfaces/v1.proto +++ /dev/null @@ -1,594 +0,0 @@ -syntax = "proto3"; - -package bilibili.app.interfaces.v1; - -import "bilibili/app/playurl/v1.proto"; - -//历史记录接口 -service History { - //搜索历史记录 - //https://app.bilibili.com/bilibili.app.interface.v1.History/Search - rpc search (SearchReq) returns (SearchReply); - - //? - //https://app.bilibili.com/bilibili.app.interface.v1.History/LatestHistory - rpc latestHistory (LatestHistoryReq) returns (LatestHistoryReply); - - //获取历史记录业务类型 - //https://app.bilibili.com/bilibili.app.interface.v1.History/HistoryTab - rpc historyTab (HistoryTabReq) returns (HistoryTabReply); - - //删除历史记录 - //https://app.bilibili.com/bilibili.app.interface.v1.History/Delete - rpc delete (DeleteReq) returns (NoReply); - - //获取历史记录列表v2接口 - //https://app.bilibili.com/bilibili.app.interface.v1.History/CursorV2 - rpc cursorV2 (CursorV2Req) returns (CursorV2Reply); - - //获取历史记录列表v1接口 - //https://app.bilibili.com/bilibili.app.interface.v1.History/Cursor - rpc cursor (CursorReq) returns (CursorReply); - - //清空历史记录 - //https://app.bilibili.com/bilibili.app.interface.v1.History/Clear - rpc clear (ClearReq) returns (NoReply); -} - -//搜索接口 -service Search { - //获取搜索建议 - //https://app.bilibili.com/bilibili.app.interface.v1.Search/Suggest3 - rpc suggest3 (SuggestionResult3Req) returns (SuggestionResult3Reply); -} - -//搜索历史记录-请求 -message SearchReq { - //关键词 - string keyword = 1; - - //页码 - int64 pn = 2; - - //业务选择 - string business = 3; -} - -//搜索历史记录-回复 -message SearchReply { - //历史记录条目列表 - repeated CursorItem items = 1; - - //是否未拉取完 - bool hasMore = 2; - - //页面信息 - Page page = 3; -} - -//?-请求 -message LatestHistoryReq { - //业务选择 - string business = 1; - - //视频预加载配置 - PlayerPreloadParams playerPreload = 2; -} - -//?-回复 -message LatestHistoryReply { - //历史记录条目 - CursorItem items = 1; - - // - string scene = 2; -} - -//获取历史记录业务类型-请求 -message HistoryTabReq { - // - string business = 1; - - // - HistorySource source = 2; - - // - string keyword = 3; -} - -//获取历史记录业务类型-回复 -message HistoryTabReply { - // - repeated CursorTab tab = 1; -} - -//删除历史记录-请求 -message DeleteReq { - //历史记录信息 - HisInfo hisInfo = 1; -} - -//获取历史记录列表v2接口-请求 -message CursorV2Req { - //游标信息 - Cursor cursor = 1; - - //业务选择 - string business = 2; - - //视频预加载配置 - PlayerPreloadParams playerPreload = 3; - - // - bilibili.app.playurl.v1.PlayerArgs playerArgs = 4; -} - -//获取历史记录列表v2接口-回复 -message CursorV2Reply { - //历史记录条目列表 - repeated CursorItem items = 1; - - //游标信息 - Cursor cursor = 2; - - //是否未拉取完 - bool hasMore = 3; -} - -//获取历史记录列表v1接口-请求 -message CursorReq { - //游标信息 - Cursor cursor = 1; - - //业务选择 - string business = 2; - - //视频预加载配置 - PlayerPreloadParams playerPreload = 3; -} - -//获取历史记录列表v1接口-回复 -message CursorReply { - //历史记录条目列表 - repeated CursorItem items = 1; - - //业务类型表 - repeated CursorTab tab = 2; - - //游标信息 - Cursor cursor = 3; - - //是否未拉取完 - bool hasMore = 4; -} - -//清空历史记录-请求 -message ClearReq { - //业务选择 - string business = 1; -} - -//空回复 -message NoReply { - -} - -//获取搜索建议-请求 -message SuggestionResult3Req { - //关键字 - string keyword = 1; - - //是否语法高亮 - int32 highlight = 2; - - //是否青少年模式 - int32 teenagersMode = 3; -} - -//获取搜索建议-回复 -message SuggestionResult3Reply { - //搜索追踪id - string trackid = 1; - - //搜索建议条目列表 - repeated ResultItem list = 2; - - // - string expStr = 3; -} - -//专栏条目类型 -message CardArticle { - //封面uel - repeated string covers = 1; - - //作者昵称 - string name = 2; - - //作者UID - int64 mid = 3; - - // - bool displayAttention = 4; - - //标志名 - string badge = 5; - - // - Relation relation = 6; -} - -//课程条目类型 -message CardCheese { - //封面url - string cover = 1; - - //观看进度 - int64 progress = 2; - - //总计时长 - int64 duration = 3; - - //单集标题 - string subtitle = 4; -} - -//直播条目类型 -message CardLive { - //封面url - string cover = 1; - - //主播昵称 - string name = 2; - - //主播UID - int64 mid = 3; - - //直播分区名 - string tag = 4; - - // - int32 ststus = 5; - - // - bool displayAttention = 6; - - // - Relation relation = 7; -} - -//pgc稿件条目类型 -message CardOGV { - //封面url - string cover = 1; - - //观看进度 - int64 progress = 2; - - //总计时长 - int64 duration = 3; - - //单集标题 - string subtitle = 4; -} - -//ugc稿件条目类型 -message CardUGC { - //封面url - string cover = 1; - - //观看进度 - int64 progress = 2; - - //视频长度 - int64 duration = 3; - - //UP主昵称 - string name = 4; - - //UP主UID - int64 mid = 5; - - // - bool displayAttention = 6; - - //观看视频cid - int64 cid = 7; - - //观看视频分P - int32 page = 8; - - // - string subtitle = 9; - - // - Relation relation = 10; - - //稿件bvid - string bvid = 11; - - //总分P数 - int64 videos = 12; - - //短链接 - string shortLink = 13; - - //副标题文案 - string shareSubtitle = 14; - - //播放数 - int64 view = 15; -} - -//游标信息 -message Cursor { - //起始时间戳 - int64 max = 1; - - // - int32 maxTp = 2; -} - -//历史记录条目 -message CursorItem { - //主体数据 - oneof cardItemCase { - //ugc稿件 - CardUGC cardUGC = 1; - - //pgc稿件 - CardOGV cardOGV = 2; - - //专栏 - CardArticle cardArticle = 3; - - //直播 - CardLive cardLive = 4; - - //课程 - CardCheese cardCheese = 5; - } - - //标题 - string title = 6; - - //目标uri/url - string uri = 7; - - //观看时间 - int64 viewAt = 8; - - //历史记录id - int64 kid = 9; - - //对象id - int64 oid = 10; - - //业务类型 - string business = 11; - - //业务类型代码 - int32 tp = 12; - - //设备标识 - DeviceType dt = 13; - - // - bool hasShare = 14; -} - -//业务分类表 -message CursorTab { - //业务名 - string business = 1; - - //名称 - string name = 2; - - //路由uri - string router = 3; - - // - bool focus = 4; -} - -//设备标识代码 -enum DT { - //未知 - Unknown_VALUE = 0; - - //手机端 - Phone_VALUE = 1; - - //ipad端 - Pad_VALUE = 2; - - //web端 - PC_VALUE = 3; -} - -//设备标识 -message DeviceType { - //设备标识代码 - DT type = 1; - - //图标url - string icon = 2; -} - -//历史记录信息 -message HisInfo { - //业务选择 - string business = 1; - - //历史记录id - int64 kid = 2; -} - -// -enum HistorySource { - // - history_VALUE = 0; - - // - shopping_VALUE = 1; -} - -// -message OfficialVerify { - // - int32 type = 1; - - // - string desc = 2; -} - -//页面信息 -message Page { - //当前页码 - int64 pn = 1; - - //总计条目数 - int64 total = 2; -} - -//视频预加载配置 -message PlayerPreloadParams { - //清晰度 - int64 qn = 1; - - // - int64 fnver = 2; - - //流类型 - int64 fnval = 3; - - //强制域名 - int64 forceHost = 4; - - //是否4K - int64 fourk = 5; -} - -// -message ReasonStyle { - // - string text = 1; - - // - string textColor = 2; - - // - string textColorNight = 3; - - // - string bgColor = 4; - - // - string bgColorNight = 5; - - // - string borderColor = 6; - - // - string borderColorNight = 7; - - // - int32 bgStyle = 8; -} - -// -message Relation { - // - int32 status = 1; - - // - int32 isFollow = 2; - - // - int32 isFollowed = 3; -} - -//搜索建议条目 -message ResultItem { - //来源 - string from = 1; - - //显示结果(语法高亮) - string title = 2; - - //结果 - string keyword = 3; - - //序号 - int32 position = 4; - - // - string cover = 5; - - // - double coverSize = 6; - - // - string sugType = 7; - - // - int32 termType = 8; - - // - string goto = 9; - - // - string uri = 10; - - // - OfficialVerify officialVerify = 11; - - // - string param = 12; - - // - int64 mid = 13; - - // - int32 fans = 14; - - // - int32 level = 15; - - // - int32 archives = 16; - - // - int64 ptime = 17; - - // - string seasonTypeName = 18; - - // - string area = 19; - - // - string style = 20; - - // - string label = 21; - - // - double rating = 22; - - // - int32 vote = 23; - - // - repeated ReasonStyle badges = 24; - - // - string styles = 25; - - // - int64 moduleId = 26; - - // - string liveLink = 27; -} \ No newline at end of file diff --git a/grpc_api/bilibili/app/interfaces/v1/history.proto b/grpc_api/bilibili/app/interfaces/v1/history.proto new file mode 100644 index 0000000..2fd08ad --- /dev/null +++ b/grpc_api/bilibili/app/interfaces/v1/history.proto @@ -0,0 +1,374 @@ +syntax = "proto3"; + +package bilibili.app.interfaces.v1; + +import "bilibili/app/archive/middleware/v1/preload.proto"; + +// 历史记录 +service History { + // 获取历史记录tab + rpc HistoryTab (HistoryTabReq) returns (HistoryTabReply); + // 获取历史记录列表(旧版) + rpc Cursor (CursorReq) returns (CursorReply); + // 获取历史记录列表 + rpc CursorV2 (CursorV2Req) returns (CursorV2Reply); + // 删除历史记录 + rpc Delete (DeleteReq) returns (NoReply); + // 搜索历史记录 + rpc Search (SearchReq) returns (SearchReply); + // 清空历史记录 + rpc Clear (ClearReq) returns (NoReply); + // 获取最新的历史记录 + rpc LatestHistory (LatestHistoryReq) returns (LatestHistoryReply); +} + +// 获取历史记录tab-请求 +message HistoryTabReq { + // 业务类型 + // archive:视频 live:直播 article:专栏 goods:商品 show:展演 + string business = 1; + // 查询请求来源 + HistorySource source = 2; + // 搜索关键词 + string keyword = 3; +} + +// 获取历史记录tab-响应 +message HistoryTabReply { + // tab列表 + repeated CursorTab tab = 1; +} + +// 搜索历史记录来源 +enum HistorySource { + // 主站历史记录页 + history_VALUE = 0; + // 会员购浏览记录 + shopping_VALUE = 1; +} + +// 获取历史记录列表(旧版)-请求 +message CursorReq { + // 游标信息 + Cursor cursor = 1; + // 业务类型 + // all:全部 archive:视频 live:直播 article:专栏 + string business = 2; + // 秒开参数(旧版) + PlayerPreloadParams playerPreload = 3; + // 秒开参数 + bilibili.app.archive.middleware.v1.PlayerArgs player_args = 4; +} + +// 获取历史记录列表(旧版)-响应 +message CursorReply { + // 卡片内容 + repeated CursorItem items = 1; + // 顶部tab + repeated CursorTab tab = 2; + // 游标信息 + Cursor cursor = 3; + // 是否未拉取完 + bool hasMore = 4; +} + +// 获取历史记录列表-请求 +message CursorV2Req { + // 游标信息 + Cursor cursor = 1; + // 业务类型 + // archive:视频 live:直播 article:专栏 goods:商品 show:展演 + string business = 2; + // 秒开参数(旧版) + PlayerPreloadParams playerPreload = 3; + // 秒开参数 + bilibili.app.archive.middleware.v1.PlayerArgs player_args = 4; + // 是否选择本机的播放历史 + bool is_local = 5; +} + +// 获取历史记录列表-响应 +message CursorV2Reply { + // 卡片内容 + repeated CursorItem items = 1; + // 游标信息 + Cursor cursor = 2; + // 是否未拉取完 + bool hasMore = 3; +} + +// 历史记录卡片信息 +message CursorItem { + // 主体数据 + oneof card_item { + // ugc稿件 + CardUGC cardUGC = 1; + // pgc稿件 + CardOGV cardOGV = 2; + // 专栏 + CardArticle cardArticle = 3; + // 直播 + CardLive cardLive = 4; + // 课程 + CardCheese cardCheese = 5; + } + // 标题 + string title = 6; + // 目标uri/url + string uri = 7; + // 观看时间 + int64 viewAt = 8; + // 历史记录id + int64 kid = 9; + // 业务id + int64 oid = 10; + // 业务类型 + // archive:视频 live:直播 article:专栏 goods:商品 show:展演 + string business = 11; + // 业务类型代码 + int32 tp = 12; + // 设备标识 + DeviceType dt = 13; + // 是否有分享按钮 + bool hasShare = 14; +} + +// ugc稿件卡片 +message CardUGC { + // 封面url + string cover = 1; + // 观看进度 + int64 progress = 2; + // 视频长度 + int64 duration = 3; + // UP主昵称 + string name = 4; + // UP主mid + int64 mid = 5; + // 是否展示关注按钮 + bool displayAttention = 6; + // 历史观看视频cid + int64 cid = 7; + // 历史观看视频分P + int32 page = 8; + // 历史观看视频分P的标题 + string subtitle = 9; + // 关系信息 + Relation relation = 10; + // 稿件bvid + string bvid = 11; + // 总分P数 + int64 videos = 12; + // 短链接 + string shortLink = 13; + // 分享副标题 + string shareSubtitle = 14; + // 播放数 + int64 view = 15; +} + +// pgc稿件卡片 +message CardOGV { + // 封面url + string cover = 1; + // 观看进度 + int64 progress = 2; + // 总计时长 + int64 duration = 3; + // 单集标题 + string subtitle = 4; +} + +// 专栏卡片 +message CardArticle { + // 封面url + repeated string covers = 1; + // UP主昵称 + string name = 2; + // UP主mid + int64 mid = 3; + // 是否展示关注按钮 + bool displayAttention = 4; + // 角标 + string badge = 5; + // 关系信息 + Relation relation = 6; +} + +// 直播卡片 +message CardLive { + // 封面url + string cover = 1; + // 主播昵称 + string name = 2; + // 主播mid + int64 mid = 3; + // 直播分区名 + string tag = 4; + // 直播状态 + int32 ststus = 5; + // 是否展示关注按钮 + bool displayAttention = 6; + // 关系信息 + Relation relation = 7; +} + +// 课程卡片 +message CardCheese { + // 封面url + string cover = 1; + // 观看进度 + int64 progress = 2; + // 总计时长 + int64 duration = 3; + // 单集标题 + string subtitle = 4; +} + +// 业务分类表 +message CursorTab { + // 业务类型 + string business = 1; + // 名称 + string name = 2; + // 路由uri + string router = 3; + // tab定位 + bool focus = 4; +} + +// 游标信息 +message Cursor { + // 本页最大值游标值 + int64 max = 1; + // 本页最大值游标类型 + int32 maxTp = 2; +} + +// 删除历史记录-请求 +message DeleteReq { + // 历史记录信息 + HisInfo hisInfo = 1; +} + +// 历史记录信息 +message HisInfo { + // 业务类型 + // archive:视频 live:直播 article:专栏 goods:商品 show:展演 + string business = 1; + // 历史记录id + int64 kid = 2; +} + +// 空响应 +message NoReply {} + +// 设备类型 +message DeviceType { + // 设备标识代码 + DT type = 1; + // 图标url + string icon = 2; +} + +//设备标识代码 +enum DT { + // 未知 + Un known = 0; + //手机端 + Phone = 1; + // ipad端 + Pad = 2; + // web端 + PC = 3; + // TV端 + TV = 4; + // + Car = 5; + // + Iot = 6; + // apad端 + AndPad = 7; +} + +// 关系信息 +message Relation { + // 关系状态 + // 1:未关注 2:已关注 3:被关注 4:互关 + int32 status = 1; + // 用户关注UP主 + int32 isFollow = 2; + // UP主关注用户 + int32 isFollowed = 3; +} + +// 搜索历史记录-请求 +message SearchReq { + // 关键词 + string keyword = 1; + // 页码 + int64 pn = 2; + // 业务类型 + // archive:视频 live:直播 article:专栏 goods:商品 show:展演 + string business = 3; +} + +// 搜索历史记录-响应 +message SearchReply { + // 卡片内容 + repeated CursorItem items = 1; + // 是否未拉取完 + bool hasMore = 2; + // 页面信息 + Page page = 3; +} + +// 页面信息 +message Page { + // 当前页码 + int64 pn = 1; + // 总计条目数 + int64 total = 2; +} + +// 秒开参数 +message PlayerPreloadParams { + //清晰度 + int64 qn = 1; + // 流版本 + int64 fnver = 2; + // 流类型 + int64 fnval = 3; + // 是否强制域名 + int64 forceHost = 4; + // 是否4K + int64 fourk = 5; +} + +// 清空历史记录-请求 +message ClearReq { + // 业务类型 + // archive:视频 live:直播 article:专栏 goods:商品 show:展演 + string business = 1; +} + +// 获取最新的历史记录-请求 +message LatestHistoryReq { + // 业务类型 + // archive:视频 live:直播 article:专栏 goods:商品 show:展演 + string business = 1; + // 秒开参数 + PlayerPreloadParams playerPreload = 2; +} + +// 获取最新的历史记录-响应 +message LatestHistoryReply { + // 卡片内容 + CursorItem items = 1; + // 场景 + string scene = 2; + // 弹窗停留时间 + int64 rtime = 3; + // 分组的标志(客户端埋点上报) + string flag = 4; +} diff --git a/grpc_api/bilibili/app/interfaces/v1/search.proto b/grpc_api/bilibili/app/interfaces/v1/search.proto new file mode 100644 index 0000000..10b627d --- /dev/null +++ b/grpc_api/bilibili/app/interfaces/v1/search.proto @@ -0,0 +1,119 @@ +syntax = "proto3"; + +package bilibili.app.interfaces.v1; + +// 搜索 +service Search { + // 获取搜索建议 + rpc Suggest3 (SuggestionResult3Req) returns (SuggestionResult3Reply); +} + +// 获取搜索建议-请求 +message SuggestionResult3Req { + // 关键字 + string keyword = 1; + // 是否语法高亮 + // 0:不显示 1:显示 + int32 highlight = 2; + // 是否青少年模式 + // 1:开启青少年模式 + int32 teenagersMode = 3; +} + +// 获取搜索建议-响应 +message SuggestionResult3Reply { + // 搜索追踪id + string trackid = 1; + // 搜索建议条目列表 + repeated ResultItem list = 2; + // 搜索的abtest 实验信息 + string expStr = 3; +} + +// 搜索建议条目 +message ResultItem { + // 来源 + string from = 1; + // 显示结果(语法高亮) + string title = 2; + // 搜索关键字 + string keyword = 3; + // 序号 + int32 position = 4; + // 图片 + string cover = 5; + // 图片尺寸 + double coverSize = 6; + // sug词类型 + string sugType = 7; + // 词条大类型 + int32 termType = 8; + // 跳转类型 + string goto = 9; + // 跳转uri + string uri = 10; + // 认证信息 + OfficialVerify officialVerify = 11; + // 跳转参数 + string param = 12; + // up主mid + int64 mid = 13; + // 粉丝数 + int32 fans = 14; + // up主等级 + int32 level = 15; + // up主稿件数 + int32 archives = 16; + // 投稿时间 + int64 ptime = 17; + // season类型名称 + string seasonTypeName = 18; + // 地区 + string area = 19; + // 作品风格 + string style = 20; + // 描述信息 + string label = 21; + // 评分 + double rating = 22; + // 投票数 + int32 vote = 23; + // 角标 + repeated ReasonStyle badges = 24; + // + string styles = 25; + // + int64 moduleId = 26; + // + string liveLink = 27; +} + +// 认证信息 +message OfficialVerify { + // 认证类型 + // 127:未认证 0:个人 1:机构 + int32 type = 1; + // 认证描述 + string desc = 2; +} + +// 角标 +message ReasonStyle { + // 角标文案 + string text = 1; + // 文案日间色值 + string textColor = 2; + // 文案夜间色值 + string textColorNight = 3; + // 背景日间色值 + string bgColor = 4; + // 背景夜间色值 + string bgColorNight = 5; + // 边框日间色值 + string borderColor = 6; + // 边框夜间色值 + string borderColorNight = 7; + // 角标样式 + // 1:填充模式 2:镂空模式 + int32 bgStyle = 8; +} diff --git a/grpc_api/bilibili/app/playurl/v1/playurl.proto b/grpc_api/bilibili/app/playurl/v1/playurl.proto index 2b10b2a..cf25351 100644 --- a/grpc_api/bilibili/app/playurl/v1/playurl.proto +++ b/grpc_api/bilibili/app/playurl/v1/playurl.proto @@ -2,13 +2,13 @@ syntax = "proto3"; package bilibili.app.playurl.v1; -//视频url +// 视频url service PlayURL { - // 获取视频url + // 视频地址 rpc PlayURL (PlayURLReq) returns (PlayURLReply); - // 获取投屏url + // 投屏地址 rpc Project (ProjectReq) returns (ProjectReply); - // 获取视频url及播放界面配置 + // 播放页信息 rpc PlayView (PlayViewReq) returns (PlayViewReply); // 编辑播放界面配置 rpc PlayConfEdit (PlayConfEditReq) returns (PlayConfEditReply); @@ -16,9 +16,9 @@ service PlayURL { rpc PlayConf (PlayConfReq) returns (PlayConfReply); } -// 获取视频url-请求 +// 视频地址-请求 message PlayURLReq { - // 稿件avid + // 稿件avid int64 aid = 1; // 视频cid int64 cid = 2; @@ -34,7 +34,7 @@ message PlayURLReq { // 流url强制是用域名 // 0:允许使用ip 1:使用http 2:使用https int32 forceHost = 7; - // 允许4K + // 是否4K bool fourk = 8; // 当前页spm string spmid = 9; @@ -42,7 +42,7 @@ message PlayURLReq { string fromSpmid = 10; } -// 视频url-回复 +// 视频地址-回复 message PlayURLReply { // 清晰的 uint32 quality = 1; @@ -58,672 +58,574 @@ message PlayURLReply { uint32 fnval = 6; // 是否支持投影 bool videoProject = 7; - // 分段视频流 + // 分段视频流列表 repeated ResponseUrl durl = 8; - // dash视频流 + // dash数据 ResponseDash dash = 9; // 是否非全二压 int32 noRexcode = 10; - // + // 互动视频升级提示 UpgradeLimit upgradeLimit = 11; - // + // 清晰度描述列表 repeated FormatDescription supportFormats = 12; // 视频格式 VideoType type = 13; } -//获取播放界面配置-请求 -message PlayConfReq { - +// 分段流条目 +message ResponseUrl { + // 分段序号 + uint32 order = 1; + // 分段时长 + uint64 length = 2; + // 分段大小 + uint64 size = 3; + // 主线流 + string url = 4; + // 备用流 + repeated string backupUrl = 5; + // md5 + string md5 = 6; } -//获取播放界面配置-回复 -message PlayConfReply { - //播放控件用户自定义配置 - PlayAbilityConf playConf = 1; +// dash数据 +message ResponseDash { + // dash视频流 + repeated DashItem video = 1; + // dash伴音流 + repeated DashItem audio = 2; } -//-请求 -message PlayConfEditReq { - // - repeated PlayConfState playConf = 1; +// dash条目 +message DashItem { + // 清晰度 + uint32 id=1; + // 主线流 + string baseUrl=2; + // 备用流 + repeated string backupUrl=3; + // 带宽 + uint32 bandwidth=4; + // 编码id + uint32 codecid=5; + // md5 + string md5=6; + // 大小 + uint64 size=7; } -//-回复 -message PlayConfEditReply { - +// 互动视频升级提示 +message UpgradeLimit { + // 错误码 + int32 code =1; + // 错误信息 + string message =2; + // 图片url + string image =3; + // 按钮信息 + UpgradeButton button=4; } - - - - -//获取视频播放业务数据-请求 -message PlayViewReq { - //稿件avid - int64 aid = 1; - - //视频cid - int64 cid = 2; - - //清晰度 - int64 qn = 3; - - //流类型 - int32 fnver = 4; - - // - int32 fnval = 5; - - //下载模式 - //0:播放 1:flv下载 2:dash下载 - uint32 download = 6; - - //流url强制是用域名 - //0:允许使用ip 1:使用http 2:使用https - int32 forceHost = 7; - - //允许4K - bool fourk = 8; - - // - string spmid = 9; - - // - string fromSpmid = 10; - - // - int32 teenagersMode = 11; - - // - CodeType preferCodecType = 12; +// 互动视频升级按钮信息 +message UpgradeButton { + // 标题 + string title = 1; + // 链接 + string link = 2; } -//获取视频播放业务数据-回复 -message PlayViewReply { - //视频流信息 - VideoInfo info = 1; - - //播放控件用户自定义配置 - PlayAbilityConf PlayConf = 2; - - //互动视频升级提示 - UpgradeLimit upgradeLimit = 3; - - // - Chronos chronos = 4; - - //播放控件稿件配置 - PlayArcConf playArc = 5; - - //事件 - Event event = 6; +// 清晰度描述 +message FormatDescription { + // 清晰度 + int32 quality = 1; + // 清晰度格式 + string format = 2; + // 清晰度描述 + string description = 3; + // 新描述 + string newDescription = 4; + // 选中态的清晰度描述 + string displayDesc = 5; + // 选中态的清晰度描述的角标 + string superscript = 6; } -//-请求 +// 投屏地址请求 message ProjectReq { - //稿件avid + // 稿件avid int64 aid = 1; - - //视频cid + // 视频cid int64 cid = 2; - - //清晰度 + // 清晰度 int64 qn = 3; - - //流类型 + // 视频流版本 int32 fnver = 4; - - // + // 视频流格式 int32 fnval = 5; - - //下载模式 - //0:播放 1:flv下载 2:dash下载 + // 下载模式 + // 0:播放 1:flv下载 2:dash下载 uint32 download = 6; - - //流url强制是用域名 - //0:允许使用ip 1:使用http 2:使用https + // 流url强制是用域名 + // 0:允许使用ip 1:使用http 2:使用https int32 forceHost = 7; - - //允许4K + // 是否4K bool fourk = 8; - - // + // 当前页spm string spmid = 9; - - // + // 上一页spm string fromSpmid = 10; - - // + // 使用协议 + // 0:默认乐播 1:自建协议 2:云投屏 3:airplay int32 protocol = 11; - - // - int32 deviceType = 12; + // 投屏设备 + // 0:默认其他 1:OTT设备 + int32 device_type = 12; } -//-回复 +// 投屏地址-响应 message ProjectReply { - // PlayURLReply project = 1; } -//配置项 -message ArcConf { - //是否开启 - bool isSupport=1; +// 播放页信息-请求 +message PlayViewReq { + // 稿件avid + int64 aid = 1; + // 视频cid + int64 cid = 2; + // 清晰度 + int64 qn = 3; + // 视频流版本 + int32 fnver = 4; + // 视频流格式 + int32 fnval = 5; + // 下载模式 + // 0:播放 1:flv下载 2:dash下载 + uint32 download = 6; + // 流url强制是用域名 + // 0:允许使用ip 1:使用http 2:使用https + int32 forceHost = 7; + // 是否4K + bool fourk = 8; + // 当前页spm + string spmid = 9; + // 上一页spm + string fromSpmid = 10; + // 青少年模式 + int32 teenagersMode = 11; + // 编码 + CodeType preferCodecType = 12; + // 业务类型 + Business business = 13; } -// -message Chronos { - // - string md5=1; - - // - string file=2; -} - -// -message CloudConf { - // - bool show = 1; - - // - ConfType confType = 2; - - // - FieldValue fieldValue = 3; +// 业务类型 +enum Business { + // 未知类型 + UNKNOWN = 0; + // story业务 + STORY = 1; } // 编码类型 enum CodeType { // 默认 - NOCODE = 0; + NOCODE = 0; // H.264 - CODE264 = 1; + CODE264 = 1; // H.265 - CODE265 = 2; + CODE265 = 2; } -// -enum ConfType { - // - NoType_VALUE = 0; - // - FLIPCONF_VALUE = 1; - // - CASTCONF_VALUE = 2; - // - FEEDBACK_VALUE = 3; - // - SUBTITLE_VALUE = 4; - // - PLAYBACKRATE_VALUE = 5; - // - TIMEUP_VALUE = 6; - // - PLAYBACKMODE_VALUE = 7; - // - SCALEMODE_VALUE = 8; - // - BACKGROUNDPLAY_VALUE = 9; - // - LIKE_VALUE = 10; - // - DISLIKE_VALUE = 11; - // - COIN_VALUE = 12; - // - ELEC_VALUE = 13; - // - SHARE_VALUE = 14; - // - SCREENSHOT_VALUE = 15; - // - LOCKSCREEN_VALUE = 16; - // - RECOMMEND_VALUE = 17; - // - PLAYBACKSPEED_VALUE = 18; - // - DEFINITION_VALUE = 19; - // - SELECTIONS_VALUE = 20; - // - NEXT_VALUE = 21; - // - EDITDM_VALUE = 22; - // - SMALLWINDOW_VALUE = 23; - // - SHAKE_VALUE = 24; - // - OUTERDM_VALUE = 25; - // - INNERDM_VALUE = 26; - // - PANORAMA_VALUE = 27; - // - DOLBY_VALUE = 28; +// 播放页信息-回复 +message PlayViewReply { + // 视频流信息 + VideoInfo info = 1; + // 播放控件用户自定义配置 + PlayAbilityConf PlayConf = 2; + // 互动视频升级提示 + UpgradeLimit upgradeLimit = 3; + // Chronos灰度管理 + Chronos chronos = 4; + // 播放控件稿件配置 + PlayArcConf playArc = 5; + // 事件 + Event event = 6; } -// -message DashItem { - // - uint32 id=1; - //主线流 - string baseUrl=2; - //备用流 - repeated string backupUrl=3; - //带宽 - uint32 bandwidth=4; - // - uint32 codecid=5; - //md5 - string md5=6; - //大小 - uint64 size=7; -} - -//dash视频流 -message DashVideo { - //主线流 - string baseUrl=1; - - //备用流 - repeated string backupUrl=2; - - //带宽 - uint32 bandwidth=3; - - // - uint32 codecid=4; - - //md5 - string md5=5; - - //大小 - uint64 size=6; - - // - uint32 audioId=7; - - //是否非全二压 - bool noRexcode=8; -} - -//杜比音频信息 -message DolbyItem { - // - int32 type=1; - - //音频流 - DashItem audio=2; -} - -//事件 +// 事件 message Event { - //震动 - Shake shake=1; + // 震动 + Shake shake = 1; } -// -message FieldValue { - // - oneof valueCase { - // - bool value = 1; - } +// 震动 +message Shake { + // 文件地址 + string file = 1; } -// -message FormatDescription { - // - int32 quality = 1; - - // - string format = 2; - - // - string description = 3; - - // - string newDescription = 4; - - // - string displayDesc = 5; - - // - string superscript = 6; +// Chronos灰度管理 +message Chronos { + // 资源md5 + string md5 = 1; + // 资源文件 + string file = 2; } -//禁用功能配置 +// 获取播放界面配置-请求 +message PlayConfReq {} + +// 获取播放界面配置-响应 +message PlayConfReply { + //播放控件用户自定义配置 + PlayAbilityConf playConf = 1; +} + +// 禁用功能配置 message PlayAbilityConf { - //后台播放 - bool backgroundPlayDisable=1; - - //镜像反转 - bool flipDisable=2; - - //投屏 - bool castDisable=3; - - //反馈 - bool feedbackDisable=4; - - //字幕 - bool subtitleDisable=5; - - //播放速度 - bool playbackRateDisable=6; - - //定时停止 - bool timeUpDisable=7; - - //播放方式 - bool playbackModeDisable=8; - - //画面尺寸 - bool scaleModeDisable=9; - - //赞 - bool likeDisable=10; - - //踩 - bool dislikeDisable=11; - - //投币 - bool coinDisable=12; - - //充电 - bool elecDisable=13; - - //分享 - bool shareDisable=14; - - //截图 - bool screenShotDisable=15; - - //锁定 - bool lockScreenDisable=16; - - //相关推荐 - bool recommendDisable=17; - - //播放速度 - bool playbackSpeedDisable=18; - - //清晰度 - bool definitionDisable=19; - - //选集 - bool selectionsDisable=20; - - //下一集 - bool nextDisable=21; - - //编辑弹幕 - bool editDmDisable=22; - - //小窗 - bool smallWindowDisable=23; - - //震动 - bool shakeDisable=24; - - // - bool outerDmDisable=25; - - // - bool innerDmDisable=26; - - // - bool freyaEnterDisable=27; - - //杜比音效 - bool dolbyDisable=28; + // 后台播放 + CloudConf backgroundPlayDisable = 1; + // 镜像反转 + CloudConf flipDisable = 2; + // 投屏 + CloudConf castDisable = 3; + // 反馈 + CloudConf feedbackDisable = 4; + // 字幕 + CloudConf subtitleDisable = 5; + // 播放速度 + CloudConf playbackRateDisable = 6; + // 定时停止 + CloudConf timeUpDisable = 7; + // 播放方式 + CloudConf playbackModeDisable = 8; + // 画面尺寸 + CloudConf scaleModeDisable = 9; + // 赞 + CloudConf likeDisable = 10; + // 踩 + CloudConf dislikeDisable = 11; + // 投币 + CloudConf coinDisable = 12; + // 充电 + CloudConf elecDisable = 13; + // 分享 + CloudConf shareDisable = 14; + // 截图 + CloudConf screenShotDisable = 15; + // 锁定 + CloudConf lockScreenDisable = 16; + // 相关推荐 + CloudConf recommendDisable = 17; + // 播放速度 + CloudConf playbackSpeedDisable = 18; + // 清晰度 + CloudConf definitionDisable = 19; + // 选集 + CloudConf selectionsDisable = 20; + // 下一集 + CloudConf nextDisable = 21; + // 编辑弹幕 + CloudConf editDmDisable = 22; + // 小窗 + CloudConf smallWindowDisable = 23; + // 震动 + CloudConf shakeDisable = 24; + // 外层面板弹幕设置 + CloudConf outerDmDisable = 25; + // 三点内弹幕设置 + CloudConf innerDmDisable = 26; + // 一起看入口 + CloudConf freyaEnterDisable = 27; + // 杜比音效 + CloudConf dolbyDisable = 28; } -//播放控件稿件配置 +// 播放控件稿件配置 message PlayArcConf { - //后台播放 - ArcConf backgroundPlayConf=1; - //镜像反转 - ArcConf flipConf=2; - //投屏 - ArcConf castConf=3; - //反馈 - ArcConf feedbackConf=4; - //字幕 - ArcConf subtitleConf=5; - //播放速度 - ArcConf playbackRateConf=6; - //定时停止 - ArcConf timeUpConf=7; - //播放方式 - ArcConf playbackModeConf=8; - //画面尺寸 - ArcConf scaleModeConf=9; - //赞 - ArcConf likeConf=10; - //踩 - ArcConf dislikeConf=11; - //投币 - ArcConf coinConf=12; - //充电 - ArcConf elecConf=13; - //分享 - ArcConf shareConf=14; - //截图 - ArcConf screenShotConf=15; - //锁定 - ArcConf lockScreenConf=16; - //相关推荐 - ArcConf recommendConf=17; - //播放速度 - ArcConf playbackSpeedConf=18; - //清晰度 - ArcConf definitionConf=19; - //选集 - ArcConf selectionsConf=20; - //下一集 - ArcConf nextConf=21; - //编辑弹幕 - ArcConf editDmConf=22; - //小窗 - ArcConf smallWindowConf=23; - //震动 - ArcConf shakeConf=24; - // - ArcConf outerDmConf=25; - // - ArcConf innerDmConf=26; - // - ArcConf freyaEnterConf=27; - //杜比音效 - ArcConf dolbyConf=28; + // 后台播放 + ArcConf backgroundPlayConf = 1; + // 镜像反转 + ArcConf flipConf = 2; + // 投屏 + ArcConf castConf = 3; + // 反馈 + ArcConf feedbackConf = 4; + // 字幕 + ArcConf subtitleConf = 5; + // 播放速度 + ArcConf playbackRateConf = 6; + // 定时停止 + ArcConf timeUpConf = 7; + // 播放方式 + ArcConf playbackModeConf = 8; + // 画面尺寸 + ArcConf scaleModeConf = 9; + // 赞 + ArcConf likeConf = 10; + // 踩 + ArcConf dislikeConf = 11; + // 投币 + ArcConf coinConf = 12; + // 充电 + ArcConf elecConf = 13; + // 分享 + ArcConf shareConf = 14; + // 截图 + ArcConf screenShotConf = 15; + // 锁定 + ArcConf lockScreenConf = 16; + // 相关推荐 + ArcConf recommendConf = 17; + // 播放速度 + ArcConf playbackSpeedConf = 18; + // 清晰度 + ArcConf definitionConf = 19; + // 选集 + ArcConf selectionsConf = 20; + // 下一集 + ArcConf nextConf = 21; + // 编辑弹幕 + ArcConf editDmConf = 22; + // 小窗 + ArcConf smallWindowConf = 23; + // 震动 + ArcConf shakeConf = 24; + // 外层面板弹幕设置 + ArcConf outerDmConf = 25; + // 三点内弹幕设置 + ArcConf innerDmConf = 26; + // 一起看入口 + ArcConf freyaEnterConf = 27; + // 杜比音效 + ArcConf dolbyConf = 28; +} + +// 设置类型 +enum ConfType { + // + NoType = 0; + // 镜像反转 + FLIPCONF = 1; + // 视频投屏 + CASTCONF = 2; + // 反馈 + FEEDBACK = 3; + // 字幕 + SUBTITLE = 4; + // 播放速度 + PLAYBACKRATE = 5; + // 定时停止播放 + TIMEUP = 6; + // 播放方式 + PLAYBACKMODE = 7; + // 画面尺寸 + SCALEMODE = 8; + // 后台播放 + BACKGROUNDPLAY = 9; + // 顶 + LIKE = 10; + // 踩 + DISLIKE = 11; + // 投币 + COIN = 12; + // 充电 + ELEC = 13; + // 分享 + SHARE = 14; + // 截图 + SCREENSHOT = 15; + // 锁屏 + LOCKSCREEN = 16; + // 倍速 + RECOMMEND = 17; + // 清晰度 + PLAYBACKSPEED = 18; + // 选集 + DEFINITION = 19; + // 下一集 + SELECTIONS = 20; + // 编辑弹幕 + NEXT = 21; + // 小窗 + EDITDM = 22; + // 播放震动 + SMALLWINDOW = 23; + // 外层面板弹幕设置 + SHAKE = 24; + // 三点内弹幕设置 + OUTERDM = 25; + // 三点内弹幕设置 + INNERDM = 26; + // 全景 + PANORAMA = 27; + // 杜比 + DOLBY = 28; } // -message PlayConfState { - // - ConfType confType = 1; - - // - bool show = 2; - +message CloudConf { + // 是否展示功能 + bool show = 1; + // 设置类型 + ConfType confType = 2; // FieldValue fieldValue = 3; } -// -enum PlayErr { +// 配置字段值 +message FieldValue { // - NoErr_VALUE = 0; - - // - WithMultiDeviceLoginErr_VALUE = 1; + oneof value { + // 开关 + bool value = 1; + } } -// -message PlayerArgs { - // - int64 qn = 1; - - // - int64 fnver = 2; - - // - int64 fnval = 3; - - // - int64 forceHost = 4; +// 配置项 +message ArcConf { + // 是否支持 + bool isSupport = 1; } -// -message ResponseDash { - // - repeated DashItem video = 1; - - // - repeated DashItem audio = 2; +// 视频url信息 +message VideoInfo { + // 视频清晰度 + uint32 quality=1; + // 视频格式 + string format=2; + // 视频时长 + uint64 timelength=3; + // 视频编码id + uint32 videoCodecid=4; + // 视频流 + repeated Stream streamList=5; + // 伴音流 + repeated DashItem audio=6; + // 杜比伴音流 + DolbyItem dolby=7; } -//分段流条目 -message ResponseUrl { - //分段序号 - uint32 order = 1; - - //分段时长 - uint64 length = 2; - - //分段大小 - uint64 size = 3; - - //主线流 - string url = 4; - - //备用流 - repeated string backupUrl = 5; - - //md5 - string md5 = 6; +//杜比音频信息 +message DolbyItem { + enum Type { + // NONE + NONE = 0; + // 普通杜比音效 + COMMON = 1; + // 全景杜比音效 + ATMOS = 2; + } + // 杜比类型 + Type type = 1; + // 音频流 + DashItem audio = 2; +} + +// 视频流信息 +message Stream { + // 元数据 + StreamInfo info = 1; + // 流数据 + oneof contentCase { + // dash流 + DashVideo dashvideo = 2; + // 分段流 + SegmentVideo segmentvideo = 3; + } } //分段视频流 message SegmentVideo { - //分段视频流列表 - repeated ResponseUrl segment=1; + //分段视频流列表 + repeated ResponseUrl segment = 1; } -//震动 -message Shake { - // - string file=1; -} - -//视频流信息 -message Stream { - //元数据 - StreamInfo info=1; - +// 错误码 +enum PlayErr { // - oneof contentCase { - //dash流 - DashVideo dashvideo=2; - - //分段流 - SegmentVideo segmentvideo=3; - } + NoErr_VALUE = 0; + // 管控类型的错误码 + WithMultiDeviceLoginErr_VALUE = 1; } -//流媒体元数据 +// 流媒体元数据 message StreamInfo { - //清晰度 qn - uint32 quality=1; - //格式 - string format=2; - //格式描述 - string description=3; - //错误码 - uint32 errCode=4; - //不满足条件信息 - Limit limit=5; - //是否需要vip - bool needVip=6; - //是否需要登录 - bool needLogin=7; - //是否完整 - bool intact=8; - //是否非全二压 - bool noRexcode=9; - // - int64 attribute=10; - //新版格式描述 - string newDescription=11; - //格式文字 - string displayDesc=12; - //新版格式描述备注 - string superscript=13; + // 清晰度 + uint32 quality = 1; + // 格式 + string format = 2; + // 格式描述 + string description = 3; + // 错误码 + uint32 errCode = 4; + // 不满足条件信息 + StreamLimit limit = 5; + // 是否需要vip + bool needVip = 6; + // 是否需要登录 + bool needLogin = 7; + // 是否完整 + bool intact = 8; + // 是否非全二压 + bool noRexcode = 9; + // 清晰度属性位 + int64 attribute = 10; + // 新版格式描述 + string newDescription = 11; + // 格式文字 + string displayDesc = 12; + // 新版格式描述备注 + string superscript = 13; } -//不满足条件信息 -message Limit { - // - string title=1; - - // - string uri=2; - - // - string msg=3; -} - -// -message UpgradeButton { - // +// 清晰度不满足条件信息 +message StreamLimit { + // 标题 string title = 1; - - // - string link = 2; + // 跳转地址 + string uri = 2; + // 提示信息 + string msg = 3; } -//互动视频升级提示 -message UpgradeLimit { - //错误码 - int32 code =1; - - //错误信息 - string message =2; - - //图片url - string image =3; - - //按钮信息 - UpgradeButton button=4; +// 编辑播放界面配置-请求 +message PlayConfEditReq { + // 播放界面配置 + repeated PlayConfState playConf = 1; } -//视频url信息 -message VideoInfo { - //视频清晰度 - uint32 quality=1; - - //视频格式 - string format=2; - - //视频时长 - uint64 timelength=3; - - // - uint32 videoCodecid=4; - - //视频流 - repeated Stream streamList=5; - - //伴音流 - repeated DashItem audio=6; - - //杜比伴音流 - DolbyItem dolby=7; +// 编辑播放界面配置-响应 +message PlayConfEditReply {} + +// 播放界面配置 +message PlayConfState { + // 设置类型 + ConfType confType = 1; + // 是否隐藏 + bool show = 2; + // 配置字段值 + FieldValue fieldValue = 3; +} +//dash视频流 +message DashVideo { + // 主线流 + string baseUrl = 1; + // 备用流 + repeated string backupUrl = 2; + // 带宽 + uint32 bandwidth = 3; + // 编码id + uint32 codecid = 4; + // md5 + string md5 = 5; + // 大小 + uint64 size = 6; + // 伴音质量id + uint32 audioId = 7; + // 是否非全二压 + bool noRexcode = 8; } // 视频类型 @@ -736,4 +638,4 @@ enum VideoType { DASH_VALUE = 2; // mp4格式 MP4_VALUE = 3; -} \ No newline at end of file +} diff --git a/grpc_api/bilibili/app/resource/privacy/v1/api.proto b/grpc_api/bilibili/app/resource/privacy/v1/api.proto new file mode 100644 index 0000000..3a13b32 --- /dev/null +++ b/grpc_api/bilibili/app/resource/privacy/v1/api.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package bilibili.app.resource.privacy.v1; + +// 隐私 +service Privacy { + // 获取隐私设置 + rpc PrivacyConfig(NoArgRequest) returns(PrivacyConfigReply); + // 修改隐私设置 + rpc SetPrivacyConfig(SetPrivacyConfigRequest) returns(NoReply); +} + +// 空请求 +message NoArgRequest{} + +// 空响应 +message NoReply{} + +// 获取隐私设置-响应 +message PrivacyConfigReply { + // 隐私设置 + PrivacyConfigItem privacy_config_item = 1; +} + +// 隐私设置 +message PrivacyConfigItem { + // 隐私开关类型 + PrivacyConfigType privacy_config_type = 1; + // + string title = 2; + // 隐私开关状态 + PrivacyConfigState state = 3; + // + string sub_title = 4; + // + string sub_title_uri = 5; +} + +// 隐私开关类型 +enum PrivacyConfigType { + // + none = 0; + // 动态同城 + dynamic_city = 1; +} + +// 隐私开关状态 +enum PrivacyConfigState { + // 关闭 + close = 0; + // 打开 + open = 1; +} + +// 修改隐私设置-请求 +message SetPrivacyConfigRequest { + // 隐私开关类型 + PrivacyConfigType privacy_config_type = 1; + // 隐私开关状态 + PrivacyConfigState state = 2; +} \ No newline at end of file diff --git a/grpc_api/bilibili/app/resource/v1/module.proto b/grpc_api/bilibili/app/resource/v1/module.proto new file mode 100644 index 0000000..944b6fa --- /dev/null +++ b/grpc_api/bilibili/app/resource/v1/module.proto @@ -0,0 +1,133 @@ +syntax = "proto3"; + +package bilibili.app.resource.v1; + +// +service Module { + // + rpc List(ListReq) returns (ListReply); +} + +// +enum EnvType { + // + Unknown = 0; + // + Release = 1; + // + Test = 2; +} + +// +enum LevelType { + Undefined = 0; + // 高,需立即下载 + High = 1; + // 中,可以延迟下载 + Middle = 2; + // 低,仅在业务方使用到时由业务方手动进行下载 + Low = 3; +} + +// +message ListReq { + // + string pool_name = 1; + // + string module_name = 2; + // + repeated VersionListReq version_list = 3; + // + EnvType env = 4; + // + int32 sys_ver = 5; + // + int32 scale = 6; + // + int32 arch = 7; +} + +// +message VersionListReq { + // + string pool_name = 1; + // + repeated VersionReq versions = 2; +} + +// +message VersionReq { + // + string module_name = 1; + // + int64 version = 2; +} + +// +enum IncrementType { + // 全量包 + Total = 0; + // 增量包 + Incremental = 1; +} + +// +enum CompressType { + // unzip + Unzip = 0; + // 不操作 + Original = 1; +} + +message ListReply { + // + string env = 1; + // + repeated PoolReply pools = 2; +} + +message PoolReply { + // + string name = 1; + // + repeated ModuleReply modules = 2; +} + +message ModuleReply { + // + string name = 1; + // + int64 version = 2; + // + string url = 3; + // + string md5 = 4; + // + string total_md5 = 5; + // + IncrementType increment = 6; + // + bool is_wifi = 7; + // + LevelType level = 8; + // + string filename = 9; + // + string file_type = 10; + // + int64 file_size = 11; + // + CompressType compress = 12; + // + int64 publish_time = 13; + // 上报使用 + int64 pool_id = 14; + // + int64 module_id = 15; + // + int64 version_id = 16; + // + int64 file_id = 17; + // + bool zip_check = 18; +} \ No newline at end of file diff --git a/grpc_api/bilibili/app/show/gateway/v1/gateway.proto b/grpc_api/bilibili/app/show/gateway/v1/service.proto similarity index 100% rename from grpc_api/bilibili/app/show/gateway/v1/gateway.proto rename to grpc_api/bilibili/app/show/gateway/v1/service.proto diff --git a/grpc_api/bilibili/app/show/popular/v1/popular.proto b/grpc_api/bilibili/app/show/popular/v1/popular.proto index cffe40e..f5557ae 100644 --- a/grpc_api/bilibili/app/show/popular/v1/popular.proto +++ b/grpc_api/bilibili/app/show/popular/v1/popular.proto @@ -43,7 +43,7 @@ message PopularResultReq { // 数据埋点上报 // 0:代表手动刷新 1:代表自动刷新 int32 flush = 14; - // 视频秒开参数 + // 秒开参数 bilibili.app.archive.middleware.v1.PlayerArgs playerArgs = 15; } diff --git a/grpc_api/bilibili/app/view/v1/view.proto b/grpc_api/bilibili/app/view/v1/view.proto index 6a217e4..1b5eab8 100644 --- a/grpc_api/bilibili/app/view/v1/view.proto +++ b/grpc_api/bilibili/app/view/v1/view.proto @@ -585,7 +585,7 @@ message UserSeason { } // -message SeasonPlayer{ +message SeasonPlayer { // int64 aid = 1; // @@ -898,9 +898,9 @@ enum SeasonType { // Unknown = 0; // - Base = 1; + Base = 1; // - Good = 2; + Good = 2; } // UGC视频合集信息 @@ -1085,7 +1085,7 @@ message Node { } // 稿件播放中数据-请求 -message ViewProgressReq{ +message ViewProgressReq { // 稿件avid int64 aid = 1; // 视频cid @@ -1095,7 +1095,7 @@ message ViewProgressReq{ } // 稿件播放中数据-回复 -message ViewProgressReply{ +message ViewProgressReply { // 视频引导信息 VideoGuide videoGuide = 1; // Chronos灰度管理 @@ -1171,7 +1171,7 @@ message OperationCardNew { oneof renderCase { // 标准卡 StandardCard standardCard= 6; - // 老运营卡片(原B剪跳转卡) + // 老运营卡片(原B剪跳转卡) OperationCard operationCard = 7; } // @@ -1200,7 +1200,7 @@ enum OperationCardType { } // 标准卡 -message StandardCard{ +message StandardCard { // 卡片文案 string title = 1; // 按钮文字 未操作 @@ -1212,7 +1212,7 @@ message StandardCard{ } // 老运营卡片 -message OperationCard{ +message OperationCard { // 开始时间(单位为秒) int32 startTime = 1; // 结束时间(单位为秒) @@ -1230,7 +1230,7 @@ message OperationCard{ } // 互动弹幕条目信息 -message CommandDm{ +message CommandDm { // 弹幕id int64 id = 1; // 对象视频cid @@ -1306,7 +1306,7 @@ message subTFPanel { } // 短视频下载-请求 -message ShortFormVideoDownloadReq{ +message ShortFormVideoDownloadReq { // 稿件avid int64 aid = 1; // 视频cid @@ -1379,7 +1379,7 @@ message BizFollowVideoParam { } // 预约活动参数 -message BizReserveActivityParam{ +message BizReserveActivityParam { // 活动id int64 activityId = 1; // 场景 diff --git a/grpc_api/bilibili/broadcast/message/editor/notify.proto b/grpc_api/bilibili/broadcast/message/editor/notify.proto new file mode 100644 index 0000000..4e97d73 --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/editor/notify.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.editor; + +import "google/protobuf/empty.proto"; + +// +service OperationNotify { + // + rpc OperationNotify(google.protobuf.Empty) returns (stream Notify); +} + +message Notify { + // 消息唯一标示 + int64 msg_id = 1; + // 消息类型 + int32 msg_type = 2; + // 接收方uid + int64 receiver_uid = 3; + //接收方类型 + int32 receiver_type = 4; + // 故事的版本 + int64 story_version = 5; + // 操作结果的hash值 + int64 op_hash = 6; + // 操作产生用户的uid + int64 op_sender = 7; + // patch内容 + string op_content = 8; +} \ No newline at end of file diff --git a/grpc_api/bilibili/broadcast/message/esports/notify.proto b/grpc_api/bilibili/broadcast/message/esports/notify.proto new file mode 100644 index 0000000..cdcfdc4 --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/esports/notify.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.esports; + +message Notify { + // cid + int64 cid = 1; +} diff --git a/grpc_api/bilibili/broadcast/message/fission/notify.proto b/grpc_api/bilibili/broadcast/message/fission/notify.proto new file mode 100644 index 0000000..d062288 --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/fission/notify.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.fission; + +import "google/protobuf/empty.proto"; + +// +service Fission { + // + rpc GameNotify(google.protobuf.Empty) returns (stream GameNotifyReply); +} + +message GameNotifyReply { + // 类型字段 + uint32 type = 1; + // 数据字段 + string data = 2; +} \ No newline at end of file diff --git a/grpc_api/bilibili/broadcast/message/im/notify.proto b/grpc_api/bilibili/broadcast/message/im/notify.proto new file mode 100644 index 0000000..6c02483 --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/im/notify.proto @@ -0,0 +1,99 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.im; + +import "google/protobuf/empty.proto"; + +// +service Notify { + // + rpc WatchNotify(google.protobuf.Empty) returns (stream NotifyRsp); +} + +// +enum PLType { + // + EN_PAYLOAD_NORMAL = 0; + // + EN_PAYLOAD_BASE64 = 1; +} + +// +enum CmdId { + // 非法cmd + EN_CMD_ID_INVALID = 0; + // 服务端主动发起 + EN_CMD_ID_MSG_NOTIFY = 1; + // + EN_CMD_ID_KICK_OUT = 2; +} + +// +message NotifyRsp { + // + uint64 uid=1; + // 命令id + uint64 cmd=2; + // + bytes payload=3; + // + PLType payload_type=4; +} + +// +message Msg { + // 发送方uid + uint64 sender_uid = 1; + // 接收方类型 + int32 receiver_type = 2; + // 接收方id + uint64 receiver_id = 3; + // 客户端的序列id 用于服务端去重 + uint64 cli_msg_id = 4; + // 消息类型 + int32 msg_type = 5; + // 消息内容 + string content = 6; + // 服务端的序列号 + uint64 msg_seqno = 7; + // 消息发送时间(服务端时间) + uint64 timestamp = 8; + // at用户列表 + repeated uint64 at_uids = 9; + // 多人消息 + repeated uint64 recver_ids = 10; + // 消息唯一标示 + uint64 msg_key = 11; + // 消息状态 + uint32 msg_status = 12; + // 是否为系统撤销 + bool sys_cancel = 13; + // 是否是多聊消息 目前群通知管理员的部分通知属于该类消息 + uint32 is_multi_chat = 14; + // 表示撤回的消息的session_seqno 用以后续的比较 实现未读数的正确显示 + uint64 withdraw_seqno = 15; + // 通知码 + string notify_code =16; + // 消息来源 + uint32 msg_source = 17; +} + +// +message NotifyInfo { + // + uint32 msg_type = 1; + // + uint64 talker_id = 2; + // + uint32 session_type =3; +} + +// +message ReqServerNotify { + // 最新序列号 + uint64 lastest_seqno = 1; + // 即时消息 该类消息主要用于系统通知 当客户端sync msg时 不会sync到此类消息 + Msg instant_msg = 2; + // + NotifyInfo notify_info = 3; +} diff --git a/grpc_api/bilibili/broadcast/message/main.proto b/grpc_api/bilibili/broadcast/message/main.proto deleted file mode 100644 index 588a34a..0000000 --- a/grpc_api/bilibili/broadcast/message/main.proto +++ /dev/null @@ -1,189 +0,0 @@ -syntax = "proto3"; - -package bilibili.broadcast.message.main; - -import "google/protobuf/empty.proto"; - -// -service NativePage { - // - // - rpc watchNotify (google.protobuf.Empty) returns (NativePageEvent); -} - -// -service Resource { - // - // - rpc topActivity (google.protobuf.Empty) returns (TopActivityReply); -} -// -message NativePageEvent { - // - int64 pageID = 1; - - // - repeated EventItem items = 2; -} - -// -message TopActivityReply { - // - TopOnline online = 1; - - // - string hash = 2; -} - -// -message Animate { - // - string icon = 1; - - // - string json = 2; - - // - string svg = 3; - - // - int32 loop = 4; -} - -// -message CommandDm { - // - int64 id = 1; - - // - int64 oid = 2; - - // - int64 mid = 3; - - // - int32 type = 4; - - // - string command = 5; - - // - string content = 6; - - // - int32 state = 7; - - // - int32 progress = 8; - - // - string ctime = 9; - - // - string mtime = 10; - - // - string extra = 11; - - // - string idStr = 12; -} - -// -message DanmakuElem { - // - int64 id = 1; - - // - int32 progress = 2; - - // - int32 mode = 3; - - // - int32 fontsize = 4; - - // - uint32 color = 5; - - // - string midHash = 6; - - // - string content = 7; - - // - int64 ctime = 8; - - // - string action = 9; - - // - int32 pool = 10; - - // - string idStr = 11; -} - -// -message DanmukuEvent { - // - DanmakuElem elems = 1; -} - -// -message EventItem { - // - int64 itemID = 1; - - // - string type = 2; - - // - int64 num = 3; - - // - string displayNum = 4; - - // - string webKey = 5; - - // - int64 dimension = 6; -} - -// -message RedDot { - // - int32 type = 1; - - // - int32 number = 2; -} - -// -message TopOnline { - // - int32 type = 1; - - // - string icon = 2; - - // - string uri = 3; - - // - string uniqueId = 4; - - // - Animate animate = 5; - - // - RedDot redDot = 6; - - // - string name = 7; - - // - int64 interval = 8; -} \ No newline at end of file diff --git a/grpc_api/bilibili/broadcast/message/main/dm.proto b/grpc_api/bilibili/broadcast/message/main/dm.proto new file mode 100644 index 0000000..ce6df8f --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/main/dm.proto @@ -0,0 +1,63 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.main; + +// 实时弹幕事件 +message DanmukuEvent { + // 弹幕列表 + repeated DanmakuElem elems = 1; +} + +// 弹幕条目 +message DanmakuElem { + // 弹幕dmid + int64 id = 1; + // 弹幕出现位置(单位为ms) + int32 progress = 2; + // 弹幕类型 + int32 mode = 3; + // 弹幕字号 + int32 fontsize = 4; + // 弹幕颜色 + uint32 color = 5; + // 发送着mid hash + string mid_hash = 6; + // 弹幕正文 + string content = 7; + // 发送时间 + int64 ctime = 8; + // 弹幕动作 + string action = 9; + // 弹幕池 + int32 pool = 10; + // 弹幕id str + string id_str = 11; +} + +// 互动弹幕 +message CommandDm { + // 弹幕id + int64 id = 1; + // 对象视频cid + int64 oid = 2; + // 发送者mid + int64 mid = 3; + // + int32 type = 4; + // 互动弹幕指令 + string command = 5; + // 互动弹幕正文 + string content = 6; + // 弹幕状态 + int32 state = 7; + // 出现时间 + int32 progress = 8; + // 创建时间 + string ctime = 9; + // 发布时间 + string mtime = 10; + // 扩展json数据 + string extra = 11; + // 弹幕id str类型 + string idStr = 12; +} diff --git a/grpc_api/bilibili/broadcast/message/main/native.proto b/grpc_api/bilibili/broadcast/message/main/native.proto new file mode 100644 index 0000000..10f53bf --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/main/native.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.main; + +import "google/protobuf/empty.proto"; + +// +service NativePage { + // + rpc WatchNotify(google.protobuf.Empty) returns (stream NativePageEvent); +} + +// +message NativePageEvent { + // Native页ID + int64 PageID = 1; + // + repeated EventItem Items = 2; +} + +// +message EventItem { + // 组件标识 + int64 ItemID = 1; + // 组件类型 + string Type = 2; + // 进度条数值 + int64 Num = 3; + // 进度条展示数值 + string DisplayNum = 4; + // h5的组件标识 + string WebKey = 5; + // 活动统计维度 + // 0:用户维度 1:规则维度 + int64 dimension = 6; +} diff --git a/grpc_api/bilibili/broadcast/message/main/resource.proto b/grpc_api/bilibili/broadcast/message/main/resource.proto new file mode 100644 index 0000000..787b92c --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/main/resource.proto @@ -0,0 +1,61 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.main; + +import "google/protobuf/empty.proto"; + +// +service Resource { + // + rpc TopActivity(google.protobuf.Empty) returns (stream TopActivityReply); +} + +// +message TopActivityReply { + // 当前生效的资源 + TopOnline online = 1; + // 对online内容进行hash和上次结果一样则不重新加载 + string hash = 2; +} + +// 当前生效的资源 +message TopOnline { + // 活动类型 + // 1:七日活动 2:后台配置 + int32 type = 1; + // 图标 + string icon = 2; + // 跳转链接 + string uri = 3; + // 资源状态标识(后台配置) + string unique_id = 4; + // 动画资源 + Animate animate = 5; + // 红点 + RedDot red_dot = 6; + // 活动名称 + string name = 7; + // 轮询间隔 单位秒 + int64 interval = 8; +} + +// 动画资源 +message Animate { + // 动效结束展示icon + string icon = 1; + // 7日活动动画 + string json = 2; + // s10活动svg动画 + string svg = 3; + // 循环次数(默认0不返回 表示无限循环) + int32 loop = 4; +} + +// 红点 +message RedDot { + // 红点类型 + // 1:纯红点 2:数字红点 + int32 type = 1; + // 如果是数字红点 显示的数字 + int32 number = 2; +} diff --git a/grpc_api/bilibili/broadcast/message/note/sync.proto b/grpc_api/bilibili/broadcast/message/note/sync.proto new file mode 100644 index 0000000..bc3b165 --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/note/sync.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.note; + +// +message Sync { + // 笔记id + int64 note_id = 1; + // 唯一标示 + string hash = 2; +} diff --git a/grpc_api/bilibili/broadcast/message/ogv/freya.proto b/grpc_api/bilibili/broadcast/message/ogv/freya.proto new file mode 100644 index 0000000..a65e8da --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/ogv/freya.proto @@ -0,0 +1,228 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.ogv; + +// 播放状态 +enum PlayStatus { + // 暂停 + Pause = 0; + // 播放 + Play = 1; + // 终止 + End = 2; +} + +// 房间类型 +enum RoomType { + // 私密 + Private = 0; + // 公开 + Open = 1; +} + +// 信息通知发送领域 +enum MessageDomain { + // 默认 + DefaultDomain = 0; + // 房间用户 + RoomMid = 1; + // 系统通知 + SystemInfo = 2; +} + +// 通知信息类型 +enum MessageType { + // 默认 + DefaultType = 0; + // 房间用户 + ChatMessage = 1; + // 系统通知 + SystemMessage = 2; +} + +// 触发通知类型 +enum TriggerType { + // 默认 + DefaultTrigger = 0; + // 关注、取消关注 + Relation = 1; +} + +// 房间人员变更事件 +message RoomMemberChangeEvent { + // 房间id + int64 room_id = 1; + // 房主id + int64 owner_id = 2; + // 房间成员列表 + repeated UserInfoProto members = 3; + // 提示信息 + MessageProto message = 4; +} + +// 播放进度同步事件 +message ProgressSyncEvent { + // 房间id + int64 room_id = 1; + // 播放中的season_id + int64 season_id = 2; + // 播放中的episode_id + int64 episode_id = 3; + // 播放状态 + PlayStatus status = 4; + // 房主播放进度 + int64 progress = 5; + // 提示信息 + MessageProto message = 6; +} + +// 房间状态更新 +message RoomUpdateEvent { + // 房间id + int64 room_id = 1; + // 房间变更状态 + RoomType type = 2; + // 提示信息 + MessageProto message = 3; +} + +// 房间销毁通知 +message RoomDestroyEvent { + // 房间id + int64 room_id = 1; + // 提示信息 + MessageProto message = 4; +} + +// 房间触发通知 +message RoomTriggerEvent { + // 操作人 + int64 mid = 1; + // 提示信息 + MessageProto message = 2; + // 触发类型 + TriggerType trigger = 3; +} + +//用户信息 +message UserInfoProto { + // 用户id + int64 mid = 1; + // 用户头像url + string face = 2; + // 昵称 + string nickname = 3; + // 等级 + int32 level = 4; + // 签名 + string sign = 5; + // 大会员信息 + VipProto vip = 6; + // 身份认证信息 + OfficialProto official = 7; + // 挂件信息 + PendantProto pendant = 8; + // 设备buvid + string buvid = 9; +} + +//通知信息 +message MessageProto { + // 可带占位符匹配的消息体 ep "还没有其他小伙伴,[去邀请>]" + string content = 1; + // 消息体类型 + // 0:json格式的文本消息 1:支持全文本可点(破冰) + int32 content_type = 2; +} + +//大会员信息 +message VipProto { + int32 type = 1; + int32 status = 2; + int64 due_date = 3; + int32 vip_pay_type = 4; + int32 theme_type = 5; + // 大会员角标 + // 0:无角标 1:粉色大会员角标 2:绿色小会员角标 + int32 avatar_subscript = 6; + // 昵称色值,可能为空,色值示例:#FFFB9E60 + string nickname_color = 7; +} + +//认证信息 +message OfficialProto { + int32 role = 1; + string title = 2; + string desc = 3; + int32 type = 4; +} + +//挂件信息 +message PendantProto { + int32 pid = 1; + string name = 2; + string image = 3; + int64 expire = 4; + string image_enhance = 5; +} + +// 通用信息通知 +message MessageEvent { + // 房间id + int64 room_id = 1; + // 消息id + int64 msg_id = 2; + // 消息发送服务端时间 时间戳 单位秒 + int64 ts = 3; + // 信息通知发送主体id + int64 oid = 4; + // 信息通知发送领域 + MessageDomain domain = 5; + // 通知信息类型 + MessageType type = 6; + // 提示信息 + MessageProto message = 7; + // 消息发送用户信息 + UserInfoProto user = 8; + // 消息id str类型 + string msg_id2 = 9; +} + +// 聊天信息清除通知 +message RemoveChatEvent { + // 房间id + int64 room_id = 1; + // 撤回的聊天信息id + int64 msg_id = 2; + // 提示信息 + MessageProto message = 3; +} + +// "一起看"房间事件 +message FreyaEventBody { + // 房间id + int64 room_id = 1; + // 接收事件消息的白名单用户 + repeated int64 white_mid = 2; + // 不处理信息的黑名单用户 优先级低于白名单 当白名单有数据时 忽略黑名单 + repeated int64 ignore_mid = 3; + //命令类型 + oneof event { + // 房间人员变更事件 + RoomMemberChangeEvent member_change = 4; + // 播放进度同步事件 + ProgressSyncEvent progress = 5; + // 房间状态更新 + RoomUpdateEvent room_update = 6; + // 通用信息通知 + MessageEvent message = 7; + // 聊天信息清除通知 + RemoveChatEvent remove_chat = 8; + // 房间销毁通知 + RoomDestroyEvent room_destroy = 9; + // 房间触发通知 + RoomTriggerEvent room_trigger = 10; + } + // 消息序列号 + int64 sequence_id = 100; +} \ No newline at end of file diff --git a/grpc_api/bilibili/broadcast/message/ogv/live.proto b/grpc_api/bilibili/broadcast/message/ogv/live.proto new file mode 100644 index 0000000..2199ad2 --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/ogv/live.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.ogv; + +// 开播事件 +message LiveStartEvent {} + +// 直播中止事件 +message LiveEndEvent {} + +// 在线人数事件 +message LiveOnlineEvent { + //在线人数 + int64 online = 1; +} + +// 变更通知 +message LiveUpdateEvent { + // 直播后状态 + // 1:下线 2:转点播 + int32 after_premiere_type = 1; + // 直播开始绝对时间 单位ms + int64 start_time = 2; + // id + string id = 3; + // 服务端播放进度,未打散,负数表示距离开播时间,正数表示已开播时间,单位:毫秒 + // 用户实际播放进度:progress - delay_time + int64 progress = 4; +} + +// 直播间事件 +message CMDBody { + //命令类型 + oneof event { + // 开播事件 + LiveStartEvent start = 1; + // 直播中止事件 + LiveEndEvent emergency = 2; + // 在线人数事件 + LiveOnlineEvent online = 3; + // 变更通知 + LiveUpdateEvent update = 4; + } +} diff --git a/grpc_api/bilibili/broadcast/message/ticket/activitygame.proto b/grpc_api/bilibili/broadcast/message/ticket/activitygame.proto new file mode 100644 index 0000000..6645c2e --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/ticket/activitygame.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.ticket; + +// +enum RoomStatus { + // 暂停: + Pause = 0; + // 播放: + Play = 1; + // 终止: + End = 2; +} + +// 推送选项 +message RoomEvent { + // RoomStatus 类型 + RoomStatus room_status = 1; + // + string room_message = 2; +} diff --git a/grpc_api/bilibili/broadcast/message/tv/proj.proto b/grpc_api/bilibili/broadcast/message/tv/proj.proto new file mode 100644 index 0000000..f2cf065 --- /dev/null +++ b/grpc_api/bilibili/broadcast/message/tv/proj.proto @@ -0,0 +1,77 @@ +syntax = "proto3"; + +package bilibili.broadcast.message.tv; + +import "google/protobuf/empty.proto"; + +// +service Tv { + // 投屏 + rpc Proj(google.protobuf.Empty) returns (stream ProjReply); + // 直播状态 + rpc LiveStatus(google.protobuf.Empty) returns (stream LiveStatusNotify); + // 赛事比分通知 + rpc Esports(google.protobuf.Empty) returns (stream EsportsNotify); + // 直播插卡 + rpc Publicity(google.protobuf.Empty) returns (stream PublicityNotify); + // 直转点 + rpc LiveSkip(google.protobuf.Empty) returns (stream LiveSkipNotify); +} + +// 投屏 +message ProjReply { + // 投屏命令 + // 1:起播 2:快进 3:快退 4:seek播放进度 5:暂停 6:暂停恢复 + int64 cmd_type = 1; + // 用户id + int64 mid = 2; + // 稿件id + int64 aid = 3; + // 视频id + int64 cid = 4; + // 视频类型 + // 0:ugc 1:pgc 2:pugv + int64 video_type = 5; + // 单集id,pgc和pugv需要传 + int64 ep_id = 6; + // 剧集id + int64 season_id = 7; + // seek 的位置,cmd位seek时有值,单位秒 + int64 seek_ts = 8; + // 其他指令对应内容 + string extra = 9; +} + +// 直播状态 +message LiveStatusNotify { + // 直播状态 + // 1:开播 2:关播 3:截流 4:截流恢复 + int64 status = 1; + // 文案 + string msg = 2; + // 直播房间号 + int64 cid = 3; +} + +// +message EsportsNotify { + // 直播房间号 + int64 cid = 1; +} + +// 直播插卡 +message PublicityNotify { + // 插卡id + int64 publicity_id = 1; + // 直播房间号 + int64 room_id = 2; + // 直播间状态 + // 0:未开播 1:直播中 2:轮播中 + int64 status = 3; +} + +// 直转点 +message LiveSkipNotify { + // 直播id + int64 live_id = 1; +} \ No newline at end of file diff --git a/grpc_api/bilibili/broadcast/v1/broadcast.proto b/grpc_api/bilibili/broadcast/v1/broadcast.proto new file mode 100644 index 0000000..06d83a8 --- /dev/null +++ b/grpc_api/bilibili/broadcast/v1/broadcast.proto @@ -0,0 +1,96 @@ +syntax = "proto3"; + +package bilibili.broadcast.v1; + +import "bilibili/rpc/status.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; + +// broadcast操作,对应每个target_path +service Broadcast { + // 用户鉴权 + rpc Auth(AuthReq) returns (AuthResp); + // 心跳保活:成功心跳为4分45秒,重试心跳为30s,三次收不到进行重连(不超过5分45) + rpc Heartbeat(HeartbeatReq) returns (HeartbeatResp); + // 订阅target_path + rpc Subscribe(TargetPath) returns (google.protobuf.Empty); + // 取消订阅target_path + rpc Unsubscribe(TargetPath) returns (google.protobuf.Empty); + // 消息回执 + rpc MessageAck(MessageAckReq) returns (google.protobuf.Empty); +} + +// broadcast连接隧道 +service BroadcastTunnel { + // 创建双向stream连接隧道 + rpc CreateTunnel(stream BroadcastFrame) returns (stream BroadcastFrame); +} + +// 鉴权请求,通过authorization验证绑定用户mid +message AuthReq { + // 冷启动id,算法uuid,重新起启会变 + string guid = 1; + // 连接id,算法uuid,重连会变 + string conn_id = 2; + // 最后收到的消息id,用于过虑重连后获取未读的消息 + int64 last_msg_id = 3; +} +// 鉴权返回 +message AuthResp {} + +// 心跳请求 +message HeartbeatReq{} +// 心跳返回 +message HeartbeatResp{} + +// target_path +message TargetPath { + // 需要订阅的target_paths + repeated string target_paths = 1; +} + +// 消息回执 +message MessageAckReq { + // 消息id + int64 ack_id = 1; + // ack来源,由业务指定用于埋点跟踪 + string ack_origin = 2; + // 消息对应的target_path,方便业务区分和监控统计 + string target_path = 3; +} + +// message_id: +// client: 本次连接唯一的消息id,可用于回执 +// server: 唯一消息id,可用于上报或者回执 +// sequence: +// client: 客户端应该每次请求时frame seq++,会返回对应的对称req/resp +// server: 服务端下行消息,只会返回默认值:0 +message FrameOption { + // 消息id + int64 message_id = 1; + // frame序号 + int64 sequence = 2; + // 是否进行消息回执(发出MessageAckReq) + // downstream 上只有服务端设置为true,客户端响应 + // upstream 上只有客户端设置为true,服务端响应 + // 响应帧禁止设置is_ack,协议上禁止循环 + // 通常只有业务帧才可能设置is_ack, 因为协议栈(例如心跳、鉴权)另有响应约定 + bool is_ack = 3; + // 业务状态码 + bilibili.rpc.Status status = 4; + // 业务ack来源, 仅downstream时候由服务端填写. + string ack_origin = 5; +} + +// target_path: +// "/" Service-Name "/" {method name} 参考 gRPC Request Path +message BroadcastFrame { + // 请求消息信息 + FrameOption options = 1; + // 业务target_path + string target_path = 2; + // 业务pb内容 + google.protobuf.Any body = 3; +} + + diff --git a/grpc_api/bilibili/broadcast/v1/laser.proto b/grpc_api/bilibili/broadcast/v1/laser.proto new file mode 100644 index 0000000..40ec30e --- /dev/null +++ b/grpc_api/bilibili/broadcast/v1/laser.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package bilibili.broadcast.v1; + +import "google/protobuf/empty.proto"; + +// Laser +service Laser { + // 监听上报事件 + rpc WatchLogUploadEvent(google.protobuf.Empty) returns (stream LaserLogUploadResp); +} + +// 服务端下发日志上报事件 +message LaserLogUploadResp { + // 任务id + int64 taskid = 1; + // 下发时间 + string date = 2; +} diff --git a/grpc_api/bilibili/broadcast/v1/mod.proto b/grpc_api/bilibili/broadcast/v1/mod.proto new file mode 100644 index 0000000..cf56cce --- /dev/null +++ b/grpc_api/bilibili/broadcast/v1/mod.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package bilibili.broadcast.v1; + +import "google/protobuf/empty.proto"; + +message ModResourceResp {} + +// ModManager +service ModManager { + // + rpc WatchResource(google.protobuf.Empty) returns (stream ModResourceResp); +} diff --git a/grpc_api/bilibili/broadcast/v1/push.proto b/grpc_api/bilibili/broadcast/v1/push.proto new file mode 100644 index 0000000..3179fca --- /dev/null +++ b/grpc_api/bilibili/broadcast/v1/push.proto @@ -0,0 +1,126 @@ +syntax = "proto3"; + +package bilibili.broadcast.v1; + +import "google/protobuf/empty.proto"; + +// Push +service Push { + rpc WatchMessage(google.protobuf.Empty) returns (stream PushMessageResp); +} + +// +message PushMessageResp { + // 业务类型 + enum Biz { + // 未知 + BIZ_UNKNOWN = 0; + // 视频 + BIZ_VIDEO = 1; + // 直播 + BIZ_LIVE = 2; + // 活动 + BIZ_ACTIVITY = 3; + } + // 消息类型 + enum Type { + // 未知 + TYPE_UNKNOWN = 0; + // 默认 + TYPE_DEFAULT = 1; + // 热门 + TYPE_HOT = 2; + // 实时 + TYPE_REALTIME = 3; + // 推荐 + TYPE_RECOMMEND = 4; + } + // 展示未知 + enum Position { + // 未知 + POS_UNKNOWN = 0; + // 顶部 + POS_TOP = 1; + } + // Deprecated: 推送任务id,使用string + int64 old_taskid = 1; + // 业务 + // 1:是视频 2:是直播 3:是活动 + Biz biz = 2; + // 类型 + // 1:是默认 2:是热门 3:是实时 4:是推荐 + Type type = 3; + // 主标题 + string title = 4; + // 副标题 + string summary = 5; + // 图片地址 + string img = 6; + // 跳转地址 + string link = 7; + // 展示位置,1是顶部 + Position position = 8; + // 展示时长(单位:秒),默认3秒 + int32 duration = 9; + // 失效时间 + int64 expire = 10; + // 推送任务id + string taskid = 11; + // 应用内推送黑名单 + // UGC: ugc-video-detail + // PGC: pgc-video-detail + // 一起看: pgc-video-detail-theater + // 直播: live-room-detail + // Story: ugc-video-detail-vertical + // 播单黑名单 playlist-video-detail + repeated PageBlackList page_blackList = 12; + // 预留pvid + repeated PageView page_view = 13; + // 跳转资源 + TargetResource target_resource = 14; +} + +// +message PageBlackList { + // + string id = 1; +} + +// +message PageView { + // + string id = 1; +} + +// +enum LinkType { + // 未知 + LINK_TYPE_UNKNOWN = 0; + // 番剧 + LINK_TYPE_BANGUMI = 1; + // 视频 + LINK_TYPE_VIDEO = 2; + // 直播 + LINK_TYPE_LIVE = 3; +} + +// +message TargetResource { + //直播: roomid + //UGC: avid + //PGC: seasonid + //Story: avid + //举个例子 + //Type: LINK_TYPE_BANGUMI (番剧) + //Resource: {"seasonid":"123"} + // + //Type: LINK_TYPE_VIDEO (视频) + //Resource: {"avid":"123"} + // + //Type: LINK_TYPE_LIVE (直播) + //Resource: {"roomid":"123"} + // + LinkType Type = 1; + // + map Resource = 2; +} diff --git a/grpc_api/bilibili/broadcast/v1/room.proto b/grpc_api/bilibili/broadcast/v1/room.proto new file mode 100644 index 0000000..d2a7a0c --- /dev/null +++ b/grpc_api/bilibili/broadcast/v1/room.proto @@ -0,0 +1,72 @@ +syntax = "proto3"; + +package bilibili.broadcast.v1; + +import "bilibili/rpc/status.proto"; +import "google/protobuf/any.proto"; + +// +service BroadcastRoom { + // + rpc Enter(stream RoomReq) returns (stream RoomResp); +} + +// +message RoomJoinEvent {} + +// +message RoomLeaveEvent {} + +// +message RoomOnlineEvent { + // + int32 online = 1; +} + +// +message RoomMessageEvent { + // + string target_path = 1; + // + google.protobuf.Any body = 2; +} + +// +message RoomErrorEvent { + // + bilibili.rpc.Status status = 1; +} + +// +message RoomReq { + // {type}://{room_id} + string id = 1; + oneof event { + // + RoomJoinEvent join = 2; + // + RoomLeaveEvent leave = 3; + // + RoomOnlineEvent online = 4; + // + RoomMessageEvent msg = 5; + } +} + +// +message RoomResp { + // {type}://{room_id} + string id = 1; + oneof event { + // + RoomJoinEvent join = 2; + // + RoomLeaveEvent leave = 3; + // + RoomOnlineEvent online = 4; + // + RoomMessageEvent msg = 5; + // + RoomErrorEvent err = 6; + } +} diff --git a/grpc_api/bilibili/broadcast/v1/test.proto b/grpc_api/bilibili/broadcast/v1/test.proto new file mode 100644 index 0000000..1df1fa1 --- /dev/null +++ b/grpc_api/bilibili/broadcast/v1/test.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package bilibili.broadcast.v1; + +import "google/protobuf/any.proto"; +import "google/protobuf/empty.proto"; + +// 服务端下发的测试专用消息,客户端debug/release包都会通过弹窗响应该消息 +// 后端平台 必须 限制该消息只能针对单个用户发送 + +// Test +service Test { + // 监听上报事件 + rpc WatchTestEvent(google.protobuf.Empty) returns (stream TestResp); +} + +message TestResp { + // 任务id + int64 taskid = 1 [json_name="taskid"]; + // 时间戳 + int64 timestamp = 2 [json_name="timestamp"]; + // 消息 + string message = 3 [json_name="message"]; + // 扩展 + google.protobuf.Any extra = 4; +} diff --git a/grpc_api/bilibili/broadcast/v2/laser.proto b/grpc_api/bilibili/broadcast/v2/laser.proto new file mode 100644 index 0000000..6a606da --- /dev/null +++ b/grpc_api/bilibili/broadcast/v2/laser.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package bilibili.broadcast.v2; + +import "google/protobuf/empty.proto"; + +// Laser +service Laser { + // 监听Laser事件 + rpc WatchEvent(google.protobuf.Empty) returns (stream LaserEventResp); +} + +// 服务端下发Laser事件 +message LaserEventResp { + // 任务id + int64 taskid = 1; + // 指令名 + string action = 2; + // 指令参数json字符串 + string params = 3; +} diff --git a/grpc_api/bilibili/cheese/gateway/player/v1.proto b/grpc_api/bilibili/cheese/gateway/player/v1.proto deleted file mode 100644 index b28cc52..0000000 --- a/grpc_api/bilibili/cheese/gateway/player/v1.proto +++ /dev/null @@ -1,163 +0,0 @@ -syntax = "proto3"; - -package bilibili.cheese.gateway.player.v1; - -import "bilibili/app/playurl/v1.proto"; - -service PlayURL { - //课程播放url接口 - //https://app.bilibili.com/bilibili.cheese.gateway.player.v1.PlayURL/PlayView - rpc PlayView (playViewReq) returns (PlayViewReply); -} - -//获取播放url-请求 -message playViewReq { - //目标课程epid - int64 epid = 1; - - //目标视频cid - int64 cid = 2; - - //清晰度 - int64 qn = 3; - - //视频流版本 - int32 fnver = 4; - - //视频流功能 - int32 fnval = 5; - - //下载模式 - //0:播放 1:flv下载 2:dash下载 - uint32 download = 6; - - //流url强制是用域名 - //0:允许使用ip 1:使用http 2:使用https - int32 forceHost = 7; - - //允许4K - bool fourk = 8; - - // - string spmid = 9; - - // - string fromSpmid = 10; - - //青少年模式 - int32 teenagersMode = 11; - - //编码类型 - CodeType codetype = 12; - - //是否强制请求预览视频 - bool isPreview = 13; -} - -//获取播放url-回复 -message PlayViewReply { - //视频信息 - bilibili.app.playurl.v1.VideoInfo info = 1; - - //播放界面配置 - PlayAbilityConf PlayConf = 2; -} - -//编码类型 -enum CodeType { - //默认 - NOCODE = 0; - - //H.264 - CODE264 = 1; - - //H.265 - CODE265 = 2; -} - -//禁用功能配置 -message PlayAbilityConf { - //后台播放 - bool backgroundPlayDisable=1; - - //镜像反转 - bool flipDisable=2; - - //投屏 - bool castDisable=3; - - //反馈 - bool feedbackDisable=4; - - //字幕 - bool subtitleDisable=5; - - //播放速度 - bool playbackRateDisable=6; - - //定时停止 - bool timeUpDisable=7; - - //播放方式 - bool playbackModeDisable=8; - - //画面尺寸 - bool scaleModeDisable=9; - - //赞 - bool likeDisable=10; - - //踩 - bool dislikeDisable=11; - - //投币 - bool coinDisable=12; - - //充电 - bool elecDisable=13; - - //分享 - bool shareDisable=14; - - //截图 - bool screenShotDisable=15; - - //锁定 - bool lockScreenDisable=16; - - //相关推荐 - bool recommendDisable=17; - - //播放速度 - bool playbackSpeedDisable=18; - - //清晰度 - bool definitionDisable=19; - - //选集 - bool selectionsDisable=20; - - //下一集 - bool nextDisable=21; - - //编辑弹幕 - bool editDmDisable=22; - - //小窗 - bool smallWindowDisable=23; - - //震动 - bool shakeDisable=24; - - // - bool outerDmDisable=25; - - // - bool innerDmDisable=26; - - // - bool freyaEnterDisable=27; - - //杜比音效 - bool dolbyDisable=28; -} \ No newline at end of file diff --git a/grpc_api/bilibili/cheese/gateway/player/v1/playurl.proto b/grpc_api/bilibili/cheese/gateway/player/v1/playurl.proto new file mode 100644 index 0000000..70113ba --- /dev/null +++ b/grpc_api/bilibili/cheese/gateway/player/v1/playurl.proto @@ -0,0 +1,146 @@ +syntax = "proto3"; + +package bilibili.cheese.gateway.player.v1; + +import "bilibili/app/playurl/v1/playurl.proto"; + +// 课程视频url +service PlayURL { + // 播放页信息 + rpc PlayView (PlayViewReq) returns (PlayViewReply); + // 投屏地址 + rpc Project (ProjectReq) returns (ProjectReply); +} + +// 播放页信息-请求 +message PlayViewReq { + // 课程epid(与番剧不互通) + int64 ep_id = 1; + // 视频cid + int64 cid = 2; + // 清晰度 + int64 qn = 3; + // 视频流版本 + int32 fnver = 4; + // 视频流格式 + int32 fnval = 5; + // 下载模式 + // 0:播放 1:flv下载 2:dash下载 + uint32 download = 6; + // 流url强制是用域名 + // 0:允许使用ip 1:使用http 2:使用https + int32 force_host = 7; + // 是否4K + bool fourk = 8; + // 当前页spm + string spmid = 9; + // 上一页spm + string from_spmid = 10; + // 青少年模式 + int32 teenagers_mode = 11; + // 视频编码 + bilibili.app.playurl.v1.CodeType prefer_codec_type = 12; + // 是否强制请求预览视频 + bool is_preview = 13; +} + +// 投屏地址-请求 +message ProjectReq { + // 课程epid(与番剧不互通) + int64 ep_id = 1; + // 视频cid + int64 cid = 2; + // 清晰度 + int64 qn = 3; + // 视频流版本 + int32 fnver = 4; + // 视频流格式 + int32 fnval = 5; + // 下载模式 + // 0:播放 1:flv下载 2:dash下载 + uint32 download = 6; + // 流url强制是用域名 + // 0:允许使用ip 1:使用http 2:使用https + int32 force_host = 7; + // 是否4K + bool fourk = 8; + // 当前页spm + string spmid = 9; + // 上一页spm + string from_spmid = 10; + // 投屏协议 + // 0:默认乐播 1:自建协议 2:云投屏 + int32 protocol = 11; + // 投屏设备 + // 0:默认其他 1:OTT设备 + int32 device_type = 12; + // 是否flv格式 + bool flv_proj = 13; +} + +// 播放页信息-响应 +message PlayViewReply { + // 视频url信息 + bilibili.app.playurl.v1.VideoInfo video_info = 1; + // 禁用功能配置 + PlayAbilityConf play_conf = 2; +} + +// 禁用功能配置 +message PlayAbilityConf { + // 后台播放 + bool background_play_disable = 1; + // 镜像反转 + bool flip_disable = 2; + // 返回视频的是否支持投屏 + bool cast_disable = 3; + // 反馈 + bool feedback_disable = 4; + // 字幕 + bool subtitle_disable = 5; + // 播放速度 + bool playback_rate_disable = 6; + // 定时停止播放 + bool time_up_disable = 7; + // 播放方式 + bool playback_mode_disable = 8; + // 画面尺寸 + bool scale_mode_disable = 9; + // 顶 + bool like_disable = 10; + // 踩 + bool dislike_disable = 11; + // 投币 + bool coin_disable = 12; + // 充电 + bool elec_disable = 13; + // 分享 + bool share_disable = 14; + // 截图 + bool screen_shot_disable = 15; + // 锁屏 + bool lock_screen_disable = 16; + // 相关推荐 + bool recommend_disable = 17; + // 倍速 + bool playback_speed_disable = 18; + // 清晰度 + bool definition_disable = 19; + // 选集 + bool selections_disable = 20; + // 下一集 + bool next_disable = 21; + // 编辑弹幕 + bool edit_dm_disable = 22; + // 外层面板弹幕设置 + bool outer_dm_disable = 25; + // 三点内弹幕设置 + bool inner_dm_disable = 26; + // 画中画 + bool small_window_disable = 27; +} + +// 投屏地址-响应 +message ProjectReply { + bilibili.app.playurl.v1.PlayURLReply project = 1; +} diff --git a/grpc_api/bilibili/community/service/dm/v1.proto b/grpc_api/bilibili/community/service/dm/v1.proto deleted file mode 100644 index a3cf445..0000000 --- a/grpc_api/bilibili/community/service/dm/v1.proto +++ /dev/null @@ -1,546 +0,0 @@ -syntax = "proto3"; - -package bilibili.community.service.dm.v1; - -//弹幕 -service DM { - //修改弹幕配置 - //https://app.bilibili.com/bilibili.community.service.dm.v1.DM/DmPlayerConfig - rpc DmPlayerConfig (DmPlayerConfigReq) returns (Response); - - //获取分段弹幕 - // - rpc DmSegMobile (DmSegMobileReq) returns (DmSegMobileReply); - - //获取弹幕元数据 - //https://app.bilibili.com/bilibili.community.service.dm.v1.DM/DmView - rpc DmView (DmViewReq) returns (DmViewReply); -} - -//修改弹幕配置-请求 -message DmPlayerConfigReq{ - // - int64 ts = 1; - - // - PlayerDanmakuSwitch switch = 2; - - // - PlayerDanmakuSwitchSave switchSave = 3; - - // - PlayerDanmakuUseDefaultConfig useDefaultConfig = 4; - - // - PlayerDanmakuAiRecommendedSwitch aiRecommendedSwitch = 5; - - // - PlayerDanmakuAiRecommendedLevel aiRecommendedLevel = 6; - - // - PlayerDanmakuBlocktop blocktop = 7; - - // - PlayerDanmakuBlockscroll blockscroll = 8; - - // - PlayerDanmakuBlockbottom blockbottom = 9; - - // - PlayerDanmakuBlockcolorful blockcolorful = 10; - - // - PlayerDanmakuBlockrepeat blockrepeat = 11; - - // - PlayerDanmakuBlockspecial blockspecial = 12; - - // - PlayerDanmakuOpacity opacity = 13; - - // - PlayerDanmakuScalingfactor scalingfactor = 14; - - // - PlayerDanmakuDomain domain = 15; - - // - PlayerDanmakuSpeed speed = 16; - - // - PlayerDanmakuEnableblocklist enableblocklist = 17; - - // - InlinePlayerDanmakuSwitch inlinePlayerDanmakuSwitch = 18; -} - -//修改弹幕配置-回复 -message Response{ - // - int32 code = 1; - - // - string message = 2; -} - -//获取分段弹幕-请求 -message DmSegMobileReq{ - //稿件avid/漫画epid - int64 pid = 1; - - //视频cid/漫画cid - int64 oid = 2; - - //弹幕类型 - //1:视频 2:漫画 - int32 type = 3; - - //分段序号 - int64 segmentIndex = 4; - - //是否青少年模式 - int32 teenagersMode = 5; -} - -//获取分段弹幕-回复 -message DmSegMobileReply{ - //弹幕条目 - repeated DanmakuElem elems = 1; - - //是否已关闭弹幕 - //0:未关闭 1:已关闭 - int32 state = 2; - - // - DanmakuAIFlag aiFlag = 3; -} - -//获取弹幕元数据-请求 -message DmViewReq{ - //稿件avid/漫画epid - int64 pid = 1; - - //视频cid/漫画cid - int64 oid = 2; - - //弹幕类型 - //1:视频 2:漫画 - int32 type = 3; - - //页面spm - string spmid = 4; - - //是否冷启 - int32 isHardBoot = 5; -} - -//获取弹幕元数据-回复 -message DmViewReply{ - //是否已关闭弹幕 - //0:未关闭 1:已关闭 - bool closed = 1; - - //智能防挡弹幕蒙版信息 - VideoMask mask = 2; - - //视频字幕信息 - VideoSubtitle subtitle = 3; - - //高级弹幕专包url - repeated string specialDms = 4; - - //云屏蔽配置信息 - DanmakuFlagConfig aiFlag = 5; - - // - DanmuPlayerViewConfig playerConfig = 6; - - // - int32 sendBoxStyle = 7; - - //是否允许 - bool allow = 8; - - // - string checkBox = 9; - - // - string checkBoxShowMsg = 10; - - // - string textPlaceholder = 11; - - //弹幕输入框文案 - string inputPlaceholder = 12; - - // - repeated string reportFilterContent = 13; -} - -// -message DanmakuAIFlag{ - // - repeated DanmakuFlag dmFlags = 1; -} - -//弹幕条目 -message DanmakuElem{ - //弹幕dmid - int64 id = 1; - - //弹幕出现位置 - int32 progress = 2; - - //弹幕类型 - int32 mode = 3; - - //弹幕字号 - int32 fontsize = 4; - - //弹幕颜色 - uint32 color = 5; - - //发送着UID hash - string midHash = 6; - - //弹幕正文 - string content = 7; - - //发送时间 - int64 ctime = 8; - - //权重 - int32 weight = 9; - - //动作 - string action = 10; - - //弹幕池 - int32 pool = 11; - - //弹幕dmid-str - string idStr = 12; - - //弹幕属性 - //0:正常 4:高赞 16:? - int32 attr = 13; -} - -// -message DanmakuFlag{ - // - int64 dmid = 1; - - // - uint32 flag = 2; -} - -//云屏蔽配置信息 -message DanmakuFlagConfig{ - //云屏蔽等级 - int32 recFlag = 1; - - //云屏蔽文案 - string recText = 2; - - //云屏蔽开关 - int32 recSwitch = 3; -} - -// -message DanmuDefaultPlayerConfig{ - // - bool playerDanmakuUseDefaultConfig = 1; - - // - bool playerDanmakuAiRecommendedSwitch = 4; - - // - int32 playerDanmakuAiRecommendedLevel = 5; - - // - bool playerDanmakuBlocktop = 6; - - // - bool playerDanmakuBlockscroll = 7; - - // - bool playerDanmakuBlockbottom = 8; - - // - bool playerDanmakuBlockcolorful = 9; - - // - bool playerDanmakuBlockrepeat = 10; - - // - bool playerDanmakuBlockspecial = 11; - - // - float playerDanmakuOpacity = 12; - - // - float playerDanmakuScalingfactor = 13; - - // - float playerDanmakuDomain = 14; - - // - int32 playerDanmakuSpeed = 15; - - // - bool inlinePlayerDanmakuSwitch = 16; -} - -// -message DanmuPlayerConfig{ - // - bool playerDanmakuSwitch = 1; - - // - bool playerDanmakuSwitchSave = 2; - - // - bool playerDanmakuUseDefaultConfig = 3; - - // - bool playerDanmakuAiRecommendedSwitch = 4; - - // - int32 playerDanmakuAiRecommendedLevel = 5; - - // - bool playerDanmakuBlocktop = 6; - - // - bool playerDanmakuBlockscroll = 7; - - // - bool playerDanmakuBlockbottom = 8; - - // - bool playerDanmakuBlockcolorful = 9; - - // - bool playerDanmakuBlockrepeat = 10; - - // - bool playerDanmakuBlockspecial = 11; - - // - float playerDanmakuOpacity = 12; - - // - float playerDanmakuScalingfactor = 13; - - // - float playerDanmakuDomain = 14; - - // - int32 playerDanmakuSpeed = 15; - - // - bool playerDanmakuEnableblocklist = 16; - - // - bool inlinePlayerDanmakuSwitch = 17; - - // - int32 inlinePlayerDanmakuConfig = 18; -} - -// -message DanmuPlayerDynamicConfig{ - // - int32 progress = 1; - - // - float playerDanmakuDomain = 2; -} - -// -message DanmuPlayerViewConfig{ - // - DanmuDefaultPlayerConfig danmukuDefaultPlayerConfig = 1; - - // - DanmuPlayerConfig danmukuPlayerConfig = 2; - - // - repeated DanmuPlayerDynamicConfig danmukuPlayerDynamicConfig = 3; -} - -// -message InlinePlayerDanmakuSwitch{ - // - bool value = 1; -} - -// -message PlayerDanmakuAiRecommendedLevel{ - // - bool value = 1; -} - -// -message PlayerDanmakuAiRecommendedSwitch{ - // - bool value = 1; -} - -// -message PlayerDanmakuBlockbottom{ - // - bool value = 1; -} - -// -message PlayerDanmakuBlockcolorful{ - // - bool value = 1; -} - -// -message PlayerDanmakuBlockrepeat{ - // - bool value = 1; -} - -// -message PlayerDanmakuBlockscroll{ - // - bool value = 1; -} - -// -message PlayerDanmakuBlockspecial{ - // - bool value = 1; -} - -// -message PlayerDanmakuBlocktop{ - // - bool value = 1; -} - -// -message PlayerDanmakuDomain{ - // - float value = 1; -} - -// -message PlayerDanmakuEnableblocklist{ - // - bool value = 1; -} - -// -message PlayerDanmakuOpacity{ - // - float value = 1; -} - -// -message PlayerDanmakuScalingfactor{ - // - float value = 1; -} - -// -message PlayerDanmakuSpeed{ - // - int32 value = 1; -} - -// -message PlayerDanmakuSwitch{ - // - bool value = 1; -} - -// -message PlayerDanmakuSwitchSave{ - // - bool value = 1; -} - -// -message PlayerDanmakuUseDefaultConfig{ - // - bool value = 1; -} - -//单个字幕信息 -message SubtitleItem{ - //字幕id - int64 id = 1; - - //字幕id-str - string idStr = 2; - - //字幕语言代码 - string lan = 3; - - //字幕语言 - string lanDoc = 4; - - //字幕文件url - string subtitleUrl = 5; - - //字幕作者信息 - UserInfo author = 6; -} - -//字幕作者信息 -message UserInfo{ - //作者uid - int64 mid = 1; - - //作者昵称 - string name = 2; - - //作者性别 - string sex = 3; - - //作者头像url - string face = 4; - - //作者个人签名 - string sign = 5; - - // - int32 rank = 6; -} - -//智能防挡弹幕蒙版信息 -message VideoMask{ - //视频cid - int64 cid = 1; - - //平台 - //0:web端 1:app端 - int32 plat = 2; - - //帧率 - int32 fps = 3; - - //间隔时间 - int64 time = 4; - - //蒙版url - string maskUrl = 5; -} - -//视频字幕信息 -message VideoSubtitle{ - //视频原语言代码 - string lan = 1; - - //视频原语言 - string lanDoc = 2; - - //视频字幕列表 - repeated SubtitleItem subtitles = 3; -} \ No newline at end of file diff --git a/grpc_api/bilibili/community/service/dm/v1/dm.proto b/grpc_api/bilibili/community/service/dm/v1/dm.proto new file mode 100644 index 0000000..b2856f5 --- /dev/null +++ b/grpc_api/bilibili/community/service/dm/v1/dm.proto @@ -0,0 +1,531 @@ +syntax = "proto3"; + +package bilibili.community.service.dm.v1; + +//弹幕 +service DM { + // 获取分段弹幕 + rpc DmSegMobile (DmSegMobileReq) returns (DmSegMobileReply); + // 客户端弹幕元数据 字幕、分段、防挡蒙版等 + rpc DmView (DmViewReq) returns (DmViewReply); + // 修改弹幕配置 + rpc DmPlayerConfig (DmPlayerConfigReq) returns (Response); + // ott弹幕列表 + rpc DmSegOtt(DmSegOttReq) returns(DmSegOttReply); + // SDK弹幕列表 + rpc DmSegSDK(DmSegSDKReq) returns(DmSegSDKReply); +} + +// 弹幕SDK-请求 +message DmSegSDKReq { + // 稿件avid/漫画epid + int64 pid = 1; + // 视频cid/漫画cid + int64 oid = 2; + // 弹幕类型 + // 1:视频 2:漫画 + int32 type = 3; + // 分段(6min) + int64 segment_index = 4; +} + +// 弹幕SDK-响应 +message DmSegSDKReply { + // 是否已关闭弹幕 + // 0:未关闭 1:已关闭 + bool closed = 1; + // 弹幕列表 + repeated DanmakuElem elems = 2; +} + +// ott弹幕列表-请求 +message DmSegOttReq { + // 稿件avid/漫画epid + int64 pid = 1; + // 视频cid/漫画cid + int64 oid = 2; + // 弹幕类型 + // 1:视频 2:漫画 + int32 type = 3; + // 分段(6min) + int64 segment_index = 4; +} + +// ott弹幕列表-响应 +message DmSegOttReply { + // 是否已关闭弹幕 + // 0:未关闭 1:已关闭 + bool closed = 1; + // 弹幕列表 + repeated DanmakuElem elems = 2; +} + +// 获取弹幕-请求 +message DmSegMobileReq{ + // 稿件avid/漫画epid + int64 pid = 1; + // 视频cid/漫画cid + int64 oid = 2; + // 弹幕类型 + // 1:视频 2:漫画 + int32 type = 3; + // 分段(6min) + int64 segmentIndex = 4; + // 是否青少年模式 + int32 teenagersMode = 5; +} + +// 获取弹幕-响应 +message DmSegMobileReply{ + // 弹幕列表 + repeated DanmakuElem elems = 1; + // 是否已关闭弹幕 + // 0:未关闭 1:已关闭 + int32 state = 2; + // 弹幕云屏蔽ai评分值 + DanmakuAIFlag aiFlag = 3; +} + +// 客户端弹幕元数据-请求 +message DmViewReq { + // 稿件avid/漫画epid + int64 pid = 1; + // 视频cid/漫画cid + int64 oid = 2; + // 弹幕类型 + // 1:视频 2:漫画 + int32 type = 3; + // 页面spm + string spmid = 4; + // 是否冷启 + int32 isHardBoot = 5; +} + +// 客户端弹幕元数据-响应 +message DmViewReply{ + // 是否已关闭弹幕 + // 0:未关闭 1:已关闭 + bool closed = 1; + // 智能防挡弹幕蒙版信息 + VideoMask mask = 2; + // 视频字幕 + VideoSubtitle subtitle = 3; + // 高级弹幕专包url(bfs) + repeated string specialDms = 4; + // 云屏蔽配置信息 + DanmakuFlagConfig aiFlag = 5; + // 弹幕配置信息 + DanmuPlayerViewConfig playerConfig = 6; + // 弹幕发送框样式 + int32 sendBoxStyle = 7; + // 是否允许 + bool allow = 8; + // check box 是否展示 + string checkBox = 9; + // check box 展示文本 + string checkBoxShowMsg = 10; + // 展示文案 + string textPlaceholder = 11; + // 弹幕输入框文案 + string inputPlaceholder = 12; + // 用户举报弹幕 cid维度屏蔽的正则规则 + repeated string report_filter_content = 13; +} + +// web端弹幕元数据-响应 +message DmWebViewReply { + // 是否已关闭弹幕 + // 0:未关闭 1:已关闭 + int32 state = 1; + // + string text = 2; + // + string text_side = 3; + // 分段弹幕配置 + DmSegConfig dm_sge = 4; + // 云屏蔽配置信息 + DanmakuFlagConfig flag = 5; + // 高级弹幕专包url(bfs) + repeated string special_dms = 6; + // check box 是否展示 + bool check_box = 7; + // 弹幕数 + int64 count = 8; + // 互动弹幕 + repeated CommandDm commandDms = 9; + // 用户弹幕配置 + DanmuWebPlayerConfig player_config = 10; + // 用户举报弹幕 cid维度屏蔽 + repeated string report_filter_content = 11; +} + +// 互动弹幕条目信息 +message CommandDm { + // 弹幕id + int64 id = 1; + // 对象视频cid + int64 oid = 2; + // 发送者mid + string mid = 3; + // 互动弹幕指令 + string command = 4; + // 互动弹幕正文 + string content = 5; + // 出现时间 + int32 progress = 6; + // 创建时间 + string ctime = 7; + // 发布时间 + string mtime = 8; + // 扩展json数据 + string extra = 9; + // 弹幕id str类型 + string idStr = 10; +} + +// +message DmSegConfig { + // + int64 page_size = 1; + // + int64 total = 2; +} + +// 智能防挡弹幕蒙版信息 +message VideoMask { + // 视频cid + int64 cid = 1; + // 平台 + // 0:web端 1:客户端 + int32 plat = 2; + // 帧率 + int32 fps = 3; + // 间隔时间 + int64 time = 4; + // 蒙版url + string maskUrl = 5; +} + +// 视频字幕信息 +message VideoSubtitle { + // 视频原语言代码 + string lan = 1; + // 视频原语言 + string lanDoc = 2; + // 视频字幕列表 + repeated SubtitleItem subtitles = 3; +} + +// web端用户弹幕配置 +message DanmuWebPlayerConfig { + // + bool dm_switch = 1; + // + bool ai_switch = 2 ; + // + int32 ai_level = 3 ; + // + bool blocktop = 4 ; + // + bool blockscroll = 5 ; + // + bool blockbottom = 6 ; + // + bool blockcolor = 7 ; + // + bool blockspecial = 8 ; + // + bool preventshade = 9 ; + // + bool dmask = 10 ; + // + float opacity = 11 ; + // + int32 dmarea = 12 ; + // + float speedplus = 13 ; + // + float fontsize = 14 ; + // + bool screensync = 15 ; + // + bool speedsync = 16 ; + // + string fontfamily = 17 ; + // + bool bold = 18 ; + // + int32 fontborder = 19 ; + // + string draw_type = 20 ; +} + +// 单个字幕信息 +message SubtitleItem { + // 字幕id + int64 id = 1; + // 字幕id str + string idStr = 2; + // 字幕语言代码 + string lan = 3; + // 字幕语言 + string lanDoc = 4; + // 字幕文件url + string subtitleUrl = 5; + // 字幕作者信息 + UserInfo author = 6; +} + +// 字幕作者信息 +message UserInfo { + // 用户mid + int64 mid = 1; + // 用户昵称 + string name = 2; + // 用户性别 + string sex = 3; + // 用户头像url + string face = 4; + // 用户签名 + string sign = 5; + // 用户等级 + int32 rank = 6; +} + +// 弹幕条目 +message DanmakuElem { + // 弹幕dmid + int64 id = 1; + // 弹幕出现位置(单位ms) + int32 progress = 2; + // 弹幕类型 + int32 mode = 3; + // 弹幕字号 + int32 fontsize = 4; + // 弹幕颜色 + uint32 color = 5; + // 发送着mid hash + string midHash = 6; + // 弹幕正文 + string content = 7; + // 发送时间 + int64 ctime = 8; + // 权重 区间:[1,10] + int32 weight = 9; + // 动作 + string action = 10; + // 弹幕池 + int32 pool = 11; + // 弹幕dmid str + string idStr = 12; + // 弹幕属性位(bin求AND) + // bit0:保护 bit1:直播 bit2:高赞 + int32 attr = 13; +} + +// 弹幕属性位值 +enum DMAttrBit { + // 保护弹幕 + DMAttrBitProtect = 0; + // 直播弹幕 + DMAttrBitFromLive = 1; + // 高赞弹幕 + DMAttrHighLike = 2; +} + +// 修改弹幕配置-请求 +message DmPlayerConfigReq { + // + int64 ts = 1; + // 是否开启弹幕 + PlayerDanmakuSwitch switch = 2; + // 是否记录弹幕开关设置 + PlayerDanmakuSwitchSave switchSave = 3; + // 是否使用推荐弹幕设置 + PlayerDanmakuUseDefaultConfig useDefaultConfig = 4; + // 是否开启智能云屏蔽 + PlayerDanmakuAiRecommendedSwitch aiRecommendedSwitch = 5; + // 智能云屏蔽等级 + PlayerDanmakuAiRecommendedLevel aiRecommendedLevel = 6; + // 是否屏蔽顶端弹幕 + PlayerDanmakuBlocktop blocktop = 7; + // 是否屏蔽滚动弹幕 + PlayerDanmakuBlockscroll blockscroll = 8; + // 是否屏蔽底端弹幕 + PlayerDanmakuBlockbottom blockbottom = 9; + // 是否屏蔽彩色弹幕 + PlayerDanmakuBlockcolorful blockcolorful = 10; + // 是否屏蔽重复弹幕 + PlayerDanmakuBlockrepeat blockrepeat = 11; + // 是否屏蔽高级弹幕 + PlayerDanmakuBlockspecial blockspecial = 12; + // 弹幕不透明度 + PlayerDanmakuOpacity opacity = 13; + // 弹幕缩放比例 + PlayerDanmakuScalingfactor scalingfactor = 14; + // 弹幕显示区域 + PlayerDanmakuDomain domain = 15; + // 弹幕速度 + PlayerDanmakuSpeed speed = 16; + // 是否开启屏蔽列表 + PlayerDanmakuEnableblocklist enableblocklist = 17; + // 是否开启弹幕 + InlinePlayerDanmakuSwitch inlinePlayerDanmakuSwitch = 18; +} + +// 修改弹幕配置-响应 +message Response { + // + int32 code = 1; + // + string message = 2; +} + +// 弹幕ai云屏蔽条目 +message DanmakuFlag { + // 弹幕dmid + int64 dmid = 1; + // 评分 + uint32 flag = 2; +} + +// 云屏蔽配置信息 +message DanmakuFlagConfig { + // 云屏蔽等级 + int32 rec_flag = 1; + // 云屏蔽文案 + string rec_text = 2; + // 云屏蔽开关 + int32 rec_switch = 3; +} + +// 弹幕ai云屏蔽列表 +message DanmakuAIFlag { + // 弹幕ai云屏蔽条目 + repeated DanmakuFlag dm_flags = 1; +} + +// 弹幕配置信息 +message DanmuPlayerViewConfig { + // 弹幕默认配置 + DanmuDefaultPlayerConfig danmukuDefaultPlayerConfig = 1; + // 弹幕用户配置 + DanmuPlayerConfig danmukuPlayerConfig = 2; + // 弹幕显示区域自动配置列表 + repeated DanmuPlayerDynamicConfig danmukuPlayerDynamicConfig = 3; +} + +// 弹幕默认配置 +message DanmuDefaultPlayerConfig { + // 是否使用推荐弹幕设置 + bool player_danmaku_use_default_config = 1; + // 是否开启智能云屏蔽 + bool player_danmaku_ai_recommended_switch = 4; + // 智能云屏蔽等级 + int32 player_danmaku_ai_recommended_level = 5; + // 是否屏蔽顶端弹幕 + bool player_danmaku_blocktop = 6; + // 是否屏蔽滚动弹幕 + bool player_danmaku_blockscroll = 7; + // 是否屏蔽底端弹幕 + bool player_danmaku_blockbottom = 8; + // 是否屏蔽彩色弹幕 + bool player_danmaku_blockcolorful = 9; + // 是否屏蔽重复弹幕 + bool player_danmaku_blockrepeat = 10; + // 是否屏蔽高级弹幕 + bool player_danmaku_blockspecial = 11; + // 弹幕不透明度 + float player_danmaku_opacity = 12; + // 弹幕缩放比例 + float player_danmaku_scalingfactor = 13; + // 弹幕显示区域 + float player_danmaku_domain = 14; + // 弹幕速度 + int32 player_danmaku_speed = 15; + // 是否开启弹幕 + bool inline_player_danmaku_switch = 16; +} + +// 弹幕配置 +message DanmuPlayerConfig { + // 是否开启弹幕 + bool player_danmaku_switch = 1; + // 是否记录弹幕开关设置 + bool player_danmaku_switch_save = 2; + // 是否使用推荐弹幕设置 + bool player_danmaku_use_default_config = 3; + // 是否开启智能云屏蔽 + bool player_danmaku_ai_recommended_switch = 4; + // 智能云屏蔽等级 + int32 player_danmaku_ai_recommended_level = 5; + // 是否屏蔽顶端弹幕 + bool player_danmaku_blocktop = 6; + // 是否屏蔽滚动弹幕 + bool player_danmaku_blockscroll = 7; + // 是否屏蔽底端弹幕 + bool player_danmaku_blockbottom = 8; + // 是否屏蔽彩色弹幕 + bool player_danmaku_blockcolorful = 9; + // 是否屏蔽重复弹幕 + bool player_danmaku_blockrepeat = 10; + // 是否屏蔽高级弹幕 + bool player_danmaku_blockspecial = 11; + // 弹幕不透明度 + float player_danmaku_opacity = 12; + // 弹幕缩放比例 + float player_danmaku_scalingfactor = 13; + // 弹幕显示区域 + float player_danmaku_domain = 14; + // 弹幕速度 + int32 player_danmaku_speed = 15; + // 是否开启屏蔽列表 + bool player_danmaku_enableblocklist = 16; + // 是否开启弹幕 + bool inline_player_danmaku_switch = 17; + // + int32 inline_player_danmaku_config = 18; +} + +// 弹幕显示区域自动配置 +message DanmuPlayerDynamicConfig { + // 时间 + int32 progress = 1; + // 弹幕显示区域 + float playerDanmakuDomain = 2; +} + +// 是否开启弹幕 +message PlayerDanmakuSwitch {bool value = 1;} +// 是否记录弹幕开关设置 +message PlayerDanmakuSwitchSave {bool value = 1;} +// 是否使用推荐弹幕设置 +message PlayerDanmakuUseDefaultConfig {bool value = 1;} +// 是否开启智能云屏蔽 +message PlayerDanmakuAiRecommendedSwitch {bool value = 1;} +// 智能云屏蔽等级 +message PlayerDanmakuAiRecommendedLevel {bool value = 1;} +// 是否屏蔽顶端弹幕 +message PlayerDanmakuBlocktop {bool value = 1;} +// 是否屏蔽滚动弹幕 +message PlayerDanmakuBlockscroll {bool value = 1;} +// 是否屏蔽底端弹幕 +message PlayerDanmakuBlockbottom {bool value = 1;} +// 是否屏蔽彩色弹幕 +message PlayerDanmakuBlockcolorful {bool value = 1;} +// 是否屏蔽重复弹幕 +message PlayerDanmakuBlockrepeat {bool value = 1;} +// 是否屏蔽高级弹幕 +message PlayerDanmakuBlockspecial {bool value = 1;} +// 弹幕不透明度 +message PlayerDanmakuOpacity {float value = 1;} +// 弹幕缩放比例 +message PlayerDanmakuScalingfactor {float value = 1;} +// 弹幕显示区域 +message PlayerDanmakuDomain {float value = 1;} +// 弹幕速度 +message PlayerDanmakuSpeed {int32 value = 1;} +// 是否开启屏蔽列表 +message PlayerDanmakuEnableblocklist {bool value = 1;} +// 是否开启弹幕 +message InlinePlayerDanmakuSwitch {bool value = 1;} diff --git a/grpc_api/readme.md b/grpc_api/readme.md index 10bc41b..96d75a3 100644 --- a/grpc_api/readme.md +++ b/grpc_api/readme.md @@ -3,23 +3,32 @@ 注: 1. proto结构体文件按照包名分类,同级放在同一目录中 + 2. 暂时无说明文档,稍后添加 + 3. 以下文件全部来自apk的逆向工程,如有疏漏请包涵 +## grpc主机 + +B站客户端的grpc接口主机为以下服务器 + +> grpc.biliapi.net +> +> app.bilibili.com + +## grpc鉴权 + +需要在请求http头部中添加`access_key`,如下 + +``` +authorization:identify_v1 {access_key} +``` + ## grpc头部 -- [bilibili.metadata](bilibili/metadata.proto):环境参数 -- [bilibili.rpc](bilibili/rpc.proto):响应错误信息 +- [bilibili.metadata](bilibili/metadata):客户端环境参数 +- [bilibili.rpc](bilibili/rpc/status.proto):响应错误信息 ## 接口请求定义 -- [blibili.app.archive.v1](bilibili/app/archive/v1.proto):稿件信息 -- [bilibili.app.card.v1](bilibili/app/card/v1.proro):卡片 -- [blibili.app.playurl.v1](bilibili/app/playurl/v1.proto):APP端视频播放业务 -- [blibili.app.show.v1.Popular](bilibili/app/show/popular/v1.proto):热门内容 -- [blibili.app.show.v1.Rank](bilibili/app/show/rank/v1.proto):榜单 -- [blibili.app.view.v1](bilibili/app/view/v1.proto):稿件详情页 -- [bilibili.cheese.gateway.player.v1](bilibili/cheese/gateway/player/v1.proto):APP端课程播放 -- [bilibili.pgc.gateway.player.v2](bilibili/pgc/gateway/player/v2.proto):APP端PGC播放 -- [bilibili.community.service.dm.v1](bilibili/community/service/dm/v1.proto):弹幕 -- [bilibili.main.community.reply.v1](bilibili/main/community/reply/v1.proto):评论区 \ No newline at end of file +*稍后补充* \ No newline at end of file diff --git a/message/private_msg.md b/message/private_msg.md index d194199..fa4f883 100644 --- a/message/private_msg.md +++ b/message/private_msg.md @@ -34,7 +34,7 @@ **示例:** -以下信息代表了为未关注用户未读私信数为`10`条,已关注用户未读私信数为`3`条 +以下信息代表了为未关注用户未读私信数为`1`条,已关注用户未读私信数为`6`条 ```shell curl 'http://api.vc.bilibili.com/session_svr/v1/session_svr/single_unread' \