public IActionResult Search(string keyword) { MusicProviders provider = MusicProviders.Instance; List <MergedSong> list = provider.SearchSongs(keyword, 1, 20); foreach (var item in list) { foreach (var item2 in item.items) { item2.url = provider.getDownloadUrl(item2); } } return(View(list)); }
public void Download() { WebClient client = new WebClient(); client.DownloadProgressChanged += Client_DownloadProgressChanged; new Thread(() => { // 多来源,防止单个来源出错 foreach (var item in song.items) { try { client.DownloadFile(musicProviders.getDownloadUrl(item), target + "\\" + item.getFileName()); DownloadFinish?.Invoke(this, this); break; } catch (Exception ex) { } } }).Start(); }
private string getSongUrl(Song song) { return(provider.getDownloadUrl(song)); }