protected override async ValueTask <byte[]> DownloadDataAsync(LyricDownloaderArgs args) { var searchResult = await _warpHttpClient.GetAsync <SongSearchResponse>( QQSearchMusicUrl, new SongSearchRequest(args.SongName, args.Artist)); ValidateSongSearchResponse(searchResult, args); var lyricJsonString = await _warpHttpClient.GetAsync(QQGetLyricUrl, new GetLyricRequest(searchResult.Data.Song.SongItems.FirstOrDefault()?.SongId), op => op.Headers.Referrer = new Uri(QQMusicRequestReferer)); return(Encoding.UTF8.GetBytes(lyricJsonString)); }
protected override async ValueTask <byte[]> DownloadDataAsync(LyricDownloaderArgs args) { var searchResult = await _warpHttpClient.GetAsync <SongSearchResponse>(KuGouSearchMusicUrl, new SongSearchRequest(args.SongName, args.Artist)); ValidateSongSearchResponse(searchResult, args); // 获得特殊的 AccessToken 与 Id,真正请求歌词数据。 var accessKeyResponse = await _warpHttpClient.GetAsync <GetLyricAccessKeyResponse>(KuGouGetLyricAccessKeyUrl, new GetLyricAccessKeyRequest(searchResult.Data.List[0].FileHash)); var accessKeyObject = accessKeyResponse.AccessKeyDataObjects[0]; var lyricResponse = await _warpHttpClient.GetAsync(KuGouGetLyricUrl, new GetLyricRequest(accessKeyObject.Id, accessKeyObject.AccessKey)); return(Encoding.UTF8.GetBytes(lyricResponse)); }
public async ValueTask <byte[]> DownloadAsync(string songName, string artist) { var requestParameter = new SongSearchRequest(songName, artist); var searchResult = await _warpHttpClient.GetAsync <SongSearchResponse>( SearchApi, requestParameter, _defaultOption); return(new byte[] { 0x1, 0x2 }); }
protected override async ValueTask <byte[]> DownloadDataAsync(LyricDownloaderArgs args) { var searchResult = await _warpHttpClient.PostAsync <SongSearchResponse>( NetEaseSearchMusicUrl, new SongSearchRequest(args.SongName, args.Artist), true, msg => { msg.Headers.Referrer = new Uri(NetEaseRequestReferer); if (msg.Content != null) { msg.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(NetEaseRequestContentType); } }); ValidateSongSearchResponse(searchResult, args); var lyricResponse = await _warpHttpClient.GetAsync( NetEaseGetLyricUrl, new GetLyricRequest(searchResult.GetFirstMatchSongId(args.SongName)), msg => msg.Headers.Referrer = new Uri(NetEaseRequestReferer)); return(Encoding.UTF8.GetBytes(lyricResponse)); }