视频详细信息API支持wbi

pull/896/head
leiurayer 1 year ago
parent 1a80a16d19
commit daabbb58d9

@ -1,4 +1,5 @@
using DownKyi.Core.BiliApi.Video.Models;
using DownKyi.Core.BiliApi.Sign;
using DownKyi.Core.BiliApi.Video.Models;
using DownKyi.Core.Logging;
using Newtonsoft.Json;
using System;
@ -17,13 +18,23 @@ namespace DownKyi.Core.BiliApi.Video
public static VideoView VideoViewInfo(string bvid = null, long aid = -1)
{
// https://api.bilibili.com/x/web-interface/view/detail?bvid=BV1Sg411F7cb&aid=969147110&need_operation_card=1&web_rm_repeat=1&need_elec=1&out_referer=https%3A%2F%2Fspace.bilibili.com%2F42018135%2Ffavlist%3Ffid%3D94341835
string baseUrl = "https://api.bilibili.com/x/web-interface/view";
string referer = "https://www.bilibili.com";
string url;
if (bvid != null) { url = $"{baseUrl}?bvid={bvid}"; }
else if (aid > -1) { url = $"{baseUrl}?aid={aid}"; }
else { return null; }
var parameters = new Dictionary<string, object>();
if (bvid != null)
{
parameters.Add("bvid", bvid);
}
else if (aid > -1)
{
parameters.Add("aid", aid);
}
else
{
return null;
}
string query = WbiSign.ParametersToQuery(WbiSign.EncodeWbi(parameters));
string url = $"https://api.bilibili.com/x/web-interface/wbi/view?{query}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try

Loading…
Cancel
Save