未验证 提交 50228425 编写于 作者: R Richasy 提交者: GitHub

添加gRPC支持 (#1)

* 添加gRPC定义及请求逻辑
* 修改排行榜显示行为
上级 32334b6a
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for App" Description="Code analysis rules for App.csproj." ToolsVersion="16.0">
<RuleSet Name="Rules for App" Description="Code analysis rules for App.csproj." ToolsVersion="17.0">
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1001" Action="Warning" />
<Rule Id="CA1009" Action="Warning" />
......@@ -78,6 +78,7 @@
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1309" Action="None" />
<Rule Id="SA1402" Action="None" />
<Rule Id="SA1518" Action="None" />
<Rule Id="SA1623" Action="None" />
<Rule Id="SA1642" Action="None" />
</Rules>
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31321.278
# Visual Studio Version 17
VisualStudioVersion = 17.0.31410.414
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "App", "src\App\App.csproj", "{1C288BC0-72F3-4C4C-90AD-A05B52E937B0}"
EndProject
......@@ -47,6 +47,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controller.Uwp", "src\Contr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controller.Uwp.UnitTests", "src\Controller\Controller.Uwp.UnitTests\Controller.Uwp.UnitTests.csproj", "{3B66D3B1-4B4C-4AAF-8556-B3B51999F177}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Models.gRPC", "src\Models\Models.gRPC\Models.gRPC.csproj", "{0187840F-8D1A-4198-B5BF-8B05CADB4554}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -351,6 +353,26 @@ Global
{3B66D3B1-4B4C-4AAF-8556-B3B51999F177}.Release|x86.ActiveCfg = Release|x86
{3B66D3B1-4B4C-4AAF-8556-B3B51999F177}.Release|x86.Build.0 = Release|x86
{3B66D3B1-4B4C-4AAF-8556-B3B51999F177}.Release|x86.Deploy.0 = Release|x86
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|ARM.ActiveCfg = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|ARM.Build.0 = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|ARM64.Build.0 = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|x64.ActiveCfg = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|x64.Build.0 = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|x86.ActiveCfg = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Debug|x86.Build.0 = Debug|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|Any CPU.Build.0 = Release|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|ARM.ActiveCfg = Release|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|ARM.Build.0 = Release|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|ARM64.ActiveCfg = Release|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|ARM64.Build.0 = Release|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|x64.ActiveCfg = Release|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|x64.Build.0 = Release|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|x86.ActiveCfg = Release|Any CPU
{0187840F-8D1A-4198-B5BF-8B05CADB4554}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -372,6 +394,7 @@ Global
{CAE9B987-6DB2-42A8-B3F2-3BB700CC4DD8} = {45B5DFF9-9F13-4BF3-B561-8ABBDFE5C237}
{5213E830-43F5-491E-A8EF-D75083578EF3} = {65F17D44-343F-4B87-A726-3BE3E48168B4}
{3B66D3B1-4B4C-4AAF-8556-B3B51999F177} = {65F17D44-343F-4B87-A726-3BE3E48168B4}
{0187840F-8D1A-4198-B5BF-8B05CADB4554} = {232C0E31-606A-48CD-B860-2E9155EAB4C6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {563225C5-4D56-446B-9ADE-09D3F0DE7963}
......
// Copyright (c) Richasy. All rights reserved.
using System.Collections.Generic;
using System.Threading.Tasks;
using Richasy.Bili.Models.BiliBili;
using Richasy.Bili.Models.Enums;
using Bilibili.App.Show.V1;
namespace Richasy.Bili.Controller.Uwp
{
......@@ -15,13 +15,12 @@ namespace Richasy.Bili.Controller.Uwp
/// 获取排行榜信息.
/// </summary>
/// <param name="partitionId">分区Id.</param>
/// <param name="scope">排行榜范围.</param>
/// <returns>排行榜信息.</returns>
public async Task<RankInfo> GetRankAsync(int partitionId, RankScope scope)
public async Task<List<RankItem>> GetRankAsync(int partitionId)
{
try
{
var rank = await _rankProvider.GetRankDetailAsync(partitionId, scope);
var rank = await _rankProvider.GetRankDetailAsync(partitionId);
return rank;
}
catch
......
......@@ -49,6 +49,10 @@
<Project>{88314412-b020-415b-aeab-57adc43b273e}</Project>
<Name>Models.Enums</Name>
</ProjectReference>
<ProjectReference Include="..\..\Models\Models.gRPC\Models.gRPC.csproj">
<Project>{0187840F-8D1A-4198-B5BF-8B05CADB4554}</Project>
<Name>Models.gRPC</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utilities\Locator\Locator.Uwp\Locator.Uwp.csproj">
<Project>{793ec923-d704-4c6f-9506-eb6a32bfbb8d}</Project>
<Name>Locator.Uwp</Name>
......
......@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Google.Protobuf;
using Richasy.Bili.Models.Enums;
namespace Richasy.Bili.Lib.Interfaces
......@@ -30,6 +31,14 @@ namespace Richasy.Bili.Lib.Interfaces
/// <returns><see cref="HttpRequestMessage"/>.</returns>
Task<HttpRequestMessage> GetRequestMessageAsync(HttpMethod method, string url, Dictionary<string, string> queryParams = null, RequestClientType type = RequestClientType.Android, bool needToken = false);
/// <summary>
/// 获取 <see cref="HttpRequestMessage"/>.
/// </summary>
/// <param name="url">请求地址.</param>
/// <param name="grpcMessage">gRPC信息.</param>
/// <returns><see cref="HttpRequestMessage"/>.</returns>
Task<HttpRequestMessage> GetRequestMessageAsync(string url, IMessage grpcMessage);
/// <summary>
/// 发送请求.
/// </summary>
......@@ -52,5 +61,15 @@ namespace Richasy.Bili.Lib.Interfaces
/// <typeparam name="T">需要转换的目标类型.</typeparam>
/// <returns>转换结果.</returns>
Task<T> ParseAsync<T>(HttpResponseMessage response);
/// <summary>
/// 解析响应.
/// </summary>
/// <param name="response">得到的 <see cref="HttpResponseMessage"/>.</param>
/// <param name="parser">对应gRPC类型的转换器.</param>
/// <typeparam name="T">需要转换的gRPC目标类型.</typeparam>
/// <returns>转换结果.</returns>
Task<T> ParseAsync<T>(HttpResponseMessage response, MessageParser<T> parser)
where T : IMessage<T>;
}
}
// Copyright (c) Richasy. All rights reserved.
using System.Collections.Generic;
using System.Threading.Tasks;
using Richasy.Bili.Models.BiliBili;
using Richasy.Bili.Models.Enums;
using Bilibili.App.Show.V1;
namespace Richasy.Bili.Lib.Interfaces
{
......@@ -15,8 +15,7 @@ namespace Richasy.Bili.Lib.Interfaces
/// 获取排行榜详情.
/// </summary>
/// <param name="partitionId">分区Id. 如果是全区则为0.</param>
/// <param name="rankScope">排行榜范围.</param>
/// <returns>排行榜信息.</returns>
Task<RankInfo> GetRankDetailAsync(int partitionId, RankScope rankScope);
Task<List<RankItem>> GetRankDetailAsync(int partitionId);
}
}
......@@ -129,6 +129,9 @@
<EmbeddedResource Include="Properties\Lib.Interfaces.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf">
<Version>3.17.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.12</Version>
</PackageReference>
......@@ -146,6 +149,10 @@
<Project>{88314412-B020-415B-AEAB-57ADC43B273E}</Project>
<Name>Models.Enums</Name>
</ProjectReference>
<ProjectReference Include="..\..\Models\Models.gRPC\Models.gRPC.csproj">
<Project>{0187840F-8D1A-4198-B5BF-8B05CADB4554}</Project>
<Name>Models.gRPC</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
......
......@@ -110,7 +110,6 @@ namespace Richasy.Bili.Lib.Uwp
ServerResponse errorResponse = null;
try
{
var errorResponseStr = await response.Content.ReadAsStringAsync();
if (response.Content.Headers.ContentType?.MediaType.Contains("image") ?? false)
{
if (response.IsSuccessStatusCode)
......@@ -118,7 +117,19 @@ namespace Richasy.Bili.Lib.Uwp
return;
}
}
else if (response.Content.Headers.ContentType?.MediaType == ServiceConstants.Headers.GRPCContentType)
{
var bytes = await response.Content.ReadAsByteArrayAsync();
if (bytes.Length <= 5)
{
errorResponse = new ServerResponse { Message = ServiceConstants.Messages.NoData };
throw new ServiceException(errorResponse, response.Headers, response.StatusCode);
}
return;
}
var errorResponseStr = await response.Content.ReadAsStringAsync();
errorResponse = JsonConvert.DeserializeObject<ServerResponse>(errorResponseStr);
if (errorResponse?.Code == 0 || string.IsNullOrEmpty(errorResponseStr))
{
......
......@@ -2,14 +2,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
using Google.Protobuf;
using Newtonsoft.Json;
using Richasy.Bili.Lib.Interfaces;
using Richasy.Bili.Models.App.Constants;
using Richasy.Bili.Models.App.Other;
using Richasy.Bili.Models.Enums;
using Richasy.Bili.Models.gRPC;
using static Richasy.Bili.Models.App.Constants.ServiceConstants;
namespace Richasy.Bili.Lib.Uwp
{
......@@ -79,6 +84,50 @@ namespace Richasy.Bili.Lib.Uwp
return requestMessage;
}
/// <inheritdoc/>
public async Task<HttpRequestMessage> GetRequestMessageAsync(string url, IMessage grpcMessage)
{
var requestMessage = new HttpRequestMessage(HttpMethod.Post, url);
var token = await _authenticationProvider.GetTokenAsync();
var grpcConfig = new GRPCConfig(token);
var userAgent = $"bili-universal/62800300 "
+ $"os/ios model/{GRPCConfig.Model} mobi_app/iphone "
+ $"osVer/{GRPCConfig.OSVersion} "
+ $"network/{GRPCConfig.NetworkType} "
+ $"grpc-objc/1.32.0 grpc-c/12.0.0 (ios; cronet_http)";
requestMessage.Headers.Authorization = new AuthenticationHeaderValue(Headers.Identify, token);
requestMessage.Headers.Add(Headers.UserAgent, userAgent);
requestMessage.Headers.Add(Headers.AppKey, GRPCConfig.MobileApp);
requestMessage.Headers.Add(Headers.BiliDevice, grpcConfig.GetDeviceBin());
requestMessage.Headers.Add(Headers.BiliFawkes, grpcConfig.GetFawkesreqBin());
requestMessage.Headers.Add(Headers.BiliLocale, grpcConfig.GetLocaleBin());
requestMessage.Headers.Add(Headers.BiliMeta, grpcConfig.GetMetadataBin());
requestMessage.Headers.Add(Headers.BiliNetwork, grpcConfig.GetNetworkBin());
requestMessage.Headers.Add(Headers.BiliRestriction, grpcConfig.GetRestrictionBin());
requestMessage.Headers.Add(Headers.GRPCAcceptEncodingKey, Headers.GRPCAcceptEncodingValue);
requestMessage.Headers.Add(Headers.GRPCTimeOutKey, Headers.GRPCTimeOutValue);
requestMessage.Headers.Add(Headers.Envoriment, GRPCConfig.Envorienment);
requestMessage.Headers.Add(Headers.TransferEncodingKey, Headers.TransferEncodingValue);
requestMessage.Headers.Add(Headers.TEKey, Headers.TEValue);
var messageBytes = grpcMessage.ToByteArray();
// 校验用?第五位为数组长度
var stateBytes = new byte[] { 0, 0, 0, 0, (byte)messageBytes.Length };
// 合并两个字节数组
var bodyBytes = new byte[5 + messageBytes.Length];
stateBytes.CopyTo(bodyBytes, 0);
messageBytes.CopyTo(bodyBytes, 5);
var byteArrayContent = new ByteArrayContent(bodyBytes);
byteArrayContent.Headers.ContentType = new MediaTypeHeaderValue(Headers.GRPCContentType);
byteArrayContent.Headers.ContentLength = bodyBytes.Length;
requestMessage.Content = byteArrayContent;
return requestMessage;
}
/// <inheritdoc/>
public Task<HttpResponseMessage> SendAsync(HttpRequestMessage request)
{
......@@ -107,5 +156,13 @@ namespace Richasy.Bili.Lib.Uwp
var responseString = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<T>(responseString);
}
/// <inheritdoc/>
public async Task<T> ParseAsync<T>(HttpResponseMessage response, MessageParser<T> parser)
where T : IMessage<T>
{
var bytes = await response.Content.ReadAsByteArrayAsync();
return parser.ParseFrom(bytes.Skip(5).ToArray());
}
}
}
......@@ -29,6 +29,9 @@
<Content Include="Properties\Lib.Uwp.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf">
<Version>3.17.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.12</Version>
</PackageReference>
......@@ -52,6 +55,10 @@
<Project>{88314412-B020-415B-AEAB-57ADC43B273E}</Project>
<Name>Models.Enums</Name>
</ProjectReference>
<ProjectReference Include="..\..\Models\Models.gRPC\Models.gRPC.csproj">
<Project>{0187840F-8D1A-4198-B5BF-8B05CADB4554}</Project>
<Name>Models.gRPC</Name>
</ProjectReference>
<ProjectReference Include="..\..\Utilities\Locator\Locator.Uwp\Locator.Uwp.csproj">
<Project>{793EC923-D704-4C6F-9506-EB6A32BFBB8D}</Project>
<Name>Locator.Uwp</Name>
......
// Copyright (c) Richasy. All rights reserved.
using System.Collections.Generic;
using System.Net.Http;
using System.Linq;
using System.Threading.Tasks;
using Bilibili.App.Show.V1;
using Richasy.Bili.Lib.Interfaces;
using Richasy.Bili.Models.BiliBili;
using Richasy.Bili.Models.Enums;
using static Richasy.Bili.Models.App.Constants.ServiceConstants;
namespace Richasy.Bili.Lib.Uwp
......@@ -25,18 +24,13 @@ namespace Richasy.Bili.Lib.Uwp
}
/// <inheritdoc/>
public async Task<RankInfo> GetRankDetailAsync(int partitionId, RankScope rankScope)
public async Task<List<RankItem>> GetRankDetailAsync(int partitionId)
{
var queryParameters = new Dictionary<string, string>
{
{ Query.PartitionId, partitionId.ToString() },
{ Query.Type, rankScope.ToString().ToLower() },
};
var request = await _httpProvider.GetRequestMessageAsync(HttpMethod.Get, Api.Rank.Ranking, queryParameters, RequestClientType.Web);
var rankRequst = new RankRegionResultReq() { Rid = partitionId };
var request = await _httpProvider.GetRequestMessageAsync(Api.Rank.RankingGRPC, rankRequst);
var response = await _httpProvider.SendAsync(request);
var data = await _httpProvider.ParseAsync<ServerResponse<RankInfo>>(response);
return data.Data;
var data = await _httpProvider.ParseAsync(response, RankListReply.Parser);
return data.Items.ToList();
}
}
}
......@@ -60,6 +60,7 @@ namespace Richasy.Bili.Models.App.Constants
public static class Messages
{
public const string NotFound = "没有找到你所需要的资源";
public const string NoData = "请求失败,没有数据返回";
public const string UnexpectedExceptionOnSend = "在发送请求时出现了异常";
public const string RequestTimedOut = "请求超时";
public const string OverallTimeoutCannotBeSet = "全局超时未能在第一次请求后设置";
......@@ -69,8 +70,28 @@ namespace Richasy.Bili.Models.App.Constants
public static class Headers
{
public const string Bearer = "Bearer";
public const string Identify = "identify_v1";
public const string FormUrlEncodedContentType = "application/x-www-form-urlencoded";
public const string JsonContentType = "application/json";
public const string GRPCContentType = "application/grpc";
public const string UserAgent = "User-Agent";
public const string AppKey = "APP-KEY";
public const string BiliMeta = "x-bili-metadata-bin";
public const string Authorization = "authorization";
public const string BiliDevice = "x-bili-device-bin";
public const string BiliNetwork = "x-bili-network-bin";
public const string BiliRestriction = "x-bili-restriction-bin";
public const string BiliLocale = "x-bili-locale-bin";
public const string BiliFawkes = "x-bili-fawkes-req-bin";
public const string GRPCAcceptEncodingKey = "grpc-accept-encoding";
public const string GRPCAcceptEncodingValue = "identity,deflate,gzip";
public const string GRPCTimeOutKey = "grpc-timeout";
public const string GRPCTimeOutValue = "20100m";
public const string Envoriment = "env";
public const string TransferEncodingKey = "Transfer-Encoding";
public const string TransferEncodingValue = "chunked";
public const string TEKey = "TE";
public const string TEValue = "trailers";
}
public static class Settings
......@@ -91,6 +112,7 @@ namespace Richasy.Bili.Models.App.Constants
public const string _liveBase = "https://api.live.bilibili.com";
public const string _passBase = "https://passport.bilibili.com";
public const string _bangumiBase = "https://bangumi.bilibili.com";
public const string _grpcBase = "https://grpc.biliapi.net";
public static class Passport
{
......@@ -174,9 +196,14 @@ namespace Richasy.Bili.Models.App.Constants
public static class Rank
{
/// <summary>
/// 排行榜.
/// 排行榜 - Web.
/// </summary>
public const string Ranking = _apiBase + "/x/web-interface/ranking/v2";
/// <summary>
/// 排行榜 - gRPC.
/// </summary>
public const string RankingGRPC = _grpcBase + "/bilibili.app.show.v1.Rank/RankRegion";
}
}
#pragma warning restore SA1401 // Fields should be private
......
// Copyright (c) Richasy. All rights reserved.
using Richasy.Bili.Models.BiliBili;
using Richasy.Bili.Models.Enums;
namespace Richasy.Bili.Models.App.Other
{
......@@ -14,14 +13,12 @@ namespace Richasy.Bili.Models.App.Other
/// Initializes a new instance of the <see cref="RankPartition"/> class.
/// </summary>
/// <param name="partitionName">分区名称.</param>
/// <param name="scope">排行榜范围.</param>
/// <param name="logo">图标.</param>
/// <param name="partitionId">分区Id.</param>
public RankPartition(string partitionName, RankScope scope, string logo, int partitionId = 0)
public RankPartition(string partitionName, string logo, int partitionId = 0)
{
this.PartitionName = partitionName;
this.PartitionId = partitionId;
this.Scope = scope;
this.Logo = logo;
}
......@@ -33,7 +30,6 @@ namespace Richasy.Bili.Models.App.Other
{
this.PartitionId = partition.Tid;
this.PartitionName = partition.Name;
this.Scope = RankScope.All;
this.Logo = partition.Logo;
}
......@@ -47,25 +43,19 @@ namespace Richasy.Bili.Models.App.Other
/// </summary>
public string PartitionName { get; set; }
/// <summary>
/// 排行榜范围.
/// </summary>
public RankScope Scope { get; set; }
/// <summary>
/// 图标.
/// </summary>
public string Logo { get; set; }
/// <inheritdoc/>
public override bool Equals(object obj) => obj is RankPartition partition && PartitionId == partition.PartitionId && Scope == partition.Scope;
public override bool Equals(object obj) => obj is RankPartition partition && PartitionId == partition.PartitionId;
/// <inheritdoc/>
public override int GetHashCode()
{
var hashCode = 1323653111;
hashCode = (hashCode * -1521134295) + PartitionId.GetHashCode();
hashCode = (hashCode * -1521134295) + Scope.GetHashCode();
return hashCode;
}
}
......
// Copyright (c) Richasy. All rights reserved.
using Newtonsoft.Json;
namespace Richasy.Bili.Models.BiliBili
{
/// <summary>
/// 排行榜视频信息.
/// </summary>
public class RankVideo : VideoBase
{
/// <summary>
/// 视频的Aid.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "aid", Required = Required.Default)]
public int Aid { get; set; }
/// <summary>
/// 分区Id.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "tid", Required = Required.Default)]
public int PartitionId { get; set; }
/// <summary>
/// 分区名.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "tname", Required = Required.Default)]
public string PartitionName { get; set; }
/// <summary>
/// 视频类型,1-原创,2-转载.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "copyright", Required = Required.Default)]
public int Copyright { get; set; }
/// <summary>
/// 视频封面.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "pic", Required = Required.Default)]
public string Cover { get; set; }
/// <summary>
/// 投稿时间.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "ctime", Required = Required.Default)]
public int ContributeTime { get; set; }
/// <summary>
/// 视频说明.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "desc", Required = Required.Default)]
public string Description { get; set; }
/// <summary>
/// 视频作者信息.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "owner", Required = Required.Default)]
public PublisherInfo PublisherInfo { get; set; }
/// <summary>
/// 视频播放信息.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "stat", Required = Required.Default)]
public VideoStatusInfo Status { get; set; }
/// <summary>
/// 视频第1P的Id.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "cid", Required = Required.Default)]
public int Cid { get; set; }
/// <summary>
/// 用于分享的短链接.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "short_link", Required = Required.Default)]
public string ShortLink { get; set; }
/// <summary>
/// 视频的Bvid.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "bvid", Required = Required.Default)]
public string Bvid { get; set; }
/// <summary>
/// 综合评分.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "score", Required = Required.Default)]
public int Score { get; set; }
}
}
......@@ -10,4 +10,8 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Others\" />
</ItemGroup>
</Project>
// Copyright (c) Richasy. All rights reserved.
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Richasy.Bili.Models.BiliBili
{
/// <summary>
/// 排行榜信息.
/// </summary>
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class RankInfo
{
/// <summary>
/// 排行榜说明.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "note", Required = Required.Default)]
public string Note { get; set; }
/// <summary>
/// 排行榜下的视频列表.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "list", Required = Required.Default)]
public List<RankVideo> VideoList { get; set; }
}
}
// Copyright (c) Richasy. All rights reserved.
namespace Richasy.Bili.Models.Enums
{
/// <summary>
/// 排行榜类型.
/// </summary>
public enum RankScope
{
/// <summary>
/// 全部.
/// </summary>
All,
/// <summary>
/// 原创.
/// </summary>
Origin,
/// <summary>
/// 新人.
/// </summary>
Rookie,
}
}
// Copyright (c) Richasy. All rights reserved.
#pragma warning disable SA1300 // Element should begin with upper-case letter
using System;
using Bilibili.Metadata;
using Bilibili.Metadata.Device;
using Bilibili.Metadata.Fawkes;
using Bilibili.Metadata.Locale;
using Bilibili.Metadata.Network;
using Bilibili.Metadata.Restriction;
using Google.Protobuf;
namespace Richasy.Bili.Models.gRPC
{
/// <summary>
/// gRPC的请求配置.
/// </summary>
public class GRPCConfig
{
/// <summary>
/// 系统版本.
/// </summary>
public const string OSVersion = "14.6";
/// <summary>
/// 厂商.
/// </summary>
public const string Brand = "Apple";
/// <summary>
/// 手机系统.
/// </summary>
public const string Model = "iPhone 11";
/// <summary>
/// 应用版本.
/// </summary>
public const string AppVersion = "6.7.0";
/// <summary>
/// 构建标识.
/// </summary>
public const int Build = 6070600;
/// <summary>
/// 频道.
/// </summary>
public const string Channel = "bilibili140";
/// <summary>
/// 网络状况.
/// </summary>
public const int NetworkType = 2;
/// <summary>
/// 未知.
/// </summary>
public const int NetworkTF = 0;
/// <summary>
/// 未知.
/// </summary>
public const string NetworkOid = "46007";
/// <summary>
/// 未知.
/// </summary>
public const string Cronet = "1.21.0";
/// <summary>
/// 未知.
/// </summary>
public const string Buvid = "XZFD48CFF1E68E637D0DF11A562468A8DC314";
/// <summary>
/// 应用类型.
/// </summary>
public const string MobileApp = "iphone";
/// <summary>
/// 移动平台.
/// </summary>
public const string Platform = "iphone";
/// <summary>
/// 产品环境.
/// </summary>
public const string Envorienment = "prod";
/// <summary>
/// 应用Id.
/// </summary>
public const int AppId = 1;
/// <summary>
/// 国家或地区.
/// </summary>
public const string Region = "CN";
/// <summary>
/// 语言.
/// </summary>
public const string Language = "zh";
/// <summary>
/// Initializes a new instance of the <see cref="GRPCConfig"/> class.
/// </summary>
/// <param name="accessToken">访问令牌.</param>
public GRPCConfig(string accessToken)
{
this.AccessToken = accessToken;
}
/// <summary>
/// 访问令牌.
/// </summary>
public string AccessToken { get; set; }
/// <summary>
/// 获取客户端在Fawkes系统中的信息标头.
/// </summary>
/// <returns>Base64字符串.</returns>
public string GetFawkesreqBin()
{
var msg = new FawkesReq();
msg.Appkey = MobileApp;
msg.Env = Envorienment;
return ToBase64(msg.ToByteArray());
}
/// <summary>
/// 获取元数据标头.
/// </summary>
/// <returns>Base64字符串.</returns>
public string GetMetadataBin()
{
var msg = new Metadata();
msg.AccessKey = AccessToken;
msg.MobiApp = MobileApp;
msg.Build = Build;
msg.Channel = Channel;
msg.Buvid = Buvid;
msg.Platform = Platform;
return ToBase64(msg.ToByteArray());
}
/// <summary>
/// 获取设备标头.
/// </summary>
/// <returns>Base64字符串.</returns>
public string GetDeviceBin()
{
var msg = new Device();
msg.AppId = AppId;
msg.MobiApp = MobileApp;
msg.Build = Build;
msg.Channel = Channel;
msg.Buvid = Buvid;
msg.Platform = Platform;
msg.Brand = Brand;
msg.Model = Model;
msg.Osver = OSVersion;
return ToBase64(msg.ToByteArray());
}
/// <summary>
/// 获取网络标头.
/// </summary>
/// <returns>Base64字符串.</returns>
public string GetNetworkBin()
{
var msg = new Network();
msg.Type = Bilibili.Metadata.Network.NetworkType.Wifi;
msg.Oid = NetworkOid;
return ToBase64(msg.ToByteArray());
}
/// <summary>
/// 获取限制标头.
/// </summary>
/// <returns>Base64字符串.</returns>
public string GetRestrictionBin()
{
var msg = new Restriction();
return ToBase64(msg.ToByteArray());
}
/// <summary>
/// 获取本地化标头.
/// </summary>
/// <returns>Base64字符串.</returns>
public string GetLocaleBin()
{
var msg = new Locale();
msg.CLocale = new LocaleIds();
msg.SLocale = new LocaleIds();
msg.CLocale.Language = Language;
msg.CLocale.Region = Region;
msg.SLocale.Language = Language;
msg.SLocale.Region = Region;
return ToBase64(msg.ToByteArray());
}
/// <summary>
/// 将数据转换为Base64字符串.
/// </summary>
/// <param name="data">数据.</param>
/// <returns>Base64字符串.</returns>
public string ToBase64(byte[] data)
{
return Convert.ToBase64String(data).TrimEnd('=');
}
}
}
#pragma warning restore SA1300 // Element should begin with upper-case letter
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Richasy.Bili.Models.gRPC</RootNamespace>
<AssemblyName>Richasy.Bili.Models.gRPC</AssemblyName>
</PropertyGroup>
<ItemGroup>
<None Remove="bilibili\account\fission\v1\fission.proto" />
<None Remove="bilibili\ad\v1\ad.proto" />
<None Remove="bilibili\api\probe\v1\probe.proto" />
<None Remove="bilibili\app\archive\middleware\v1\preload.proto" />
<None Remove="bilibili\app\archive\v1\archive.proto" />
<None Remove="bilibili\app\card\v1\ad.proto" />
<None Remove="bilibili\app\card\v1\card.proto" />
<None Remove="bilibili\app\card\v1\common.proto" />
<None Remove="bilibili\app\card\v1\double.proto" />
<None Remove="bilibili\app\card\v1\single.proto" />
<None Remove="bilibili\app\dynamic\v1\dynamic.proto" />
<None Remove="bilibili\app\dynamic\v2\dynamic.proto" />
<None Remove="bilibili\app\interfaces\v1.proto" />
<None Remove="bilibili\app\playurl\v1\playurl.proto" />
<None Remove="bilibili\app\show\gateway\v1\gateway.proto" />
<None Remove="bilibili\app\show\popular\v1\popular.proto" />
<None Remove="bilibili\app\show\rank\v1\rank.proto" />
<None Remove="bilibili\app\show\region\v1\region.proto" />
<None Remove="bilibili\app\space\v1\space.proto" />
<None Remove="bilibili\app\splash\v1\splash.proto" />
<None Remove="bilibili\app\view\v1\view.proto" />
<None Remove="bilibili\app\wall\v1\wall.proto" />
<None Remove="bilibili\broadcast\message\main.proto" />
<None Remove="bilibili\cheese\gateway\player\v1.proto" />
<None Remove="bilibili\community\service\dm\v1.proto" />
<None Remove="bilibili\im\interfaces\v1.proto" />
<None Remove="bilibili\im\type.proto" />
<None Remove="bilibili\main\community\reply\v1\reply.proto" />
<None Remove="bilibili\metadata\device\device.proto" />
<None Remove="bilibili\metadata\fawkes\fawkes.proto" />
<None Remove="bilibili\metadata\locale\locale.proto" />
<None Remove="bilibili\metadata\metadata.proto" />
<None Remove="bilibili\metadata\network\network.proto" />
<None Remove="bilibili\metadata\restriction\restriction.proto" />
<None Remove="bilibili\pgc\gateway\player\v2.proto" />
<None Remove="bilibili\rpc\status.proto" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.17.3" />
<PackageReference Include="Grpc.Core" Version="2.38.0" />
<PackageReference Include="Grpc.Tools" Version="2.38.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Protobuf Include="bilibili\broadcast\message\main.proto" GrpcServices="Client" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="bilibili\app\playurl\v1\playurl.proto" GrpcServices="Client" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="bilibili\account\fission\v1\fission.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\ad\v1\ad.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\api\probe\v1\probe.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\archive\middleware\v1\preload.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\archive\v1\archive.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\card\v1\ad.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\card\v1\card.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\card\v1\common.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\card\v1\double.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\card\v1\single.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\dynamic\v1\dynamic.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\dynamic\v2\dynamic.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\interfaces\v1.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\show\gateway\v1\gateway.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\show\popular\v1\popular.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\show\rank\v1\rank.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\show\region\v1\region.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\space\v1\space.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\splash\v1\splash.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\view\v1\view.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\app\wall\v1\wall.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\cheese\gateway\player\v1.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\community\service\dm\v1.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\im\interfaces\v1.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\im\type.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\main\community\reply\v1\reply.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\metadata\device\device.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\metadata\fawkes\fawkes.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\metadata\locale\locale.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\metadata\metadata.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\metadata\network\network.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\metadata\restriction\restriction.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\pgc\gateway\player\v2.proto" GrpcServices="Client" />
<Protobuf Include="bilibili\rpc\status.proto" GrpcServices="Client" />
</ItemGroup>
</Project>
syntax = "proto3";
package bilibili.account.fission.v1;
//Fission裂变
service Fission {
// 活动入口
rpc Entrance (EntranceReq) returns (EntranceReply);
// 首页弹窗
rpc Window (WindowReq) returns (WindowReply);
}
// 活动入口-请求
message EntranceReq {}
// 活动入口-响应
message EntranceReply {
// 展示图标
string icon = 1;
// 活动名称
string name = 2;
// 活动跳转链接
string url = 3;
// 动画效果
AnimateIcon animateIcon = 4;
}
// 首页弹窗-请求
message WindowReq {}
//首页弹窗-响应
message WindowReply {
// 弹窗类型
// 0:弹窗 1:普通页面
int32 type = 1;
// 跳转链接
string url = 2;
// 上报数据字段
string reportData = 3;
}
//动画效果
message AnimateIcon {
// icon文件
string icon = 1;
// 动效json文件
string json = 2;
}
\ No newline at end of file
syntax = "proto3";
package bilibili.ad.v1;
import "google/protobuf/wrappers.proto";
// 广告控制
message AdsControlDto {
// 视频是否有弹幕,如有,需请求弹幕广告
int32 hasDanmu = 1;
// 有弹幕的分P视频的cid
repeated int64 cids = 2;
// 有弹幕的ogv ep
repeated AdOgvEpDto eps = 3;
}
// 有弹幕的ogv ep
message AdOgvEpDto {
// 分集epid
int64 epid = 1;
// 是否显示 "荐"
bool hasRecommend = 2;
}
// 广告数据
message SourceContentDto {
// 广告请求id
string requestId = 1;
// 广告资源位source ID
int32 sourceId = 2;
// 广告资源位resource ID
int32 resourceId = 3;
// 广告位上报标记,对广告返回数据恒为true
bool isAdLoc = 4;
// 与天马现有逻辑一致, 0有含义
// 0:内容 1:广告
google.protobuf.Int32Value serverType = 5;
// 客户端IP回传拼接
string clientIp = 6;
// 广告卡片位置在一刷中的位置, 天马用, 0有含义
google.protobuf.Int32Value cardIndex = 7;
// 广告资源位source 位次
int32 index = 8;
// 广告内容
AdDto adContent = 9;
}
// 广告内容
message AdDto {
// 广告创意ID
int64 creativeId = 1;
// 广告闭环上报回传数据
string adCb = 2;
// 额外广告数据
AdContentExtraDto extra = 3;
// 广告标记
int32 cmMark = 4;
//
int64 topViewId = 5;
//
int32 creativeType = 6;
//
int32 cardType = 7;
//
int32 creativeStyle = 8;
//
int32 isAd = 9;
//
CreativeDto creativeContent = 10;
}
// 额外广告数据
message AdContentExtraDto {
// 动态布局
string layout = 1;
// 展现监控url
repeated string showUrls = 2;
// 点击监控url
repeated string clickUrls = 3;
// 弹幕创意列表展示第三方上报
repeated string danmuListShowUrls = 4;
// 弹幕创意列表点击第三方上报
repeated string danmuListClickUrls = 5;
// 弹幕详情页展示第三方上报
repeated string danmuDetailShowUrls = 6;
// 弹幕商品添加购物车第三方上报
repeated string danmuTrolleyAddUrls = 7;
// useWebView默认false
bool useAdWebV2 = 8;
// app唤起白名单
repeated string openWhitelist = 9;
// app下载白名单
AppPackageDto downloadWhitelist = 10;
// 卡片相关信息
AdCardDto card = 11;
// 视频播放和弹幕播放上报控制时间 ms
int32 reportTime = 12;
// 是否优先唤起app store
int32 appstorePriority = 13;
// 广告售卖类型
int32 salesType = 14;
// 落地页是否预加载
int32 preloadLandingpage = 15;
// 是否需要展示风险行业提示
bool specialIndustry = 16;
// 风险行业提示
string specialIndustryTips = 17;
// 是否展示下载弹框
bool enableDownloadDialog = 18;
// 是否允许分享
bool enableShare = 19;
// 个人空间广告入口类型
// 1:橱窗 2:商品店铺 3:小程序
int32 upzoneEntranceType = 20;
// 个人空间广告入口上报id,橱窗id(当前用Mid)、店铺id或者小程序id
int32 upzoneEntranceReportId = 21;
// 分享数据
AdShareInfoDto shareInfo = 22;
// topview图片链接,闪屏预下载用
string topviewPicUrl = 23;
// topview视频链接,闪屏预下载用
string topviewVideoUrl = 24;
// 点击区域
// 0:表示banner可点击 1:表示素材可点击
int32 clickArea = 25;
// 店铺
int64 shopId = 26;
// up主
int64 upMid = 27;
// 回传id
string trackId = 28;
// 商店直投
int32 enableStoreDirectLaunch = 29;
// DPA2.0商品ID
int64 product_id = 30;
}
//
message CreativeDto {
//
string title = 1;
//
string description = 2;
//
string imageUrl = 3;
//
string imageMd5 = 4;
//
string url = 5;
//
string clickUrl = 6;
//
string showUrl = 7;
//
int64 videoId = 8;
//
string thumbnailUrl = 9;
//
string thumbnailUrlMd5 = 10;
//
string logoUrl = 11;
//
string logoMd5 = 12;
//
string username = 13;
}
// app下载白名单
message AppPackageDto {
// 包大小(单位bytes)
int64 size = 1;
//
string displayName = 2;
//
string apkName = 3;
// url
string url = 4;
// bili schema url
string biliUrl = 5;
// 包md5
string md5 = 6;
// 包icon
string icon = 7;
// 开发者姓名
string devName = 8;
// 权限地址
string authUrl = 9;
// 权限名,逗号隔开
string authName = 10;
// 版本
string version = 11;
// 更新时间,yy-mm-hh格式
string updateTime = 12;
// 隐私协议标题
string privacy_name = 13;
// 隐私协议url
string privacy_url = 14;
}
// 卡片
message AdCardDto {
// 卡片类型
int32 cardType = 1;
// 标题
string title = 2;
// 描述
string desc = 3;
// 额外描述
string extraDesc = 4;
// 长描述
string longDesc = 5;
// 短标题, 弹幕广告目录面板标题
string shortTitle = 6;
// 弹幕/浮层广告的弹幕标题
string danmuTitle = 7;
// 弹幕/浮层广告的弹幕高度,整型,分母为100
int32 danmuHeight = 8;
// 弹幕/浮层广告的弹幕宽度,整型,分母为100
int32 danmuWidth = 9;
// 弹幕/浮层广告生存时间,单位为毫秒
int32 danmuLife = 10;
// 弹幕/浮层开始时间,单位为毫秒
int32 danmuBegin = 11;
// 背景色值(含透明度)如#80FFFFFF
string danmuColor = 12;
// 弹幕/浮层广告H5落地页
string danmuH5Url = 13;
// 弹幕/浮层 广告icon
string danmuIcon = 14;
// 折叠时间,永驻浮层折叠时间,单位为毫秒
int32 foldTime = 15;
// 广告标文案
string adTag = 16;
// cover数组
repeated AdCoverDto covers = 17;
// 卡片跳转链接
string jumpUrl = 18;
//
string imaxLandingPageJsonString = 19;
// app唤起schema
string callupUrl = 20;
// univeral link域名
string universalApp = 21;
// 原价, 单位为分
string oriPrice = 22;
// 现价, 同上
int32 curPrice = 23;
// 券后/现价 价格描述
string priceDesc = 24;
// 价格单位符号
string priceSymbol = 25;
// 券后价格 "1000"
string goodsCurPrice = 26;
// 原价 "¥1002"
string goodsOriPrice = 27;
// 开放平台商品
AdGoodDto good = 28;
// 打分? 满分为100
int32 rank = 29;
// 热度
int32 hotScore = 30;
// 按钮
AdButtonDto button = 31;
// 广告主logo
string adverLogo = 32;
// 广告主name
string adverName = 33;
// 广告主主页链接
string adverPageUrl = 34;
// 视频弹幕,视频广告用
repeated string videoBarrage = 35;
// 商业标信息
AdBusinessMarkDto adTagStyle = 36;
// 自动播放视频
AdAutoPlayVideoDto video = 37;
// 反馈面板功能模块,屏蔽、投诉、广告介绍
AdFeedbackPanelDto feedbackPanel = 38;
//
int64 adverMid = 39;
//
int64 adverAccountId = 40;
//
string duration = 41;
//
repeated QualityInfo qualityInfos = 42;
// 动态广告文本
string dynamicText = 43;
// 广告主信息
AdverDto adver = 44;
// 评分
int32 grade_level = 45;
}
// 分享
message AdShareInfoDto {
// 分享标题
string title = 1;
// 分享副标题
string subtitle = 2;
// 分享图片url
string imageUrl = 3;
}
// 广告卡片封面数据
message AdCoverDto {
// 图片链接
string url = 1;
// 动图循环次数
// 0:无限循环
int32 loop = 2;
// 图片点击跳转地址,截至目前为空
string jumpUrl = 3;
// 跳转监测链接, 数组,单个图片的监控,出区别于click_urls,应前端要求。(此字段截至目前为空,使用时需再次确认)
repeated string reportUrls = 4;
// 图片高度
int32 imageHeight = 5;
// 图片宽度
int32 imageWidth = 6;
}
// 按钮
message AdButtonDto {
// 类型
// 1:落地页 2:应用唤起 3:应用下载
int32 type = 1;
// 按钮文案
string text = 2;
// 按钮跳转地址
string jumpUrl = 3;
// 跳转监测链接
string reportUrls = 4;
// 唤起schema
string dlsucCallupUrl = 5;
//游戏id
int32 game_id = 6;
//游戏监控字段
string game_monitor_param = 7;
}
// 商业标信息
message AdBusinessMarkDto {
// 商业标样式
// 0:不展示标 1:实心+文字 2:空心框+文字 3:纯文字标 4:纯图片标
int32 type = 1;
// 商业标文案
string text = 2;
// 商业标文案颜色,如#80FFFFFF RGBA
string textColor = 3;
// 夜间模式文字色
string textColorNight = 4;
// 背景色
string bgColor = 5;
// 夜间模式背景色
string bgColorNight = 6;
// 边框色
string borderColor = 7;
// 夜间模式边框色
string borderColorNight = 8;
// 图片商业标
string imgUrl = 9;
// 图片高度
int32 imgHeight = 10;
// 图片宽度
int32 imgWidth = 11;
//
string bgBorderColor = 12;
}
// 自动播放视频
message AdAutoPlayVideoDto {
// avid
int64 avid = 1;
// cid
int64 cid = 2;
// 分P
int64 page = 3;
//
string from = 4;
// 是否自动播放
string url = 5;
// 是否自动播放
string cover = 6;
// 是否自动播放
bool autoPlay = 7;
// 按钮是否动态变色
bool btnDycColor = 8;
// 按钮动态变色时间 ms
int32 btnDycTime = 9;
// 用于做联播是否是同一个视频的id
int64 bizId = 10;
// 开始播放三方监控
repeated string process0Urls = 11;
// 播放3S三方监控
repeated string play3SUrls = 12;
// 播放5S三方监控
repeated string play5SUrls = 13;
// 横竖屏
int32 orientation = 14;
}
// 反馈面板功能模块
message AdFeedbackPanelDto {
// 面板类型,广告、推广
string panelTypeText = 1;
// 反馈面版信息
repeated AdFeedbackPanelModuleDto feedbackPanelDetail = 2;
}
// 反馈面版信息
message AdFeedbackPanelModuleDto {
// 模块id
int32 moduleId = 1;
// icon url
string iconUrl = 2;
// 跳转类型
// 1:气泡 2:H5
int32 jumpType = 3;
// 跳转地址
string jumpUrl = 4;
// 文案
string text = 5;
// 二级文案数组
repeated AdSecondFeedbackPanelDto secondaryPanel = 6;
}
// 二级文案
message AdSecondFeedbackPanelDto {
// 屏蔽理由id
int32 reasonId = 1;
// 理由文案
string text = 2;
}
// 开放平台商品
message AdGoodDto {
// 电商商品ID
int64 itemId = 1;
// 电商SKU ID
int64 skuId = 2;
// 店铺ID
int64 shopId = 3;
// SKU库存
int64 skuNum = 4;
}
//
message QualityInfo {
//
string icon = 1;
//
string text = 2;
}
// 广告主信息
message AdverDto {
//
int64 adverId = 1;
//
string adverLogo = 2;
//
string adverName = 3;
//
int32 adverType = 4;
//
string adverPageUrl = 5;
//
string adverDesc = 6;
}
syntax = "proto3";
package bilibili.api.probe.v1;
//
service Probe {
//
rpc TestCode (CodeReq) returns (CodeReply);
//
rpc TestReq (ProbeReq) returns (ProbeReply);
//
rpc TestStream (ProbeStreamReq) returns (ProbeStreamReply);
//
rpc TestSub (ProbeSubReq) returns (ProbeSubReply);
}
//
message CodeReq {
//
int64 code = 1;
}
//
message CodeReply {}
//
message ProbeReq {
//
int64 mid = 1;
//
string buvid = 2;
}
//
message ProbeReply {
//
string content = 1;
//
int64 timestamp = 2;
}
//
message ProbeStreamReq {
//
int64 mid = 1;
//
int64 sequence = 2;
}
//
message ProbeStreamReply {
//
int64 sequence = 1;
//
int64 timestamp = 2;
//
string content = 3;
}
//
message ProbeSubReq {
//
int64 buvid = 1;
}
//
message ProbeSubReply {
//
int64 messageId = 1;
}
\ No newline at end of file
syntax = "proto3";
package bilibili.app.archive.middleware.v1;
// 视频秒开参数
message PlayerArgs {
// 清晰度
int64 qn = 1;
// 流版本
int64 fnver = 2;
// 流类型
int64 fnval = 3;
// 返回url是否强制使用域名
// 0:不强制使用域名 1:http域名 2:https域名
int64 force_host = 4;
}
\ No newline at end of file
syntax = "proto3";
package bilibili.app.archive.v1;
// 稿件基本信息
message Arc{
// 稿件avid
int64 aid = 1;
// 稿件分P数
int64 videos = 2;
// 分区id
int32 typeId = 3;
// 二级分区名
string typeName = 4;
// 稿件类型
// 1:原创 2:转载
int32 copyright = 5;
// 稿件封面url
string pic = 6;
// 稿件标题
string title = 7;
// 稿件发布时间
int64 pubdate = 8;
// 用户投稿时间
int64 ctime = 9;
// 稿件简介
string desc = 10;
// 稿件状态
int32 state = 11;
// 访问属性
// 0:全部可见 10000:登录可见
int32 access = 12;
// 属性位配置(现在无了)
int32 attribute = 13;
//
string tag = 14;
//
repeated string tags = 15;
// 稿件总时长(单位为秒)
int64 duration = 16;
// 参与的活动id
int64 missionId = 17;
// 绑定的商单id
int64 orderId = 18;
// PGC稿件强制重定向url(如番剧、影视)
string redirectUrl = 19;
//
int64 forward = 20;
// 控制标志
Rights rights = 21;
// UP主信息
Author author = 22;
// 状态数
Stat stat = 23;
//
string reportResult = 24;
// 投稿时发送的动态内容
string dynamic = 25;
// 稿件1P cid
int64 firstCid = 26;
// 稿件1P 分辨率
Dimension dimension = 27;
// 合作组成员列表
repeated StaffInfo staffInfo = 28;
// UGC合集id
int64 seasonId = 29;
// 新版属性位配置(也没用)
int64 attributeV2 = 30;
}
// UP主信息
message Author{
// UP主mid
int64 mid = 1;
// UP主昵称
string name = 2;
// UP主头像url
string face = 3;
}
// 分辨率
message Dimension{
// 宽度
int64 width = 1;
// 高度
int64 height = 2;
// 方向
// 0:横屏 1:竖屏
int64 rotate = 3;
}
// 分P信息
message Page{
// 视频cid
int64 cid = 1;
// 分P序号
int32 page = 2;
// 源类型
// vupload:B站 qq:腾讯 hunan:芒果
string from = 3;
// 分P标题
string part = 4;
// 分P时长(单位为秒)
int64 duration = 5;
// 外链vid
string vid = 6;
// 分P简介
string desc = 7;
// 外链url
string webLink = 8;
// 分P分辨率
Dimension dimension = 9;
}
// 稿件控制标志
message Rights{
// 老版是否付费
int32 bp = 1;
// 允许充电
int32 elec = 2;
// 允许下载
int32 download = 3;
// 是否电影
int32 movie = 4;
// PGC稿件需要付费
int32 pay = 5;
// 是否高码率
int32 hd5 = 6;
// 是否禁止转载标志
int32 noReprint = 7;
// 是否允许自动播放
int32 autoplay = 8;
// UGC稿件需要付费
int32 ugcPay = 9;
// 是否联合投稿
int32 isCooperation = 10;
// 是否UGC付费预览
int32 ugcPayPreview = 11;
// 是否禁止后台播放
int32 noBackground = 12;
}
// 合作成员信息
message StaffInfo{
// 成员mid
int64 mid = 1;
// 成员角色
string title = 2;
// 属性位
// 0:普通 1:赞助商金色标志
int64 attribute = 3;
}
// 状态数
message Stat{
// 稿件avid
int64 aid = 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;
// 点踩数(前端不可见故恒为0)
int32 dislike = 11;
}
\ No newline at end of file
syntax = "proto3";
package bilibili.app.card.v1;
//
message AdInfo {
//
int64 creative_id = 1;
//
int32 creative_type = 2;
//
int32 card_type = 3;
//
CreativeContent creative_content = 4;
//
string ad_cb = 5;
//
int64 resource = 6;
//
int32 source = 7;
//
string request_id = 8;
//
bool is_ad = 9;
//
int64 cm_mark = 10;
//
int32 index = 11;
//
bool is_ad_loc = 12;
//
int32 card_index = 13;
//
string client_ip = 14;
//
bytes extra = 15;
//
int32 creative_style = 16;
}
//
message CreativeContent {
//
string title = 1;
//
string description = 2;
//
int64 video_id = 3;
//
string username = 4;
//
string image_url = 5;
//
string image_md5 = 6;
//
string log_url = 7;
//
string log_md5 = 8;
//
string url = 9;
//
string click_url = 10;
//
string show_url = 11;
}
syntax = "proto3";
package bilibili.app.card.v1;
import "bilibili/app/card/v1/single.proto";
// 卡片信息
message Card {
oneof item {
// 小封面条目
SmallCoverV5 smallCoverV5 = 1;
//
LargeCoverV1 largeCoverV1 = 2;
//
ThreeItemAllV2 threeItemAllV2 = 3;
//
ThreeItemV1 threeItemV1 = 4;
//
HotTopic hotTopic = 5;
//
DynamicHot dynamicHot = 6;
//
MiddleCoverV3 middleCoverV3 = 7;
//
LargeCoverV4 largeCoverV4 = 8;
// 热门列表顶部按钮
PopularTopEntrance popularTopEntrance = 9;
//
RcmdOneItem rcmdOneItem = 10;
}
}
syntax = "proto3";
package bilibili.app.card.v1;
import "bilibili/app/card/v1/ad.proto";
// 条目基本信息
message Base {
// 卡片类型
string cardType = 1;
// 卡片跳转类型?
string cardGoto = 2;
// 跳转类型
// av:视频稿件 mid:用户空间
string goto = 3;
// 目标参数
string param = 4;
// 封面url
string cover = 5;
// 标题
string title = 6;
// 跳转uri
string uri = 7;
//
ThreePoint threePoint = 8;
//
Args args = 9;
//
PlayerArgs playerArgs = 10;
// 条目排位序号
int64 idx = 11;
//
AdInfo adInfo = 12;
//
Mask mask = 13;
//来源标识
// recommend:推荐 operation:管理?
string fromType = 14;
//
repeated ThreePointV2 threePointV2 = 15;
//
repeated ThreePointV3 threePointV3 = 16;
//
Button descButton = 17;
// 三点v4
ThreePointV4 threePointV4 = 18;
}
// 按钮信息
message Button {
// 文案
string text = 1;
// 参数
string param = 2;
//
string uri = 3;
// 事件
string event = 4;
//
int32 selected = 5;
// 类型
int32 type = 6;
// 事件v2
string eventV2 = 7;
// 关系信息
Relation relation = 8;
}
//
message ThreePoint {
//
repeated DislikeReason dislikeReasons = 1;
//
repeated DislikeReason feedbacks = 2;
//稍后再看
int32 watchLater = 3;
}
//
message DislikeReason {
//
int64 id = 1;
//
string name = 2;
}
//
message Args {
//
int32 type = 1;
//
int64 up_id = 2;
//
string up_name = 3;
//
int32 rid = 4;
//
string rname = 5;
//
int64 tid = 6;
//
string tname = 7;
//
string track_id = 8;
//
string state = 9;
//
int32 converge_type = 10;
//
int64 aid = 11;
}
//
message PlayerArgs {
//
int32 is_live = 1;
//
int64 aid = 2;
//
int64 cid = 3;
//
int32 sub_type = 4;
//
int64 room_id = 5;
//
int64 ep_id = 7;
//
int32 is_preview = 8;
//
string type = 9;
//
int64 duration = 10;
//
int64 season_id = 11;
}
//
message Mask {
//
Avatar avatar = 1;
//
Button button = 2;
}
//
message Avatar {
//
string cover = 1;
//
string text = 2;
//
string uri = 3;
//
int32 type = 4;
//
string event = 5;
//
string event_v2 = 6;
//
int32 defalut_cover = 7;
}
//
message ThreePointV2 {
//
string title = 1;
//
string subtitle = 2;
//
repeated DislikeReason reasons = 3;
//
string type = 4;
//
int64 id = 5;
}
//
message ThreePointV3 {
//
string title = 1;
//
string selected_title = 2;
//
string subtitle = 3;
//
repeated DislikeReason reasons = 4;
//
string type = 5;
//
int64 id = 6;
//
int32 selected = 7;
//
string icon = 8;
//
string selected_icon = 9;
//
string url = 10;
//
int32 default_id = 11;
}
// 三点v4
message ThreePointV4 {
// 分享面板信息
SharePlane share_plane = 1;
// 稍后再看
WatchLater watch_later = 2;
}
// 分享面板信息
message SharePlane {
// 标题
string title = 1;
// 副标贴文案
string shareSubtitle = 2;
// 备注
string desc = 3;
// 封面url
string cover = 4;
// 稿件avid
int64 aid = 5;
// 稿件bvid
string bvid = 6;
// 允许分享方式
map<string,bool> shareTo = 7;
// UP主昵称
string author = 8;
// UP主mid
int64 authorId = 9;
// 短连接
string shortLink = 10;
// 播放次数文案
string playNumber = 11;
}
// 稍后再看信息
message WatchLater {
// 稿件avid
int64 aid = 1;
// 稿件bvid
string bvid = 2;
}
// 标签框信息
message ReasonStyle {
// 文案
string text = 1;
// 文字颜色
string textColor = 2;
// 背景色
string bgColor = 3;
// 边框色
string borderColor = 4;
// 图标url
string iconUrl = 5;
// 文字颜色-夜间
string textColorNight = 6;
// 背景色-夜间
string bgColorNight = 7;
// 边框色-夜间
string borderColorNight = 8;
// 图标url-夜间
string iconNightUrl = 9;
// 背景风格id
// 1:无背景 2:有背景
int32 bgStyle = 10;
//
string uri = 11;
//
string iconBgUrl = 12;
//
string event = 13;
//
string eventV2 = 14;
//
int32 rightIconType = 15;
//
string leftIconType = 16;
}
//
message LikeButton {
//
int64 Aid = 1;
//
int32 count = 2;
//
bool show_count = 3;
//
string event = 4;
//
int32 selected = 5;
//
string event_v2 = 6;
}
//
message Up {
//
int64 id = 1;
//
string name = 2;
//
string desc = 3;
//
Avatar avatar = 4;
//
int32 official_icon = 5;
//
Button desc_button = 6;
//
string cooperation = 7;
}
// 关系信息
message Relation {
// 关系状态
int32 status = 1;
// 是否关注
int32 isFollow = 2;
// 是否粉丝
int32 isFollowed = 3;
}
syntax = "proto3";
package bilibili.app.card.v1;
import "bilibili/app/card/v1/common.proto";
//
message DoubleCards {
oneof Card {
//
SmallCoverV2 small_cover_v2 = 1;
//
OnePicV2 one_pic_v2 = 2;
//
ThreePicV2 three_pic_v2 = 3;
}
}
//
message SmallCoverV2 {
//
Base base = 1;
//
string cover_gif = 2;
//
int32 cover_blur = 3;
//
string cover_left_text_1 = 4;
//
int32 cover_left_icon_1 = 5;
//
string cover_left_text_2 = 6;
//
int32 cover_left_icon_2 = 7;
//
string cover_right_text = 8;
//
int32 cover_right_icon = 9;
//
string cover_right_background_color = 10;
//
string subtitle = 11;
//
string badge = 12;
//
string rcmd_reason = 13;
//
string desc = 14;
//
Avatar avatar = 15;
//
int32 official_icon = 16;
//
int32 can_play = 17;
//
ReasonStyle rcmd_reason_style = 18;
//
ReasonStyle rcmd_reason_style_v2 = 19;
//
LikeButton like_button = 20;
}
//
message SmallCoverV3 {
//
Base base = 1;
//
Avatar avatar = 2;
//
string cover_left_text = 3;
//
Button cover_right_button = 4;
//
string rcmd_reason = 5;
//
string desc = 6;
//
int32 official_icon = 7;
//
int32 can_play = 8;
//
ReasonStyle rcmd_reason_style = 9;
}
//
message MiddleCoverV2 {
//
Base base = 1;
//
int32 ratio = 2;
//
string desc = 3;
//
string badge = 4;
}
//
message LargeCoverV2 {
//
Base base = 1;
//
Avatar avatar = 2;
//
string badge = 3;
//
Button cover_right_button = 4;
//
string cover_left_text_1 = 5;
//
int32 cover_left_icon_1 = 6;
//
string cover_left_text_2 = 7;
//
int32 cover_left_icon_2 = 8;
//
string rcmd_reason = 9;
//
int32 official_icon = 10;
//
int32 can_play = 11;
//
ReasonStyle rcmd_reason_style = 12;
//
int32 show_top = 13;
//
int32 show_bottom = 14;
}
//
message ThreeItemV2 {
//
Base base = 1;
//
int32 title_icon = 2;
//
string more_uri = 3;
//
string more_text = 4;
//
repeated ThreeItemV2Item items = 5;
}
//
message ThreeItemV2Item {
//
Base base = 1;
//
int32 cover_left_icon = 2;
//
string desc_text_1 = 3;
//
int32 desc_icon_1 = 4;
//
string desc_text_2 = 5;
//
int32 desc_icon_2 = 6;
//
string badge = 7;
}
//
message SmallCoverV4 {
//
Base base = 1;
//
string cover_badge = 2;
//
string desc = 3;
//
string title_right_text = 4;
//
int32 title_right_pic = 5;
}
//
message TwoItemV2 {
//
Base base = 1;
//
repeated TwoItemV2Item items = 2;
}
message TwoItemV2Item {
//
Base base = 1;
//
string badge = 2;
//
string cover_left_text_1 = 3;
//
int32 cover_left_icon_1 = 4;
}
//
message MultiItem {
//
Base base = 1;
//
string more_uri = 2;
//
string more_text = 3;
//
repeated DoubleCards items = 4;
}
//
message ThreePicV2 {
//
Base base = 1;
//
string left_cover = 2;
//
string right_cover_1 = 3;
//
string right_cover_2 = 4;
//
string cover_left_text_1 = 5;
//
int32 cover_left_icon_1 = 6;
//
string cover_left_text_2 = 7;
//
int32 cover_left_icon_2 = 8;
//
string cover_right_text = 9;
//
int32 cover_right_icon = 10;
//
string cover_right_background_color = 11;
//
string badge = 12;
//
string rcmd_reason = 13;
//
string desc = 14;
//
Avatar avatar = 15;
//
ReasonStyle rcmd_reason_style = 16;
}
//
message OnePicV2 {
//
Base base = 1;
//
int32 cover_left_icon_1 = 2;
//
string cover_left_text_2 = 3;
//
string cover_right_text = 4;
//
int32 cover_right_icon = 5;
//
string cover_right_background_color = 6;
//
string badge = 7;
//
string rcmd_reason = 8;
//
Avatar avatar = 9;
//
ReasonStyle rcmd_reason_style = 10;
}
//
message LargeCoverV3 {
//
Base base = 1;
//
string cover_gif = 2;
//
Avatar avatar = 3;
//
ReasonStyle top_rcmd_reason_style = 4;
//
ReasonStyle bottom_rcmd_reason_style = 5;
//
string cover_left_text_1 = 6;
//
int32 cover_left_icon_1 = 7;
//
string cover_left_text_2 = 8;
//
int32 cover_left_icon_2 = 9;
//
string cover_right_text = 10;
//
string desc = 11;
//
int32 official_icon = 12;
}
//
message ThreePicV3 {
//
Base base = 1;
//
string left_cover = 2;
//
string right_cover_1 = 3;
//
string right_cover_2 = 4;
//
string cover_left_text_1 = 5;
//
int32 cover_left_icon_1 = 6;
//
string cover_left_text_2 = 7;
//
int32 cover_left_icon_2 = 8;
//
string cover_right_text = 9;
//
int32 cover_right_icon = 10;
//
string cover_right_background_color = 11;
//
string badge = 12;
//
ReasonStyle rcmd_reason_style = 13;
}
//
message OnePicV3 {
//
Base base = 1;
//
string cover_left_text_1 = 2;
//
int32 cover_left_icon_1 = 3;
//
string cover_right_text = 4;
//
int32 cover_right_icon = 5;
//
string cover_right_background_color = 6;
//
string badge = 7;
//
ReasonStyle rcmd_reason_style = 8;
}
//
message SmallCoverV7 {
//
Base base = 1;
//
string desc = 2;
}
//
message SmallCoverV9 {
//
Base base = 1;
//
string cover_left_text_1 = 2;
//
int32 cover_left_icon_1 = 3;
//
string cover_left_text_2 = 4;
//
int32 cover_left_icon_2 = 5;
//
string cover_right_text = 6;
//
int32 cover_right_icon = 7;
//
int32 can_play = 8;
//
ReasonStyle rcmd_reason_style = 9;
//
Up up = 10;
//
ReasonStyle left_cover_badge_style = 11;
//
ReasonStyle left_bottom_rcmd_reason_style = 12;
}
//
message SmallCoverConvergeV2 {
//
Base base = 1;
//
string cover_left_text_1 = 2;
//
int32 cover_left_icon_1 = 3;
//
string cover_left_text_2 = 4;
//
int32 cover_left_icon_2 = 5;
//
string cover_right_text = 6;
//
string cover_right_top_text = 7;
//
ReasonStyle rcmd_reason_style = 8;
//
ReasonStyle rcmd_reason_style_v2 = 9;
}
//
message SmallChannelSpecial {
//
Base base = 1;
//
string bg_cover = 2;
//
string desc_1 = 3;
//
string desc_2 = 4;
//
string badge = 5;
//
ReasonStyle rcmd_reason_style_2 = 6;
}
syntax = "proto3";
package bilibili.app.card.v1;
import "bilibili/app/card/v1/common.proto";
//
message SmallCoverV5 {
// 条目基本信息
Base base = 1;
//
string cover_gif = 2;
//
Up up = 3;
// 封面右下角标文案
string cover_right_text_1 = 4;
// 右侧文案1
string right_desc_1 = 5;
// 右侧文案2
string right_desc_2 = 6;
// 右侧推荐原因标签框
ReasonStyle rcmd_reason_style = 7;
//
HotwordEntrance hotword_entrance = 8;
// 直播小卡的角标
ReasonStyle corner_mark_style = 9;
// 右侧文案1图标id
int32 right_icon_1 = 10;
// 右侧文案2图标id
int32 right_icon_2 = 11;
// 左上角角标
ReasonStyle left_corner_mark_style = 12;
}
//
message HotwordEntrance {
//
int64 hotword_id = 1;
//
string hot_text = 2;
//
string h5_url = 3;
//
string icon = 4;
}
//
message LargeCoverV1 {
// 条目基本信息
Base base = 1;
//
string cover_gif = 2;
//
Avatar avatar = 3;
//
string cover_left_text_1 = 4;
//
string cover_left_text_2 = 5;
//
string cover_left_text_3 = 6;
//
string cover_badge = 7;
//
string top_rcmd_reason = 8;
//
string bottom_rcmd_reason = 9;
//
string desc = 10;
//
int32 official_icon = 11;
//
int32 can_play = 12;
//
ReasonStyle top_rcmd_reason_style = 13;
//
ReasonStyle bottom_rcmd_reason_style = 14;
//
ReasonStyle rcmd_reason_style_v2 = 15;
//
ReasonStyle left_cover_badge_style = 16;
//
ReasonStyle right_cover_badge_style = 17;
//
string cover_badge_2 = 18;
//
LikeButton like_button = 19;
//
int32 title_single_line = 20;
//
string cover_right_text = 21;
}
//
message ThreeItemAllV2 {
// 条目基本信息
Base base = 1;
//
ReasonStyle top_rcmd_reason_style = 2;
//
repeated TwoItemHV1Item item = 3;
}
//
message TwoItemHV1Item {
//
string title = 1;
//
string cover = 2;
//
string uri = 3;
//
string param = 4;
//
Args args = 5;
//
string goto = 6;
//
string cover_left_text_1 = 7;
//
int32 cover_left_icon_1 = 8;
//
string cover_right_text = 9;
}
// 推荐
message RcmdOneItem {
// 条目基本信息
Base base = 1;
// 标签框信息
ReasonStyle topRcmdReasonStyle = 2;
// 小封面推荐内容信息
SmallCoverRcmdItem item = 3;
}
// 小封面推荐内容信息
message SmallCoverRcmdItem {
// 标题
string title = 1;
// 封面url
string cover = 2;
// 跳转uri
string uri = 3;
// 参数
string param = 4;
// 跳转类型
// av:视频稿件
string goto = 5;
// 封面右下角标文案
string coverRightText1 = 6;
// 右侧文案1
string rightDesc1 = 7;
// 右侧文案2
string rightDesc2 = 8;
//
string coverGif = 9;
// 右侧文案1图标id
int32 rightIcon1 = 10;
// 右侧文案2图标id
int32 rightIcon2 = 11;
}
//
message ThreeItemV1 {
// 条目基本信息
Base base = 1;
//
int32 titleIcon = 2;
//
string moreUri = 3;
//
string moreText = 4;
//
repeated ThreeItemV1Item items = 5;
}
//
message ThreeItemV1Item {
// 条目基本信息
Base base = 1;
//
string coverLeftText = 2;
//
int32 coverLeftIcon = 3;
//
string desc1 = 4;
//
string desc2 = 5;
//
string badge = 6;
}
//
message HotTopicItem {
//
string cover = 1;
//
string uri = 2;
//
string param = 3;
//
string name = 4;
}
//
message HotTopic {
// 条目基本信息
Base base = 1;
//
string desc = 2;
//
repeated HotTopicItem items = 3;
}
//
message DynamicHot {
// 条目基本信息
Base base = 1;
//
string top_left_title = 2;
//
string desc1 = 3;
//
string desc2 = 4;
//
string more_uri = 5;
//
string more_text = 6;
//
repeated string covers = 7;
//
string cover_right_text = 8;
//
ReasonStyle top_rcmd_reason_style = 9;
}
//
message MiddleCoverV3 {
// 条目基本信息
Base base = 1;
//
string desc1 = 2;
//
string desc2 = 3;
//
ReasonStyle cover_badge_style = 4;
}
//
message LargeCoverV4 {
// 条目基本信息
Base base = 1;
//
string cover_left_text_1 = 2;
//
string cover_left_text_2 = 3;
//
string cover_left_text_3 = 4;
//
string cover_badge = 5;
//
int32 can_play = 6;
//
Up up = 7;
//
string short_link = 8;
//
string share_subtitle = 9;
//
string play_number = 10;
//
string bvid = 11;
//
string sub_param = 12;
}
// 热门列表顶部按钮
message PopularTopEntrance {
// 条目基本信息
Base base = 1;
// 按钮项
repeated EntranceItem items = 2;
}
// 热门列表按钮信息
message EntranceItem {
// 跳转类型
string goto = 1;
// 图标url
string icon = 2;
// 标题
string title = 3;
// 入口模块id
string moduleId = 4;
// 跳转uri
string uri = 5;
// 入口id
int64 entranceId = 6;
// 气泡信息
Bubble bubble = 7;
// 入口类型
// 1:代表分品类热门
int32 entranceType = 8;
}
// 气泡信息
message Bubble {
// 文案
string bubbleContent = 1;
// 版本
int32 version = 2;
// 起始时间
int64 stime = 3;
}
\ No newline at end of file
syntax = "proto3";
package bilibili.app.interfaces.v1;
import "bilibili/app/playurl/v1/playurl.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
syntax = "proto3";
package bilibili.app.show.gateway.v1;
import "bilibili/broadcast/message/main.proto";
//
service AppShow {
// 获取Native页进度数据
rpc GetActProgress (GetActProgressReq) returns (GetActProgressReply);
}
// 获取Native页进度数据-请求
message GetActProgressReq {
// Native页id
int64 pageID = 1;
// 用户mid
int64 mid = 2;
}
// 获取Native页进度数据-响应
message GetActProgressReply {
// 进度数据
bilibili.broadcast.message.main.NativePageEvent event = 1;
}
\ No newline at end of file
syntax = "proto3";
package bilibili.app.show.v1;
import "bilibili/app/card/v1/card.proto";
import "bilibili/app/archive/middleware/v1/preload.proto";
// 热门
service Popular {
// 热门列表
rpc Index (PopularResultReq) returns (PopularReply);
}
// 热门列表-请求
message PopularResultReq {
// 排位索引id,为上此请求末尾项的idx
int64 idx = 1;
// 登录标识
// 1:未登陆用户第一页 2:登陆用户第一页
int32 loginEvent = 2;
// 清晰度(旧版)
int32 qn = 3;
// 视频流版本(旧版)
int32 fnver = 4;
// 视频流功能(旧版)
int32 fnval = 5;
// 是否强制使用域名(旧版)
int32 forceHost = 6;
// 是否4K(旧版)
int32 fourk = 7;
// 当前页面spm
string spmid = 8;
// 上此请求末尾项的param
string lastParam = 9;
// 上此请求的ver
string ver = 10;
// 分品类热门的入口ID
int64 entranceId = 11;
// 热门定位id集合
string locationIds = 12;
// 0:tag页 1:中间页
int32 sourceId = 13;
// 数据埋点上报
// 0:代表手动刷新 1:代表自动刷新
int32 flush = 14;
// 视频秒开参数
bilibili.app.archive.middleware.v1.PlayerArgs playerArgs = 15;
}
// 热门列表-响应
message PopularReply {
// 卡片列表
repeated bilibili.app.card.v1.Card items = 1;
// 配置信息
Config config = 2;
// 版本
string ver = 3;
}
// 配置信息
message Config {
// 标题
string itemTitle = 1;
// 底部文案
string bottomText = 2;
// 底部图片url
string bottomTextCover = 3;
// 底部跳转页url
string bottomTextUrl = 4;
// 顶部按钮信息列表
repeated EntranceShow topItems = 5;
// 头图url
string headImage = 6;
// 当前页按钮信息
repeated EntranceShow pageItems = 7;
//
int32 hit = 8;
}
// 按钮信息
message EntranceShow {
// 按钮图标url
string icon = 1;
// 按钮名
string title = 2;
// 入口模块id
string moduleId = 3;
// 跳转uri
string uri = 4;
// 气泡信息
Bubble bubble = 5;
// 入口id
int64 entranceId = 6;
// 头图url
string topPhoto = 7;
// 入口类型
int32 entranceType = 8;
}
// 气泡信息
message Bubble {
// 文案
string bubbleContent = 1;
// 版本
int32 version = 2;
// 起始时间
int64 stime = 3;
}
syntax = "proto3";
package bilibili.app.show.region.v1;
//
service Region {
//
rpc Region (RegionReq) returns (RegionReply);
}
//
message RegionReq {
//
string lang = 1;
}
//
message RegionReply {
//
repeated RegionInfo regions = 1;
}
//
message RegionConfig {
//
string scenesName = 1;
//
string scenesType = 2;
}
//
message RegionInfo {
//
int32 tid = 1;
//
int32 reid = 2;
//
string name = 3;
//
string logo = 4;
//
string goto = 5;
//
string param = 6;
//
string uri = 7;
//
int32 type = 8;
//
int32 isBangumi = 9;
//
repeated RegionInfo children = 10;
//
repeated RegionConfig config = 11;
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -13,6 +13,11 @@ namespace Richasy.Bili.ViewModels.Uwp
{
private readonly INumberToolkit _numberToolkit;
/// <summary>
/// 分区Id.
/// </summary>
public int PartitionId { get; }
/// <summary>
/// 视频标题.
/// </summary>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册