From b85988861e534fe8e6aa806568c6eaeb9da6ccb3 Mon Sep 17 00:00:00 2001 From: genteure Date: Sun, 5 Nov 2023 17:58:41 +0800 Subject: [PATCH] fix(core): unify user-agent fix #544 --- BililiveRecorder.Core/Api/Http/HttpApiClient.cs | 2 +- BililiveRecorder.Core/Recording/RecordTaskBase.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BililiveRecorder.Core/Api/Http/HttpApiClient.cs b/BililiveRecorder.Core/Api/Http/HttpApiClient.cs index ff0ce79..dc2531b6 100644 --- a/BililiveRecorder.Core/Api/Http/HttpApiClient.cs +++ b/BililiveRecorder.Core/Api/Http/HttpApiClient.cs @@ -18,7 +18,7 @@ namespace BililiveRecorder.Core.Api.Http internal const string HttpHeaderAcceptLanguage = "zh-CN"; internal const string HttpHeaderReferer = "https://live.bilibili.com/"; internal const string HttpHeaderOrigin = "https://live.bilibili.com"; - internal const string HttpHeaderUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"; + internal const string HttpHeaderUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"; private static readonly Regex matchCookieUidRegex = new Regex(@"DedeUserID=(\d+?);", RegexOptions.Compiled); private static readonly Regex matchCookieBuvid3Regex = new Regex(@"buvid3=(.+?);", RegexOptions.Compiled); private long uid; diff --git a/BililiveRecorder.Core/Recording/RecordTaskBase.cs b/BililiveRecorder.Core/Recording/RecordTaskBase.cs index 7ba5dc2..824c866 100644 --- a/BililiveRecorder.Core/Recording/RecordTaskBase.cs +++ b/BililiveRecorder.Core/Recording/RecordTaskBase.cs @@ -21,9 +21,9 @@ namespace BililiveRecorder.Core.Recording internal abstract class RecordTaskBase : IRecordTask { private const string HttpHeaderAccept = "*/*"; - private const string HttpHeaderOrigin = "https://live.bilibili.com"; - private const string HttpHeaderReferer = "https://live.bilibili.com/"; - private const string HttpHeaderUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36"; + private const string HttpHeaderOrigin = Api.Http.HttpApiClient.HttpHeaderOrigin; + private const string HttpHeaderReferer = Api.Http.HttpApiClient.HttpHeaderReferer; + private const string HttpHeaderUserAgent = Api.Http.HttpApiClient.HttpHeaderUserAgent; private const int timer_inverval = 2; protected readonly Timer timer = new Timer(1000 * timer_inverval);