diff --git a/src/DownKyi.Core/BiliApi/LoginNew/LoginQR.cs b/src/DownKyi.Core/BiliApi/LoginNew/LoginQR.cs
new file mode 100644
index 0000000..8e0d86e
--- /dev/null
+++ b/src/DownKyi.Core/BiliApi/LoginNew/LoginQR.cs
@@ -0,0 +1,100 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.IO;
+using System.Windows.Media.Imaging;
+using DownKyi.Core.BiliApi.LoginNew.Models;
+using DownKyi.Core.Logging;
+using Newtonsoft.Json;
+
+namespace DownKyi.Core.BiliApi.LoginNew
+{
+ public static class LoginQR
+ {
+ ///
+ /// 申请二维码URL及扫码密钥(web端)
+ ///
+ ///
+ public static LoginUrlOrigin GetLoginUrl()
+ {
+ string getLoginUrl = "https://passport.bilibili.com/x/passport-login/web/qrcode/generate";
+ string response = WebClient.RequestWeb(getLoginUrl);
+ Console.Out.WriteLine(response);
+ try
+ {
+ return JsonConvert.DeserializeObject(response);
+ }
+ catch (Exception e)
+ {
+ Utils.Debugging.Console.PrintLine("GetLoginUrl()发生异常: {0}", e);
+ LogManager.Error("LoginQR", e);
+ return null;
+ }
+ }
+
+ ///
+ /// 使用扫码登录(web端)
+ ///
+ ///
+ ///
+ ///
+ public static LoginStatus GetLoginStatus(string qrcodeKey, string goUrl = "https://www.bilibili.com")
+ {
+ string url = "https://passport.bilibili.com/x/passport-login/web/qrcode/poll?qrcode_key=" + qrcodeKey;
+
+ string response = WebClient.RequestWeb(url);
+
+ try
+ {
+ return JsonConvert.DeserializeObject(response);
+ }
+ catch (Exception e)
+ {
+ Utils.Debugging.Console.PrintLine("GetLoginInfo()发生异常: {0}", e);
+ LogManager.Error("LoginQR", e);
+ return null;
+ }
+ }
+
+ ///
+ /// 获得登录二维码
+ ///
+ ///
+ public static BitmapImage GetLoginQRCode()
+ {
+ try
+ {
+ string loginUrl = GetLoginUrl().Data.Url;
+ return GetLoginQRCode(loginUrl);
+ }
+ catch (Exception e)
+ {
+ Utils.Debugging.Console.PrintLine("GetLoginQRCode()发生异常: {0}", e);
+ LogManager.Error("LoginQR", e);
+ return null;
+ }
+ }
+
+ ///
+ /// 根据输入url生成二维码
+ ///
+ ///
+ ///
+ public static BitmapImage GetLoginQRCode(string url)
+ {
+ // 设置的参数影响app能否成功扫码
+ Bitmap qrCode = Utils.QRCode.EncodeQRCode(url, 10, 10, null, 0, 0, false);
+
+ MemoryStream ms = new MemoryStream();
+ qrCode.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
+ byte[] bytes = ms.GetBuffer();
+ ms.Close();
+
+ BitmapImage image = new BitmapImage();
+ image.BeginInit();
+ image.StreamSource = new MemoryStream(bytes);
+ image.EndInit();
+ return image;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginStatus.cs b/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginStatus.cs
new file mode 100644
index 0000000..c8dcc5a
--- /dev/null
+++ b/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginStatus.cs
@@ -0,0 +1,23 @@
+using DownKyi.Core.BiliApi.Models;
+using Newtonsoft.Json;
+
+namespace DownKyi.Core.BiliApi.LoginNew.Models
+{
+ [JsonObject]
+ public class LoginStatus : BaseModel
+ {
+ [JsonProperty("code")] public int Code { get; set; }
+ [JsonProperty("message")] public string Message { get; set; }
+
+ [JsonProperty("data")] public LoginStatusData Data { get; set; }
+ }
+
+ [JsonObject]
+ public class LoginStatusData : BaseModel
+ {
+ [JsonProperty("url")] public string Url { get; set; }
+ [JsonProperty("refresh_token")] public string RefreshToken { get; set; }
+ [JsonProperty("code")] public int Code { get; set; }
+ [JsonProperty("message")] public string Message { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginUrl.cs b/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginUrl.cs
new file mode 100644
index 0000000..c45c69b
--- /dev/null
+++ b/src/DownKyi.Core/BiliApi/LoginNew/Models/LoginUrl.cs
@@ -0,0 +1,26 @@
+using DownKyi.Core.BiliApi.Models;
+using Newtonsoft.Json;
+
+namespace DownKyi.Core.BiliApi.LoginNew.Models
+{
+ // https://passport.bilibili.com/qrcode/getLoginUrl
+ [JsonObject]
+ public class LoginUrlOrigin : BaseModel
+ {
+ //public int code { get; set; }
+ [JsonProperty("data")]
+ public LoginUrl Data { get; set; }
+ [JsonProperty("code")]
+ public int Code { get; set; }
+ //public long ts { get; set; }
+ }
+
+ [JsonObject]
+ public class LoginUrl : BaseModel
+ {
+ [JsonProperty("qrcode_key")]
+ public string QrcodeKey { get; set; }
+ [JsonProperty("url")]
+ public string Url { get; set; }
+ }
+}
diff --git a/src/DownKyi/ViewModels/ViewLoginViewModel.cs b/src/DownKyi/ViewModels/ViewLoginViewModel.cs
index e5f2d28..83af681 100644
--- a/src/DownKyi/ViewModels/ViewLoginViewModel.cs
+++ b/src/DownKyi/ViewModels/ViewLoginViewModel.cs
@@ -173,7 +173,7 @@ namespace DownKyi.ViewModels
// 创建新任务
PropertyChangeAsync(new Action(() => { Task.Run(Login, (tokenSource = new CancellationTokenSource()).Token); }));
break;
- case 86010:
+ case 86101:
// 未扫码
break;
case 86090: