Skip to content

Commit

Permalink
更新Settings.json
Browse files Browse the repository at this point in the history
  • Loading branch information
wwh1004 committed Aug 22, 2019
1 parent f1d7a59 commit cbdaafc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion NLyric/Ncm/NcmApi.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Extensions;
using System.Net.Http;
Expand Down Expand Up @@ -34,13 +35,17 @@ public static async Task<JToken> SearchAsync(IEnumerable<string> keywords, Searc
using (HttpClient client = new HttpClient())
using (HttpResponseMessage response = await client.SendAsync(HttpMethod.Get, SEARCH_URL, queries, null)) {
JObject json;
JToken result;

if (!response.IsSuccessStatusCode)
throw new HttpRequestException();
json = JObject.Parse(await response.Content.ReadAsStringAsync());
if ((int)json["code"] != 200)
throw new HttpRequestException();
return json["result"];
result = json["result"];
if (result is null)
throw new ArgumentException($"\"{string.Join(" ", keywords)}\" 中有关键词被屏蔽");
return result;
}
}

Expand Down
3 changes: 2 additions & 1 deletion NLyric/Settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"Separators": "|;,/\\&:", // 分隔符,用于分割歌手名
"WholeWordReplace": {
"sh0ut": "shØut",
"あやぽんず*": "あやぽんず*"
"あやぽんず*": "あやぽんず",
"あやぽんず*": "あやぽんず"
}, // 前面是被替换的词,后面是要替换成的词,比如歌名"sh0ut",搜索的时候会被替换成"shØut"来搜索,网易云音乐部分歌曲歌手名收录有问题,只能这么办
"Limit": 15 // 搜索结果数量
},
Expand Down

0 comments on commit cbdaafc

Please sign in to comment.