diff --git a/grpc_api/bilibili/app/archive_v1.proto b/grpc_api/bilibili/app/archive_v1.proto new file mode 100644 index 0000000..5d02699 --- /dev/null +++ b/grpc_api/bilibili/app/archive_v1.proto @@ -0,0 +1,102 @@ +//稿件信息v1模块 +syntax = "proto3"; +package bilibili.app.archive.v1; + +//用户信息 +message Author{ + int64 mid = 1;//UID + string name = 2;//昵称 + string face = 3;//头像url +} + +//分辨率信息 +message Dimension{ + int64 width = 1;//宽 + int64 height = 2;//高 + int64 rotate = 3;//旋转 +} + +//分P视频 +message Page{ + int64 cid = 1;//cid + int32 page = 2;//分P + string from = 3;//源类型 + string part = 4; + int64 duration = 5; + string vid = 6; + string desc = 7; + string webLink = 8; + Dimension dimension = 9;//分辨率 +} + +//允许配置 +message Rights{ + int32 bp = 1; + int32 elec = 2; + int32 download = 3; + int32 movie = 4; + int32 pay = 5; + int32 hd5 = 6; + int32 noReprint = 7; + int32 autoplay = 8; + int32 ugcPay = 9; + int32 isCooperation = 10; + int32 ugcPayPreview = 11; + int32 noBackground = 12; +} + +//合作成员 +message StaffInfo{ + int64 mid = 1;//UID + string title = 2;//成员备注 + int64 attribute = 3;// +} + +//状态数 +message Stat{ + int64 aid = 1;//avid + int32 view = 2;//播放 + int32 danmaku = 3;//弹幕 + int32 reply = 4;//评论 + int32 fav = 5;//收藏 + int32 coin = 6;//投币 + int32 share = 7;//分享 + int32 nowRank = 8;//当前排名 + int32 hisRank = 9;//历史最好排名 + int32 like = 10;//点赞 + int32 dislike = 11;//点踩 +} + +//稿件基本信息 +message Arc{ + int64 aid = 1; //稿件avid + int64 videos = 2; //稿件分P数 + int32 typeId = 3; //分区tid + string typeName = 4; //子分区名 + int32 copyright = 5; //稿件类型 + string pic = 6; //稿件封面url + string title = 7; //稿件标题 + int64 pubdate = 8; + int64 ctime = 9; + string desc = 10; //简介 + int32 state = 11; //稿件状态 + int32 access = 12; + int32 attribute = 13; //属性位配置 + string tag = 14; + repeated string tags = 15; + int64 duration = 16; //总时长 + int64 missionId = 17; //参与的活动id + int64 orderId = 18; + string redirectUrl = 19; //重定向url + int64 forward = 20; + Rights rights = 21; + Author author = 22; //UP主信息 + Stat stat = 23; //状态数 + string reportResult = 24; + string dynamic = 25; //动态内容 + int64 firstCid = 26; //1P cid + Dimension dimension = 27; //1P 分辨率 + repeated StaffInfo staffInfo = 28; //合作组成员列表 + int64 seasonId = 29; + int64 attributeV2 = 30; +} \ No newline at end of file diff --git a/grpc_api/bilibili/app/playurl_v1.proto b/grpc_api/bilibili/app/playurl_v1.proto new file mode 100644 index 0000000..55d942d --- /dev/null +++ b/grpc_api/bilibili/app/playurl_v1.proto @@ -0,0 +1,213 @@ +//APP端视频播放v1接口 +syntax = "proto3"; +package bilibili.app.playurl.v1; + +message VideoInfo{ + message stream{ + message streamInfo{ + message Limit{ + string title=1; + string uri=2; + string msg=3; + } + uint32 quality=1;//清晰度 + string format=2;//格式 + string description=3;//格式描述 + uint32 errCode=4; + Limit limit=5; + bool needVip=6;//需要vip + bool needLogin=7;//需要登录 + bool intact=8; + bool noRexcode=9; + int64 attribute=10; + string newDescription=11;//新版格式描述 + string displayDesc=12;//格式文字 + string superscript=13;//新版格式描述备注 + } + message DashVideo{ + string baseUrl=1;//主线流 + repeated string backupUrl=2;//备用流 + uint32 bandwidth=3;//带宽 + uint32 codecid=4; + string md5=5;//md5 + uint64 size=6;//大小 + uint32 audioId=7; + bool noRexcode=8; + } + message SegmentVideo{ + message ResponseUrl{ + uint32 order=1; + uint64 length=2; + uint64 size=3; + string url=4; + repeated string backupUrl=5; + string md5=6; + } + repeated ResponseUrl segment=1; + } + streamInfo info=1;//元数据 + DashVideo dashvideo=2;//dash流 + SegmentVideo segmentvideo=3;//flv流 + } + message DashAudio{ + uint32 id=1; + string baseUrl=2;//主线流 + repeated string backupUrl=3;//备用流 + uint32 bandwidth=4;//带宽 + uint32 codecid=5;// + string md5=6;//md5 + uint64 size=7;//大小 + } + message DolbyItem{ + int32 type=1; + DashAudio audio=2; + } + uint32 quality=1;//视频清晰度 + string format=2;//视频格式 + uint64 timelength=3;//视频时长 + uint32 videoCodecid=4;// + repeated stream streamList=5;//视频流 + repeated DashAudio audio=6;//伴音流 + DolbyItem dolby=7;//杜比伴音流 +} + +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; +} + +message UpgradeLimit{ + message Report{ + string showEventId=1; + string clickEventId=2; + string extends=3; + } + message ButtonInfo{ + message BadgeInfo{ + string text=1; + string bgColor=2; + string bgColorNight=3; + } + string text=1; + string textColor=2; + string textColorNight=3; + string bgColor=4; + string bgColorNight=5; + string link=6; + string actionType=7; + BadgeInfo badgeInfo=8; + Report report=9; + } + int32 code =1; + string message =2; + string image =3; + ButtonInfo button=4; +} + +message Chronos{ + string md5=1; + string file=2; +} + +message PlayArcConf{ + message ArcConf{ + bool isSupport=1; + } + 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; +} + +message Event{ + message Shake{ + string file=1; + } + Shake shake=1; +} + +//获取视频url +//https://app.bilibili.com/bilibili.app.playurl.v1.PlayURL/PlayView +//请求 +message PlayURLReq{ + int64 aid = 1; //avid + int64 cid = 2; //cid + int64 qn = 3; //清晰度 + int32 fnver = 4; //流类型 + int32 fnval = 5; + uint32 download = 6; //下载配置 0:播放 1:flv下载 2:dash下载 + int32 forceHost = 7; + bool fourk = 8; //是否4K + string spmid = 9; + string fromSpmid = 10; +} +//回复 +message PlayViewReply{ + VideoInfo info = 1; //视频信息 + PlayAbilityConf PlayConf = 2; //播放界面配置 + UpgradeLimit upgradeLimit = 3; + Chronos chronos = 4; + PlayArcConf playArc = 5; + Event event = 6; +} + +//获取播放界面配置 +//https://app.bilibili.com/bilibili.app.playurl.v1.PlayURL/PlayConf +//请求 +message PlayConfReq{ + +} +//回复 +message PlayConfReply{ + PlayAbilityConf playConf = 1; +} \ No newline at end of file diff --git a/grpc_api/bilibili/app/view_v1.proto b/grpc_api/bilibili/app/view_v1.proto new file mode 100644 index 0000000..9f10a94 --- /dev/null +++ b/grpc_api/bilibili/app/view_v1.proto @@ -0,0 +1,669 @@ +//视频页v1接口 +syntax = "proto3"; +package bilibili.app.view.v1; + +import "google/protobuf/any.proto"; +import public "bilibili/app/archive_v1.proto"; + +message ActivityResource{ + string modPoolName = 1; + string modResourceName = 2; + string bgColor = 3; + string selectedBgColor = 4; + string textColor = 5; + string lightTextColor = 6; + string darkTextColor = 7; + string dividerColor = 8; +} + +message Attention{ + int32 startTime = 1; + int32 endTime = 2; + double posX = 3; + double posY = 4; +} + +message ActivitySeason{ + bilibili.app.archive.v1.Arc arc = 1; + repeated ViewPage pages = 2; + OnwerExt ownerExt = 3; + ReqUser reqUser = 4; + ElecRank elecRank = 5; + History history = 6; + string bvid = 7; + Honor honor = 8; + repeated Staff staff = 9; + UgcSeason ugcSeason = 10; + Tab tab = 11; + Rank rank = 12; + Order order = 13; + bool supportDislike = 14; + OperationRelate operationRelate = 15; + ActivityResource activityResource = 16; + string shortLink = 17; + Label label = 18; + Dislike dislike = 19; + PlayerIcon playerIcon = 20; + string shareSubtitle = 21; + CMConfig cmConfig = 22; + TFPanelCustomized tfPanelCustomized = 23; + string argueMsg = 24; + ECode ecode = 25; + CustomConfig customConfig = 26; +} + +message Audio{ + string title = 1; + string coverUrl = 2; + int64 songId = 3; + int64 playCount = 4; + int64 replyCount = 5; + int64 upperId = 6; + string entrance = 7; + int64 songAttr = 8; +} + +message Bgm { + int64 sid = 1; + int64 mid = 2; + string title = 3; + string author = 4; + string jumpUrl = 5; + string cover = 6; +} + +message BizFavSeasonParam{ + int64 seasonId = 1; +} + +message BizFollowVideoParam{ + int64 seasonId = 1; +} + +message BizJumpLinkParam{ + string url = 1; +} + +message BizReserveActivityParam{ + int64 activityId = 1; + string from = 2; + string type = 3; + int64 oid = 4; +} + +enum BizType{ + BizTypeNone = 0; + BizTypeFollowVideo = 1; + BizTypeReserveActivity = 2; + BizTypeJumpLink = 3; + BizTypeFavSeason = 4; +} + +message Button{ + string title = 1; + string uri = 2; +} + +message CM{ + google.protobuf.Any sourceContent = 1; +} + +message CMConfig { + google.protobuf.Any adsControl = 1; +} + +message Chronos{ + string md5 = 1; + string file = 2; +} + +message CustomConfig { + string redirectUrl = 1; +} + +message CommandDm{ + int64 id = 1; + int64 oid = 2; + string mid = 3; + string command = 4; + string content = 5; + int32 progress = 6; + string ctime = 7; + string mtime = 8; + string extra = 9; + string idStr = 10; +} + +message Config { + string relatesTitle = 1; + int32 relatesStyle = 2; + int32 relateGifExp = 3; + int32 endPageHalf = 4; + int32 endPageFull = 5; +} + +message DM{ + bool closed = 1; + bool realName = 2; + int64 count = 3; +} + +//不喜欢原因项 +message Dislike { + string title = 1; + string subtitle = 2; + repeated DislikeReasons reasons = 3; +} + +message DislikeReasons{ + int64 id = 1; + int64 mid = 2; + int32 rid = 3; + int64 tagId = 4; + string name = 5; +} + +enum ECode{ + DEFAULT = 0; + CODE404 = 1; +} + +message ElecRank { + repeated ElecRankItem list = 1; + int64 count = 2; +} + +message ElecRankItem{ + string avatar = 1; + string nickname = 2; + string message = 3; + int64 mid = 4; +} + +message Episode{ + int64 id = 1; + int64 aid = 2; + int64 cid = 3; + string title = 4; + string cover = 5; + string coverRightText = 6; + bilibili.app.archive.v1.Page page = 7; + bilibili.app.archive.v1.Stat stat = 8; + string bvid = 9; +} + +message History { + int64 cid = 1; + int64 progress = 2; +} + +message Honor { + string icon = 1; + string iconNight = 2; + string text = 3; + string textExtra = 4; + string textColor = 5; + string textColorNight = 6; + string bgColor = 7; + string bgColorNight = 8; + string url = 9; + string urlText = 10; +} + +message Interaction { + Node historyNode = 1; + int64 graphVersion = 2; + string msg = 3; + string evaluation = 4; + int64 mark = 5; +} + +message Label { + int32 type = 1; + string uri = 2; +} + +message Live{ + int64 mid = 1; + int64 roomid = 2; + string uri = 3; +} + +message Node{ + int64 nodeId = 1; + string title = 2; + int64 cid = 3; +} + +message Notice{ + string title = 1; + string desc = 2; +} + +message OfficialVerify{ + int32 type = 1; + string desc = 2; +} + +message OnwerExt { + OfficialVerify officialVerify = 1; + Live live = 2; + Vip vip = 3; + repeated int64 assists = 4; + int64 fans = 5; +} + +message OperationCard{ + int32 startTime = 1; + int32 endTime = 2; + string icon = 3; + string title = 4; + string buttonText = 5; + string url = 6; + string content = 7; +} + +message OperationCardNew{ + int64 id = 1; + int32 from = 2; + int32 to = 3; + bool status = 4; + OperationCardType cardType = 5; + StandardCard standardCard= 6; + OperationCard operationCard = 7; + BizType bizType = 8; + BizFollowVideoParam FollowVideoParam = 9; + BizReserveActivityParam ReserveActivityParam = 10; + BizJumpLinkParam LinkParam = 11; +} + +enum OperationCardType{ + CardTypeNone = 0; + CardTypeStandard = 1; + CardTypeSkip = 2; +} + +message OperationRelate{ + string title = 1; + repeated RelateItem relateItem = 2; +} + +message Order{ + bool status = 1; + string title = 2; + string buttonTitle = 3; + string buttonSelectedTitle = 4; + int64 seasonStatView = 5; + int64 seasonStatDanmaku = 6; + BizType orderType = 7; + BizReserveActivityParam reserve = 8; + BizFavSeasonParam favSeason = 9; + string intro = 10; +} + +message PackInfo{ + string title = 1; + string uri = 2; +} + +message PlayerIcon { + string url1 = 1; + string hash1 = 2; + string url2 = 3; + string hash2 = 4; +} + +message Rank{ + string icon = 1; + string iconNight = 2; + string text = 3; +} + +message ReasonStyle{ + string text = 1; + string textColor = 2; + string bgColor = 3; + string borderColor = 4; + string textColorNight = 5; + string bgColorNight = 6; + string borderColorNight = 7; + int32 bgStyle = 8; + int32 selected = 9; +} + +//推荐视频 +message Relate { + int64 aid = 1; + string pic = 2; + string title = 3; + bilibili.app.archive.v1.Author author = 4; + bilibili.app.archive.v1.Stat stat = 5; + int64 duration = 6; + string goto = 7; + string param = 8; + string uri = 9; + string jumpUrl = 10; + double rating = 11; + string reserve = 12; + string from = 13; + string desc = 14; + string rcmdReason = 15; + string badge = 16; + int64 cid = 17; + int32 seasonType = 18; + int32 ratingCount = 19; + string tagName = 20; + PackInfo packInfo = 21; + Notice notice = 22; + Button button = 23; + string trackid = 24; + int32 newCard = 25; + ReasonStyle rcmdReasonStyle = 26; + string coverGif = 27; + CM cm = 28; +} + +message RelateItem{ + string url = 1; + string cover = 2; +} + +message RelateTab { + string id = 1; + string title = 2; +} + +message ReqUser { + int32 attention = 1; + int32 guestAttention = 2; + int32 favorite = 3; + int32 like = 4; + int32 dislike = 5; + int32 coin = 6; + int32 attentionLevel = 7; +} + +message Season { + string allowDownload = 1; + int64 seasonId = 2; + int32 isJump = 3; + string title = 4; + string cover = 5; + int32 isFinish = 6; + int64 newestEpId = 7; + string newestEpIndex = 8; + int64 totalCount = 9; + int32 weekday = 10; + UserSeason userSeason = 11; + SeasonPlayer player = 12; + string ogvPlayurl = 13; +} + +message SeasonPlayer{ + int64 aid = 1; + string vid = 2; + int64 cid = 3; + string from = 4; +} + +message Section{ + int64 id = 1; + string title = 2; + int64 type = 3; + repeated Episode episodes = 4; +} + +message Staff { + int64 mid = 1; + string title = 2; + string face = 3; + string name = 4; + OfficialVerify officialVerify = 5; + Vip vip = 6; + int32 attention = 7; + int32 labelStyle = 8; +} + +message StandardCard{ + string title = 1; + string buttonTitle = 2; + string buttonSelectedTitle = 3; + bool showSelected = 4; +} + +message TFPanelCustomized{ + string rightBtnImg = 1; + string rightBtnText = 2; + string rightBtnTextColor = 3; + string rightBtnLink = 4; + string mainLabel = 5; + string operator = 6; + map entry = 7; +} + +//TAG图标 +message TIcon { + string icon = 1; +} + +message Tab{ + string background = 1; + TabOtype otype = 2; + int64 oid = 3; + string uri = 4; + TabStyle style = 5; + string text = 6; + string textColor = 7; + string textColorSelected = 8; + string pic = 9; + int64 id = 10; +} + +enum TabOtype{ + UnknownOtype = 0; + URL = 1; + TopicNA = 2; +} + +enum TabStyle{ + UnknownStyle = 0; + Text = 1; + Pic = 2; +} + +//TAG信息 +message Tag { + int64 id = 1; + string name = 2; + int64 likes = 3; + int64 hates = 4; + int32 liked = 5; + int32 hated = 6; + string uri = 7; + string tagType = 8; +} + +message UgcSeason { + int64 id = 1; + string title = 2; + string cover = 3; + string intro = 4; + repeated Section sections = 5; + UgcSeasonStat stat = 6; + string labelText = 7; + string labelTextColor = 8; + string labelBgColor = 9; + string labelBgNightColor = 11; + string labelTextNightColor = 10; + string descRight = 12; + int64 epCount = 13; +} + +message UgcSeasonStat{ + int64 seasonId = 1; + int32 view = 2; + int32 danmaku = 3; + int32 reply = 4; + int32 fav = 5; + int32 coin = 6; + int32 share = 7; + int32 nowRank = 8; + int32 hisRank = 9; + int32 like = 10; +} + +message UpAct{ + int64 sid = 1; + int64 mid = 2; + string title = 3; + string statement = 4; + string image = 5; + string url = 6; + string button = 7; +} + +message UserGarb{ + string urlImageAniCut = 1; +} + +message UserSeason{ + string attention = 1; +} + +message VideoGuide{ + repeated Attention attention = 1; //关注按钮卡片 + repeated CommandDm commandDms = 2; //互动弹幕 + repeated OperationCard operationCard = 3; + repeated OperationCardNew operationCardNew = 4; +} + +//分P明细 +message ViewPage { + bilibili.app.archive.v1.Page page = 1;//分P视频 + Audio audio = 2; + DM dm =3; + string downloadTitle = 4; + string downloadSubtitle = 5; +} + +message Vip{ + int32 type = 1; + int64 dueDate = 2; + string dueRemark = 3; + int32 accessStatus = 4; + int32 vipStatus = 5; + string vipStatusWarn = 6; + int32 themeType = 7; + VipLabel label = 8; +} + +message VipLabel{ + string path = 1; +} + +message subTFPanel{ + string rightBtnImg = 1; + string rightBtnText = 2; + string rightBtnTextColor = 3; + string rightBtnLink = 4; + string mainLabel = 5; + string operator = 6; +} + +//视频页信息 +//https://app.bilibili.com/bilibili.app.view.v1.View/View +//请求 +message ViewReq { + int64 aid = 1; //avid + string bvid = 2; //bvid + string from = 3; + string trackid = 4; + string adExtra = 5; + int32 qn = 6; + int32 fnver = 7; + int32 fnval = 8; + int32 forceHost = 9; + int32 fourk = 10; + string spmid = 11; + string fromSpmid = 12; + int32 autoplay = 13; +} +//回复 +message ViewReply { + bilibili.app.archive.v1.Arc arc = 1; //稿件基本信息 + repeated ViewPage pages = 2; //分P信息 + OnwerExt ownerExt = 3; + ReqUser reqUser = 4; + repeated Tag tag = 5; //稿件TAG + map tIcon = 6; //TAG图标 + Season season = 7; + ElecRank elecRank = 8; + History history = 9; + repeated Relate relates = 10; //推荐视频 + Dislike dislike = 11; //不喜欢原因项 + PlayerIcon playerIcon = 12; + string vipActive_ = 13; + string bvid = 14;//稿件bvid + Honor honor = 15; + repeated RelateTab relateTab = 16; + string activityUrl = 17; + repeated Bgm bgm = 18; + repeated Staff staff = 19; + string argueMsg = 20;//警告信息 + string shortLink = 21; + int32 playParam = 22; + Label label = 23; + UgcSeason ugcSeason = 24; + Config config = 25; + string shareSubtitle_ = 26; + Interaction interaction = 27; + int32 ecode = 28; + CustomConfig customConfig = 29; + repeated CM cms = 30; + CMConfig cmConfig = 31; + Tab tab = 32; + Rank rank = 33; + TFPanelCustomized tfPanelCustomized = 34; + UpAct upAct = 35; + UserGarb userGarb = 36; + ActivitySeason activitySeason = 37; +} + +//获取视频特殊数据 +//https://app.bilibili.com/bilibili.app.view.v1.View/ViewProgress +//请求 +message ViewProgressReq{ + int64 aid = 1; + int64 cid = 2; + int64 upMid = 3; +} +message ViewProgressReply{ + VideoGuide videoGuide = 1; //特殊数据 + Chronos chronos = 2; //资源包 +} + +//? +//https://app.bilibili.com/bilibili.app.view.v1.View/ShortFormVideoDownload +//请求 +message ShortFormVideoDownloadReq{ + int64 aid = 1; + int64 cid = 2; + int64 mid = 3; + string buvid = 4; + string mobiApp = 5; + int64 build = 6; + string device = 7; + string platform = 8; + string spmid = 9; +} +//回复 +message ShortFormVideoDownloadReply{ + bool hasDownloadUrl = 1; + string downloadUrl = 2; + string md5 = 3; + int64 size = 4; +} + +message NoReply{ + +} \ No newline at end of file diff --git a/grpc_api/bilibili/cheese_gateway_player_v1.proto b/grpc_api/bilibili/cheese_gateway_player_v1.proto new file mode 100644 index 0000000..6637235 --- /dev/null +++ b/grpc_api/bilibili/cheese_gateway_player_v1.proto @@ -0,0 +1,65 @@ +//APP端课程播放v1接口 +syntax = "proto3"; +package bilibili.cheese.gateway.player.v1; + +import public "bilibili/app/playurl_v1.proto"; + +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; +} + +//获取播放url +//https://app.bilibili.com/bilibili.cheese.gateway.player.v1.PlayURL/PlayView +//请求 +message playViewReq{ + enum CodeType{ + NOCODE = 0; + CODE264 = 1; + CODE265 = 2; + } + int64 epid = 1; //目标剧集epid + int64 cid = 2; //目标视频cid + int64 qn = 3; //清晰度 + int32 fnver = 4; + int32 fnval = 5; //流类型 + uint32 download = 6; //下载配置 0:播放 1:flv下载 2:dash下载 + int32 forceHost = 7; + bool fourk = 8; //是否4K + string spmid = 9; + string fromSpmid = 10; + int32 teenagersMode = 11; + CodeType codetype = 12; //编码类型 + bool isPreview = 13; +} +//回复 +message PlayViewReply{ + bilibili.app.playurl.v1.VideoInfo info = 1; //视频信息 + PlayAbilityConf PlayConf = 2; //播放界面配置 +} \ No newline at end of file diff --git a/grpc_api/bilibili/main_community_reply_v1.proto b/grpc_api/bilibili/main_community_reply_v1.proto new file mode 100644 index 0000000..b62ad80 --- /dev/null +++ b/grpc_api/bilibili/main_community_reply_v1.proto @@ -0,0 +1,340 @@ +//评论区v1接口 +syntax = "proto3"; +package bilibili.main.community.reply.v1; + +import "google/protobuf/any.proto"; + +message CursorReq{ + enum Mode{ + DEFAULT = 0; + UNSPECIFIED = 1; + MAIN_LIST_TIME = 2; + MAIN_LIST_HOT = 3; + } + int64 next = 1; + int64 prev = 2; + Mode mode = 3; //排序模式 +} + +message CursorReply{ + enum Mode{ + DEFAULT = 0; + UNSPECIFIED = 1; + MAIN_LIST_TIME = 2; + MAIN_LIST_HOT = 3; + } + int64 next = 1; + int64 prev = 2; + bool isBegin = 3; + bool isEnd = 4; + Mode mode = 5; +} + +enum SearchItemType{ + DEFAULT_ITEM_TYPE = 0; + GOODS_VALUE = 1; + VIDEO_VALUE = 2; + ARTICLE_VALUE = 3; +} + +message SearchItemCursorReq{ + int64 next = 1; + SearchItemType itemType = 2; +} + +message SearchItemCursorReply{ + bool hasNext = 1; + int64 next = 2; +} + +message Member{ + int64 mid = 1; //UID + string name = 2; //昵称 + string sex = 3; //性别 + string face = 4; //头像url + int64 level = 5; //等级 + int64 officialVerifyType = 6; //认证类型 + int64 vipType = 7; //会员类型 + int64 vipStatus = 8; //会员状态 + int64 vipThemeType = 9; + string vipLabelPath = 10; + string garbPendantImage = 11; //头像框url + string garbCardImage = 12; //装扮卡url + string garbCardImageWithFocus = 13; + string garbCardJumpUrl = 14;//专属装扮页url + string garbCardNumber = 15;//专属装扮id + string garbCardFanColor = 16;//专属装扮id显示颜色 + bool garbCardIsFan = 17;//是否为专属装扮卡 + string fansMedalName = 18; + int64 fansMedalLevel = 19; + int64 fansMedalColor = 20; +} + +message Content{ + message Emote{ + int64 size = 1;//表情大小 1:小 2:大 + string url = 2;//标签url + } + message Topic{ + string link = 1; + int64 id = 2; + } + message Url{ + string title = 1; //标题 + int64 state = 2; + string prefixIcon = 3; //图标url + string appUrlSchema = 4; + string appName = 5; + string appPackageName = 6; + string clickReport = 7; + } + message Vote{ + int64 id = 1; + string title = 2; + int64 count = 3; + } + string message = 1; //评论正文 + map menber = 2; //at到的用户信息 + map emote = 3; //表情转义 + map topic = 4; //话题转义 + map url = 5; //扩展应用转义 + Vote vote = 6; +} + +message ReplyControl{ + int64 action = 1; //操作标志 0:无 1:已点赞 2:已点踩 + bool upLike = 2; //是否UP觉得很赞 + bool upReply = 3; //是否存在UP回复 + bool showFollowBtn = 4; //是否显示关注按钮 + bool isAssist = 5; + string labelText = 6; + bool following = 7; //是否关注 + bool followed = 8; //是否粉丝 + bool blocked = 9; + bool hasFoldedReply = 10; + bool isFoldedReply = 11; + bool isUpTop = 12; //是否UP置顶 + bool isAdminTop = 13; //是否管理置顶 + bool isVoteTop = 14; //是否投票评论 + int64 maxLine = 15; //最大收起行数 + bool invisible = 16; +} + +message ReplyInfo{ + repeated ReplyInfo replies = 1; //二级评论 + int64 id = 2; //rpid + int64 oid = 3; //对象id + int64 type = 4; //评论区类型id + int64 mid = 5; //发布者UID + int64 root = 6; //根评论rpid + int64 parent = 7; //父评论rpid + int64 dialog = 8; //对话评论rpid + int64 like = 9; //点赞数 + int64 ctime = 10; //发布时间 + int64 count = 11; //回复数 + Content content = 12; //评论主体信息 + Member member = 13; //评论发布者信息 + ReplyControl replyControl = 14; //评论显示控制项 +} + +message SubjectControl{ + int64 upMid = 1; //UP主UID + bool isAssist = 2; + bool readOnly = 3; + bool hasVoteAccess = 4; + bool hasLotteryAccess = 5; + bool hasFoldedReply = 6; + string bgText = 7; //空评论背景文字 + bool upBlocked = 8; + bool hasActivityAccess = 9; + bool showTitle = 10; + bool showUpAction = 11; + int64 switcherType = 12; + bool inputDisable = 13; + string rootText = 14; //输入框背景文字 + string childText = 15; + int64 count = 16; //评论总数 + string title = 17; //评论区标题 +} + +message Notice{ + int64 id = 1; + string content = 2; + string link = 3; +} + +message Lottery{ + int64 lotteryId = 1; + int64 lotteryStatus = 2; + int64 lotteryMid = 3; + int64 lotteryTime = 4; + int64 oid = 5; + int64 type = 6; + int64 ctime = 7; + Content content = 8; + Member member = 9; + ReplyControl replyControl = 10; +} + +message Activity{ + int64 activityId = 1; + int64 activityState = 2; + string activityPlaceholder = 3; +} + +message UpSelection{ + int64 pendingCount = 1; + int64 ignoreCount = 2; +} + +message CM{ + google.protobuf.Any sourceContent = 1; +} + +message SearchItem{ + message ArticleSearchItem{ + string title = 1; + string upNickname = 2; + repeated string covers = 3; + } + message GoodsSearchItem{ + int64 id = 1; + string name = 2; + string price = 3; + string income = 4; + string img = 5; + string label = 6; + } + message VideoSearchItem{ + enum VideoItemCase{ + VIDEOITEM_NOT_SET = 0; + UGC = 2; + PGC = 3; + } + message UGCVideoSearchItem{ + string title = 1; + string upNickname = 2; + int64 duration = 3; + string cover = 4; + } + message PGCVideoSearchItem{ + string title = 1; + string category = 2; + string cover = 3; + } + VideoItemCase type = 1; + UGCVideoSearchItem UGCVideo = 2; + PGCVideoSearchItem PGCVideo = 3; + } + enum ItemCase{ + ITEM_NOT_SET = 0; + GOODS = 2; + VIDEO = 3; + ARTICLE = 4; + } + string url = 1; + GoodsSearchItem goods = 2; + VideoSearchItem video = 3; + ArticleSearchItem article = 4; +} + +message SearchItemReplyExtraInfo{ + string eventId = 1; +} + +//评论列表 +//https://app.bilibili.com/bilibili.main.community.reply.v1.Reply/MainList +//请求 +message MainListReq{ + int64 oid = 1; //目标评论区id + int64 type = 2; //评论区类型 + CursorReq cursor = 3; //页面选择 + string extra = 4; + string adExtra = 5; + int64 rpid = 6; +} +//回复 +message MainListReply{ + CursorReply cursor = 1; //页面信息 + repeated ReplyInfo replies = 2; //评论条目 + SubjectControl subjectControl = 3; //评论区显示控制 + ReplyInfo upTop = 4; //UP置顶评论 + ReplyInfo adminTop = 5; //管理置顶评论 + ReplyInfo voteTop = 6; //投票评论 + Notice notice = 7; + Lottery lottery = 8; //抽奖评论 + Activity activity = 9; + UpSelection upSelection = 10; + CM cm = 11; +} + +//二级评论明细 +//https://app.bilibili.com/bilibili.main.community.reply.v1.Reply/DetailList +//请求 +message DetailListReq{ + enum DetailListScene{ + REPLY = 0; //评论区展开 + MSG_FEED = 1; //回复消息推送 + } + int64 oid = 1; //目标评论区id + int64 type = 2; //评论区类型 + int64 root = 3; //根评论rpid + int64 rpid = 4; //目标评论rpid + CursorReq cursor = 5; //页面选择 + DetailListScene scene = 6; //来源标识 +} +//回复 +message DetailListReply{ + CursorReply cursor = 1; //页面信息 + SubjectControl subjectControl = 2; //评论区显示控制 + ReplyInfo root = 3; //根评论信息(带二级评论) + Activity activity = 4; +} + +//对话评论回复树 +//https://app.bilibili.com/bilibili.main.community.reply.v1.Reply/DialogList +//请求 +message DialogListReq{ + int64 oid = 1; //目标评论区id + int64 type = 2; //评论区类型 + int64 root = 3; //根评论rpid + int64 rpid = 4; //目标评论rpid + CursorReq cursor = 5; //页面选择 +} +//回复 +message DialogListReply{ + CursorReply cursor = 1; //页面信息 + SubjectControl subjectControl = 2; //评论区显示控制 + repeated ReplyInfo replies = 3; //评论树列表 + Activity activity = 4; +} + +//搜索提示信息? +//https://app.bilibili.com/bilibili.main.community.reply.v1.Reply/SearchItemPreHook +//请求 +message SearchItemPreHookReq{ + int64 oid = 1; //目标评论区id + int64 type = 2; //评论区类型 +} +//回复 +message SearchItemPreHookReply{ + string placeholderText = 1; + string backgroundText = 2; + repeated SearchItemType orderedType = 3; +} + +//搜索评论区插入项目 +//https://app.bilibili.com/bilibili.main.community.reply.v1.Reply/SearchItem +//请求 +message SearchItemReq{ + SearchItemCursorReq cursor = 1; //页面选择 + int64 oid = 2; //目标评论区id + int64 type = 3; //评论区类型 + string keyword = 4; //搜索关键词 +} +//回复 +message SearchItemReply{ + SearchItemCursorReply cursor = 1; + repeated SearchItem items = 2; + SearchItemReplyExtraInfo extra = 3; +} \ No newline at end of file diff --git a/grpc_api/bilibili/metadata/device.proto b/grpc_api/bilibili/metadata/device.proto new file mode 100644 index 0000000..10a5c37 --- /dev/null +++ b/grpc_api/bilibili/metadata/device.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package bilibili.metadata.device; + +//环境参数1 +//x-bili-device-bin +message Device{ + int32 appId = 1; + int32 build = 2; + string buvid = 3; + string mobiApp = 4; + string platform = 5; + string device = 6; + string channel = 7; + string brand = 8; + string model = 9; + string osver = 10; + string fpLocal = 11; + string fpRemote = 12; + string versionName = 13; +} \ No newline at end of file diff --git a/grpc_api/bilibili/metadata/locale.proto b/grpc_api/bilibili/metadata/locale.proto new file mode 100644 index 0000000..07f9b60 --- /dev/null +++ b/grpc_api/bilibili/metadata/locale.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package bilibili.metadata.locale; + +//区域标识 +//x-bili-locale-bin +message LocaleIds{ + string language = 1; + string script = 2; + string region = 3; +} \ No newline at end of file diff --git a/grpc_api/bilibili/metadata/metadata.proto b/grpc_api/bilibili/metadata/metadata.proto new file mode 100644 index 0000000..12a7508 --- /dev/null +++ b/grpc_api/bilibili/metadata/metadata.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; +package bilibili.metadata; + +//环境参数2 +//x-bili-metadata-bin +message Metadata{ + string accessKey = 1; + string mobiApp = 2; + string device = 3; + int32 build = 4; + string channel = 5; + string buvid = 6; + string platform = 7; +} + +import "google/protobuf/any.proto"; +//接口回复报错信息 +//grpc-status-details-bin +message Status{ + int32 code = 1; //错误码 + string message = 2; //错误信息 + repeated google.protobuf.Any details = 3; //套娃专用 +} \ No newline at end of file diff --git a/grpc_api/bilibili/metadata/network.proto b/grpc_api/bilibili/metadata/network.proto new file mode 100644 index 0000000..5b518e0 --- /dev/null +++ b/grpc_api/bilibili/metadata/network.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package bilibili.metadata.network; + +enum Type{ + NT_UNKNOWN = 0; + WIFI = 1; //wifi + CELLULAR = 2; //蜂窝网络 + OFFLINE = 3; //离线 + ETHERNET = 5; //以太网 + OTHERNET = 4; //其他 +} + +/* +enum Tf{ + +}*/ + +//网络类型标识 +//x-bili-network-bin +message Network{ + Type type = 1; //网络类型 + //Tf tf = 2; + int32 tf = 2; + string oid = 3; +} \ No newline at end of file diff --git a/grpc_api/bilibili/metadata/restriction.proto b/grpc_api/bilibili/metadata/restriction.proto new file mode 100644 index 0000000..640bf26 --- /dev/null +++ b/grpc_api/bilibili/metadata/restriction.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package bilibili.metadata.restriction; + +enum ModeType{ + NORMAL = 0; + TEENAGERS = 1; + LESSONS = 2; +} \ No newline at end of file diff --git a/grpc_api/bilibili/pgc/gateway_player_v2.proto b/grpc_api/bilibili/pgc/gateway_player_v2.proto new file mode 100644 index 0000000..f828a15 --- /dev/null +++ b/grpc_api/bilibili/pgc/gateway_player_v2.proto @@ -0,0 +1,245 @@ +//APP端PGC播放v2接口 +//https://app.bilibili.com/bilibili.pgc.gateway.player.v2.PlayURL/PlayView +syntax = "proto3"; +package bilibili.pgc.gateway.player.v2; + +import "google/protobuf/timestamp.proto"; + +message playViewReq{ + enum CodeType{ + NOCODE = 0; + CODE264 = 1; + CODE265 = 2; + } + int64 epid = 1; //目标剧集epid + int64 cid = 2; //目标视频cid + int64 qn = 3; //清晰度 + int32 fnver = 4; + int32 fnval = 5; //流类型 + uint32 download = 6; //下载配置 0:播放 1:flv下载 2:dash下载 + int32 forceHost = 7; + bool fourk = 8; //是否4K + string spmid = 9; + string fromSpmid = 10; + int32 teenagersMode = 11; + CodeType codetype = 12; //编码类型 + bool isPreview = 13; + int64 roomId = 14; + bool isNeedViewInfo = 15; +} + +message VideoInfo{ + message stream{ + message streamInfo{ + message Limit{ + string title=1; + string uri=2; + string msg=3; + } + uint32 quality=1;//清晰度 + string format=2;//格式 + string description=3;//格式描述 + uint32 errCode=4; + Limit limit=5; + bool needVip=6;//需要vip + bool needLogin=7;//需要登录 + bool intact=8; + bool noRexcode=9; + int64 attribute=10; + string newDescription=11;//新版格式描述 + string displayDesc=12;//格式文字 + string superscript=13;//新版格式描述备注 + } + message DashVideo{ + string baseUrl=1;//主线流 + repeated string backupUrl=2;//备用流 + uint32 bandwidth=3;//带宽 + uint32 codecid=4; + string md5=5;//md5 + uint64 size=6;//大小 + uint32 audioId=7; + bool noRexcode=8; + } + message SegmentVideo{ + message ResponseUrl{ + uint32 order=1; + uint64 length=2; + uint64 size=3; + string url=4; + repeated string backupUrl=5; + string md5=6; + } + repeated ResponseUrl segment=1; + } + streamInfo info=1;//元数据 + DashVideo dashvideo=2;//dash流 + SegmentVideo segmentvideo=3;//flv流 + } + message DashAudio{ + uint32 id=1; + string baseUrl=2;//主线流 + repeated string backupUrl=3;//备用流 + uint32 bandwidth=4;//带宽 + uint32 codecid=5;// + string md5=6;//md5 + uint64 size=7;//大小 + } + message DolbyItem{ + int32 type=1; + DashAudio audio=2; + } + uint32 quality=1;//视频清晰度 + string format=2;//视频格式 + uint64 timelength=3;//视频时长 + uint32 videoCodecid=4;// + repeated stream streamList=5;//视频流 + repeated DashAudio audio=6;//伴音流 + DolbyItem dolby=7;//杜比伴音流 +} + +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; +} + +message PlayViewBusinessInfo{ + bool isPreview=1; + bool bp=2; + string marlinToken=3; +} + +message Event{ + message Shake{ + string file=1; + } + Shake shake=1; +} + +message ViewInfo{ + message Report{ + string showEventId=1; + string clickEventId=2; + string extends=3; + } + message ButtonInfo{ + message BadgeInfo{ + string text=1; + string bgColor=2; + string bgColorNight=3; + } + string text=1; + string textColor=2; + string textColorNight=3; + string bgColor=4; + string bgColorNight=5; + string link=6; + string actionType=7; + BadgeInfo badgeInfo=8; + Report report=9; + } + message Dialog{ + message DialogConfig{ + bool isShowCover=1; + bool isOrientationEnable=2; + bool isNestedScrollEnable=3; + bool isForceHalfscreenEnable=4; + } + message TextInfo{ + string text=1; + string textColor=2; + string textColorNight=3; + } + message ImageInfo{ + string url=1; + } + int64 code=1; + string msg=2; + string type=3; + string styleType=4; + DialogConfig config=5; + TextInfo title=6; + TextInfo subtitle=7; + ImageInfo image=8; + repeated ButtonInfo button=9; + ButtonInfo bottomDesc=10; + Report report=11; + int32 countDownSec=12; + } + message Toast{ + string text=1; + ButtonInfo button=2; + } + message CouponInfo{ + message CouponToast{ + message CouponTextInfo{ + string positivePreview=1; + string section=2; + } + CouponTextInfo textInfo=1; + ButtonInfo button=2; + } + message PopWin{ + message Coupon{ + string couponToken=1; + int64 type=2; + string value=3; + string useDesc=4; + string title=5; + string desc=6; + string payButtonText=7; + string payButtonTextLineThrough=8; + string realAmount=9; + google.protobuf.Timestamp expireTime=10; + } + string title=1; + repeated Coupon coupon=2; + repeated ButtonInfo button=3; + string bottomText=4; + } + CouponToast toast=1; + PopWin popWin=2; + } + message EndPage{ + Dialog dialog=1; + bool hide=2; + } + Dialog dialog=1; + Toast toast=2; + CouponInfo couponInfo=3; + repeated int64 demandNoPayEpids=4; + EndPage endPage=5; +} + +message PlayViewReply{ + VideoInfo info=1;//视频信息 + PlayAbilityConf PlayConf=2;//播放界面配置 + PlayViewBusinessInfo Business=3; + Event event=4; + ViewInfo viewInfo=5; +} \ No newline at end of file diff --git a/grpc_api/bilibili/rpc.proto b/grpc_api/bilibili/rpc.proto new file mode 100644 index 0000000..2fe6371 --- /dev/null +++ b/grpc_api/bilibili/rpc.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package bilibili.rpc; + +import "google/protobuf/any.proto"; + +//接口回复报错信息 +//grpc-status-details-bin +message Status{ + int32 code = 1; //错误码 + string message = 2; //错误信息 + repeated google.protobuf.Any details = 3; //套娃专用 +} \ No newline at end of file diff --git a/grpc_api/comp_proto.bat b/grpc_api/comp_proto.bat new file mode 100644 index 0000000..08f43d1 --- /dev/null +++ b/grpc_api/comp_proto.bat @@ -0,0 +1,8 @@ +@ echo off +rem 递归编译proto +set lang="python" +set patch=%CD% +for /r %patch% %%a in (*.proto) do ( + protoc.exe -I %patch% --%lang%_out=. %%~fa + echo comp %%~fa ok! +) \ No newline at end of file diff --git a/grpc_api/readme.md b/grpc_api/readme.md new file mode 100644 index 0000000..fb97b19 --- /dev/null +++ b/grpc_api/readme.md @@ -0,0 +1,27 @@ +# grpc接口定义(protobuf结构体) + +- `comp_proto.bat`---win递归批量编译脚本 + +注: + +1. proto结构体文件按照包名分类,同级放在同一目录中 +2. 暂时无说明文档,稍后添加 +3. 以下文件全部来自apk的逆向工程,如有疏漏请包涵 + +## grpc头部 + +- [bilibili.metadata.locale](bilibili/metadata/locale.proto):区域信息 +- [bilibili.metadata.network](bilibili/metadata/network.proto):网络信息 +- [bilibili.metadata](bilibili/metadata/metadata.proto):环境参数 +- [bilibili.metadata.restriction](bilibili/metadata/restriction.proto):限制值 +- [bilibili.metadata.device](bilibili/metadata/device.proto):设备信息 +- [bilibili.rpc](bilibili/rpc.proto):响应错误信息 + +## 接口请求定义 + +- [blibili.app.archive.v1](bilibili/app/archive_v1.proto):稿件信息v1模块 +- [blibili.app.playurl.v1](bilibili/app/playurl_v1.proto):APP端视频播放v1接口 +- [blibili.app.view.v1](bilibili/app/view_v1.proto):视频页v1接口 +- [bilibili.pgc.gateway.player.v2](bilibili/pgc/gateway_player_v2.proto):APP端PGC播放v2接口 +- [bilibili.cheese.gateway.player.v1](bilibili/cheese_gateway_player_v1.proto):APP端课程播放v1接口 +- [bilibili.main.community.reply.v1](bilibili/main_community_reply_v1.proto):评论区v1接口 \ No newline at end of file