using DownKyi.Core.BiliApi.Favorites.Models;
using DownKyi.Core.Logging;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DownKyi.Core.BiliApi.Favorites
{
public static class FavoritesInfo
{
///
/// 获取收藏夹元数据
///
///
public static FavoritesMetaInfo GetFavoritesInfo(long mediaId)
{
string url = $"https://api.bilibili.com/x/v3/fav/folder/info?media_id={mediaId}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
var info = JsonConvert.DeserializeObject(response);
if (info != null) { return info.Data; }
else { return null; }
}
catch (Exception e)
{
Utils.Debug.Console.PrintLine("GetFavoritesInfo()发生异常: {0}", e);
LogManager.Error("FavoritesInfo", e);
return null;
}
}
}
}