using DownKyi.Core.BiliApi.Video.Models;
using DownKyi.Core.Logging;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Video
{
public static class Dynamic
{
///
/// 获取分区最新视频列表
///
/// 目标分区tid
/// 页码
/// 每页项数(最大50)
///
public static List RegionDynamicList(int rid, int pn = 1, int ps = 5)
{
string url = $"https://api.bilibili.com/x/web-interface/dynamic/region?rid={rid}&pn={pn}&ps={ps}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
var dynamic = JsonConvert.DeserializeObject(response);
if (dynamic != null && dynamic.Data != null) { return dynamic.Data.Archives; }
else { return null; }
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("RegionDynamicList()发生异常: {0}", e);
LogManager.Error("Dynamic", e);
return null;
}
}
}
}