From 0772f5888f32f65ef0b2dc48bece2d85c49e9247 Mon Sep 17 00:00:00 2001 From: real-zony Date: Mon, 25 Jul 2022 20:11:30 +0800 Subject: [PATCH] fix: Fix the problem of QQ lyrics downloader prompting error. The reason for this is that the old API has been deprecated. --- .../QQMusic/JsonModel/SongSearchRequest.cs | 34 ++++++++----------- .../QQMusic/JsonModel/SongSearchResponse.cs | 4 +-- .../Lyric/QQMusic/QQLyricDownloader.cs | 3 +- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/JsonModel/SongSearchRequest.cs b/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/JsonModel/SongSearchRequest.cs index aae1411..98f4e9f 100644 --- a/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/JsonModel/SongSearchRequest.cs +++ b/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/JsonModel/SongSearchRequest.cs @@ -6,32 +6,26 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric.QQMusic.JsonModel { public class SongSearchRequest { - [JsonProperty("remoteplace")] public string RemotePlace { get; set; } + [JsonProperty("format")] + public string Format { get; protected set; } - [JsonProperty("p")] public int Page { get; set; } + [JsonProperty("inCharset")] + public string InCharset { get; protected set; } - [JsonProperty("n")] public int Limit { get; set; } - - [JsonProperty("w")] public string Keyword { get; set; } - - [JsonProperty("format")] public string ResultFormat { get; set; } - - [JsonProperty("inCharset")] public string InCharset { get; set; } - - [JsonProperty("outCharset")] public string OutCharset { get; set; } - - [JsonProperty("platform")] public string Platform { get; set; } + [JsonProperty("outCharset")] + public string OutCharset { get; protected set; } + [JsonProperty("platform")] + public string Platform { get; protected set; } + [JsonProperty("key")] + public string Keyword { get; protected set; } + protected SongSearchRequest() { - RemotePlace = "txt.yqq.song"; - Page = 1; - Limit = 5; - ResultFormat = "json"; - InCharset = "utf8"; - OutCharset = "utf8"; - Platform = "yqq"; + Format = "json"; + InCharset = OutCharset = "utf-8"; + Platform = "yqq.json"; } public SongSearchRequest(string musicName, string artistName) : this() diff --git a/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/JsonModel/SongSearchResponse.cs b/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/JsonModel/SongSearchResponse.cs index ad759cc..8536631 100644 --- a/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/JsonModel/SongSearchResponse.cs +++ b/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/JsonModel/SongSearchResponse.cs @@ -17,11 +17,11 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric.QQMusic.JsonModel public class QQMusicInnerSongModel { - [JsonProperty("list")] public List SongItems { get; set; } + [JsonProperty("itemlist")] public List SongItems { get; set; } } public class QQMusicInnerSongItem { - [JsonProperty("songmid")] public string SongId { get; set; } + [JsonProperty("mid")] public string SongId { get; set; } } } \ No newline at end of file diff --git a/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/QQLyricDownloader.cs b/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/QQLyricDownloader.cs index 1cac4a6..e22c17a 100644 --- a/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/QQLyricDownloader.cs +++ b/src/ZonyLrcTools.Cli/Infrastructure/Lyric/QQMusic/QQLyricDownloader.cs @@ -17,7 +17,8 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric.QQMusic private readonly IWarpHttpClient _warpHttpClient; private readonly ILyricItemCollectionFactory _lyricItemCollectionFactory; - private const string QQSearchMusicUrl = @"https://c.y.qq.com/soso/fcgi-bin/client_search_cp"; + // private const string QQSearchMusicUrl = @"https://c.y.qq.com/soso/fcgi-bin/client_search_cp"; + private const string QQSearchMusicUrl = @"https://c.y.qq.com/splcloud/fcgi-bin/smartbox_new.fcg"; private const string QQGetLyricUrl = @"https://c.y.qq.com/lyric/fcgi-bin/fcg_query_lyric_new.fcg"; private const string QQMusicRequestReferer = @"https://y.qq.com/";