mirror of
https://github.com/leiurayer/downkyi.git
synced 2025-03-23 07:40:12 +08:00
新增GetVideoViewInfo API
This commit is contained in:
parent
99c6cf42c1
commit
66e73a2537
28
src/BiliSharp.UnitTest/Api/Video/TestVideoInfo.cs
Normal file
28
src/BiliSharp.UnitTest/Api/Video/TestVideoInfo.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using BiliSharp.Api.Login;
|
||||
using BiliSharp.Api.Sign;
|
||||
using BiliSharp.Api.Video;
|
||||
|
||||
namespace BiliSharp.UnitTest.Api.Video
|
||||
{
|
||||
public class TestVideoInfo
|
||||
{
|
||||
[Fact]
|
||||
public void TestGetVideoViewInfo_Default()
|
||||
{
|
||||
// 设置wbi keys
|
||||
var info = LoginInfo.GetNavigationInfo();
|
||||
var imgKey = info.Data.WbiImg.ImgUrl.Split('/').ToList().Last().Split('.')[0];
|
||||
var subKey = info.Data.WbiImg.SubUrl.Split('/').ToList().Last().Split('.')[0];
|
||||
var keys = new Tuple<string, string>(imgKey, subKey);
|
||||
WbiSign.SetKey(keys);
|
||||
|
||||
string bvid = "BV1Pu4y1y7FA";
|
||||
long aid = 915570400;
|
||||
var videoInfo = VideoInfo.GetVideoViewInfo(bvid, aid);
|
||||
|
||||
Assert.Equal(bvid, videoInfo.Data.View.Bvid);
|
||||
Assert.Equal(aid, videoInfo.Data.View.Aid);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -583,13 +583,13 @@ namespace BiliSharp.Api.Models.User
|
||||
///
|
||||
/// </summary>
|
||||
public class UserSpaceInfoDataTheme
|
||||
{ }
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class UserSpaceInfoDataSysNotice
|
||||
{ }
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
3257
src/BiliSharp/Api/Models/Video/VideoView.cs
Normal file
3257
src/BiliSharp/Api/Models/Video/VideoView.cs
Normal file
File diff suppressed because it is too large
Load Diff
35
src/BiliSharp/Api/Video/VideoInfo.cs
Normal file
35
src/BiliSharp/Api/Video/VideoInfo.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using BiliSharp.Api.Models.Video;
|
||||
using BiliSharp.Api.Sign;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BiliSharp.Api.Video
|
||||
{
|
||||
/// <summary>
|
||||
/// 视频基本信息
|
||||
/// </summary>
|
||||
public static class VideoInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取视频超详细信息(web端)
|
||||
/// </summary>
|
||||
/// <param name="bvid"></param>
|
||||
/// <param name="aid"></param>
|
||||
/// <returns></returns>
|
||||
public static VideoView GetVideoViewInfo(string bvid, long aid)
|
||||
{
|
||||
var parameters = new Dictionary<string, object>
|
||||
{
|
||||
{ "platform", "web" },
|
||||
//{ "need_operation_card", 1 },
|
||||
//{ "web_location", 1446382 },
|
||||
{ "need_elec", 1 },
|
||||
{ "aid", aid },
|
||||
{ "bvid", bvid },
|
||||
};
|
||||
string query = WbiSign.ParametersToQuery(WbiSign.EncodeWbi(parameters));
|
||||
string url = $"https://api.bilibili.com/x/web-interface/wbi/view/detail?{query}";
|
||||
return Utils.GetData<VideoView>(url);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user