diff --git a/Directory.Build.props b/Directory.Build.props index 2520153..fa2aaed 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,15 +1,15 @@ - - net6.0-windows10.0.17763.0;net5.0-windows10.0.17763.0;netframework461-windows10.0.17763.0 - 9.0 - enable - true - true - true + + net7.0-windows10.0.17763.0;net6.0-windows10.0.17763.0;net5.0-windows10.0.17763.0;netframework461-windows10.0.17763.0 + 9.0 + enable + true + true + true - 1.0.2.0 - 1.0.2.0 - 1.0.2.0 - 1.0.2.0 - + 1.0.3.0 + 1.0.3.0 + 1.0.3.0 + 1.0.3.0 + diff --git a/src/BililiveNotification/Apis/BiliApis.GetUserInfo.cs b/src/BililiveNotification/Apis/BiliApis.GetUserInfo.cs index 7a60525..80be26c 100644 --- a/src/BililiveNotification/Apis/BiliApis.GetUserInfo.cs +++ b/src/BililiveNotification/Apis/BiliApis.GetUserInfo.cs @@ -1,4 +1,4 @@ -using BililiveNotification.Models; +using BililiveNotification.Models; using Executorlibs.Shared.Exceptions; using Executorlibs.Shared.Extensions; using System; @@ -13,18 +13,18 @@ public static partial class BiliApis { public static async Task GetUserInfoAsync(HttpClient client, int userId, CancellationToken token = default) { - HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Get, $"https://api.bilibili.com/x/space/acc/info?mid={userId}&jsonp=jsonp"); + HttpRequestMessage req = new HttpRequestMessage(HttpMethod.Get, $"https://api.bilibili.com/x/web-interface/card?mid={userId}"); req.Headers.Accept.ParseAdd("*/*"); - req.Headers.Add("Origin", "https://live.bilibili.com"); - req.Headers.Referrer = new Uri("https://live.bilibili.com/"); - using JsonDocument j = await client.SendAsync(req, HttpCompletionOption.ResponseHeadersRead, token).GetJsonAsync(token); + req.Headers.Add("Origin", "https://www.bilibili.com"); + req.Headers.Referrer = new Uri("https://www.bilibili.com/"); + using JsonDocument j = await client.SendAsync(req, token).GetJsonAsync(token); JsonElement root = j.RootElement; if (root.GetProperty("code").GetInt32() != 0) { throw new UnknownResponseException(in root); } - JsonElement data = root.GetProperty("data"); - return new UserInfo(data.GetProperty("name").GetString()!, userId, data.GetProperty("face").GetString()!); + JsonElement card = root.GetProperty("data").GetProperty("card"); + return new UserInfo(card.GetProperty("name").GetString()!, userId, card.GetProperty("face").GetString()!); } } } diff --git a/src/BililiveNotification/BililiveNotification.csproj b/src/BililiveNotification/BililiveNotification.csproj index 2db6165..f7ef355 100644 --- a/src/BililiveNotification/BililiveNotification.csproj +++ b/src/BililiveNotification/BililiveNotification.csproj @@ -10,15 +10,22 @@ - - + + + + + + + + + - - - - + + + +