不输出“任务已取消”错误

This commit is contained in:
Genteure 2019-11-13 19:06:57 +08:00
parent ab89126199
commit 54fb2c2626

View File

@ -19,7 +19,7 @@ namespace BililiveRecorder.Core
static BililiveAPI()
{
httpclient = new HttpClient { Timeout = TimeSpan.FromSeconds(5) };
httpclient = new HttpClient { Timeout = TimeSpan.FromSeconds(10) };
httpclient.DefaultRequestHeaders.Add("Accept", "application/json, text/javascript, */*; q=0.01");
httpclient.DefaultRequestHeaders.Add("Referer", "https://live.bilibili.com/");
httpclient.DefaultRequestHeaders.Add("User-Agent", Utils.UserAgent);
@ -100,6 +100,10 @@ namespace BililiveRecorder.Core
var j = JObject.Parse(s);
return j;
}
catch (TaskCanceledException)
{
return null;
}
finally
{
semaphoreSlim.Release();