mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-09-06 05:36:53 +00:00
chore: Fix compilation warning messages.
This commit is contained in:
@@ -16,10 +16,6 @@ namespace ZonyLrcTools.Common.Lyrics.Providers.QQMusic.JsonModel
|
||||
|
||||
[JsonProperty("g_tk")] public int Gtk { get; set; }
|
||||
|
||||
protected GetLyricRequest()
|
||||
{
|
||||
}
|
||||
|
||||
public GetLyricRequest(string? songId)
|
||||
{
|
||||
IsNoBase64Encoding = 1;
|
||||
|
@@ -19,8 +19,8 @@ namespace ZonyLrcTools.Common.Lyrics.Providers.QQMusic.JsonModel
|
||||
public string Platform { get; protected set; }
|
||||
|
||||
[JsonProperty("key")]
|
||||
public string Keyword { get; protected set; }
|
||||
|
||||
public string Keyword { get; protected set; } = null!;
|
||||
|
||||
protected SongSearchRequest()
|
||||
{
|
||||
Format = "json";
|
||||
|
@@ -6,21 +6,21 @@ namespace ZonyLrcTools.Common.Lyrics.Providers.QQMusic.JsonModel
|
||||
{
|
||||
[JsonProperty("code")] public int StatusCode { get; set; }
|
||||
|
||||
[JsonProperty("data")] public QQMusicInnerDataModel Data { get; set; }
|
||||
[JsonProperty("data")] public QQMusicInnerDataModel? Data { get; set; }
|
||||
}
|
||||
|
||||
public class QQMusicInnerDataModel
|
||||
{
|
||||
[JsonProperty("song")] public QQMusicInnerSongModel Song { get; set; }
|
||||
[JsonProperty("song")] public QQMusicInnerSongModel? Song { get; set; }
|
||||
}
|
||||
|
||||
public class QQMusicInnerSongModel
|
||||
{
|
||||
[JsonProperty("itemlist")] public List<QQMusicInnerSongItem> SongItems { get; set; }
|
||||
[JsonProperty("itemlist")] public List<QQMusicInnerSongItem>? SongItems { get; set; }
|
||||
}
|
||||
|
||||
public class QQMusicInnerSongItem
|
||||
{
|
||||
[JsonProperty("mid")] public string SongId { get; set; }
|
||||
[JsonProperty("mid")] public string? SongId { get; set; }
|
||||
}
|
||||
}
|
@@ -35,7 +35,7 @@ namespace ZonyLrcTools.Common.Lyrics.Providers.QQMusic
|
||||
ValidateSongSearchResponse(searchResult, args);
|
||||
|
||||
return await _warpHttpClient.GetAsync(QQGetLyricUrl,
|
||||
new GetLyricRequest(searchResult.Data.Song.SongItems.FirstOrDefault()?.SongId),
|
||||
new GetLyricRequest(searchResult.Data?.Song?.SongItems?.FirstOrDefault()?.SongId),
|
||||
op => op.Headers.Referrer = new Uri(QQMusicRequestReferer));
|
||||
}
|
||||
|
||||
@@ -57,15 +57,15 @@ namespace ZonyLrcTools.Common.Lyrics.Providers.QQMusic
|
||||
}
|
||||
|
||||
var lyricJsonObj = JObject.Parse(lyricJsonString);
|
||||
var sourceLyric = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(lyricJsonObj.SelectToken("$.lyric").Value<string>()));
|
||||
var translateLyric = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(lyricJsonObj.SelectToken("$.trans").Value<string>()));
|
||||
var sourceLyric = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(lyricJsonObj.SelectToken("$.lyric")!.Value<string>()));
|
||||
var translateLyric = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(lyricJsonObj.SelectToken("$.trans")!.Value<string>()));
|
||||
|
||||
return _lyricsItemCollectionFactory.Build(sourceLyric, translateLyric);
|
||||
}
|
||||
|
||||
protected virtual void ValidateSongSearchResponse(SongSearchResponse response, LyricsProviderArgs args)
|
||||
{
|
||||
if (response is not { StatusCode: 0 } || response.Data.Song.SongItems == null)
|
||||
if (response is not { StatusCode: 0 } || response.Data?.Song?.SongItems == null)
|
||||
{
|
||||
throw new ErrorCodeException(ErrorCodes.TheReturnValueIsIllegal, attachObj: args);
|
||||
}
|
||||
|
Reference in New Issue
Block a user