You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
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
{
/// <summary>
/// 获取分区最新视频列表
/// </summary>
/// <param name="rid">目标分区tid</param>
/// <param name="pn">页码</param>
/// <param name="ps">每页项数( 最大50) </param>
/// <returns></returns>
public static List < DynamicVideoView > 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 < RegionDynamicOrigin > ( 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 ;
}
}
}
}