diff --git a/BarrageGrab/App.config b/BarrageGrab/App.config
index 1c784ab..ee359f3 100644
--- a/BarrageGrab/App.config
+++ b/BarrageGrab/App.config
@@ -2,8 +2,10 @@
+
+
@@ -16,10 +18,12 @@
+
+
\ No newline at end of file
diff --git a/BarrageGrab/Appsetting.cs b/BarrageGrab/Appsetting.cs
index e53c26a..9a79bfc 100644
--- a/BarrageGrab/Appsetting.cs
+++ b/BarrageGrab/Appsetting.cs
@@ -25,7 +25,7 @@ namespace BarrageGrab
PrintFilter = Enum.GetValues(typeof(BarrageMsgType)).Cast().ToArray();
FilterHostName = bool.Parse(AppSettings["filterHostName"].Trim());
HostNameFilter = AppSettings["hostNameFilter"].Trim().Split(',').Where(w=>!string.IsNullOrWhiteSpace(w)).ToArray();
- //RoomIds = AppSettings["roomIds"].Trim().Split(',').Where(w=>!string.IsNullOrWhiteSpace(w)).Select(s => long.Parse(s)).ToArray();
+ RoomIds = AppSettings["roomIds"].Trim().Split(',').Where(w=>!string.IsNullOrWhiteSpace(w)).Select(s => long.Parse(s)).ToArray();
var printFilter = AppSettings["printFilter"].Trim().ToLower();
if (printFilter != "all")
diff --git a/BarrageGrab/JsonEntity/BarrageMessages.cs b/BarrageGrab/JsonEntity/BarrageMessages.cs
index a2ed1c6..c3b440d 100644
--- a/BarrageGrab/JsonEntity/BarrageMessages.cs
+++ b/BarrageGrab/JsonEntity/BarrageMessages.cs
@@ -73,6 +73,22 @@
public long RoomId { get; set; }
}
+ ///
+ /// 粉丝团信息
+ ///
+ public class FansClubInfo
+ {
+ ///
+ /// 粉丝团名称
+ ///
+ public string ClubName { get; set; }
+
+ ///
+ /// 粉丝团等级,没加入则0
+ ///
+ public int Level { get; set; }
+ }
+
///
/// 用户弹幕信息
///
@@ -103,6 +119,21 @@
///
public int Gender { get; set; }
+ ///
+ /// 头像地址
+ ///
+ public string HeadImgUrl { get; set; }
+
+ ///
+ /// 用户主页地址
+ ///
+ public string SecUid { get; set; }
+
+ ///
+ /// 粉丝团信息
+ ///
+ public FansClubInfo FansClub { get; set; }
+
public string GenderToString()
{
return Gender == 1 ? "男" : Gender == 2 ? "女" : "妖";
diff --git a/BarrageGrab/ProtoEntity/Messages.cs b/BarrageGrab/ProtoEntity/Messages.cs
index 57060b6..af3bf1d 100644
--- a/BarrageGrab/ProtoEntity/Messages.cs
+++ b/BarrageGrab/ProtoEntity/Messages.cs
@@ -6,6 +6,8 @@
+using System.Collections.Generic;
+
namespace BarrageGrab.ProtoEntity
{
#pragma warning disable CS0612, CS0618, CS1591, CS3021, IDE0079, IDE1006, RCS1036, RCS1057, RCS1085, RCS1192
@@ -1017,6 +1019,17 @@ namespace BarrageGrab.ProtoEntity
[global::System.ComponentModel.DefaultValue("")]
public string displayId { get; set; } = "";
+ [global::ProtoBuf.ProtoMember(39)]
+ [global::System.ComponentModel.DefaultValue("")]
+ public string verified_content { get; set; } = "";
+
+ [global::ProtoBuf.ProtoMember(46)]
+ [global::System.ComponentModel.DefaultValue("")]
+ public string sec_uid { get; set; } = "";
+
+ [global::ProtoBuf.ProtoMember(47)]
+ public int user_role { get; set; } = 0;
+
[global::ProtoBuf.ProtoContract()]
public partial class UserAttr : global::ProtoBuf.IExtensible
{
diff --git a/BarrageGrab/Proxy/EventArgs/HttpResponseEventArgs.cs b/BarrageGrab/Proxy/EventArgs/HttpResponseEventArgs.cs
new file mode 100644
index 0000000..8f11a6e
--- /dev/null
+++ b/BarrageGrab/Proxy/EventArgs/HttpResponseEventArgs.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Titanium.Web.Proxy.Http;
+
+namespace BarrageGrab.Proxy.ProxyEventArgs
+{
+ ///
+ /// Http 响应事件参数
+ ///
+ public class HttpResponseEventArgs : EventArgs
+ {
+ ///
+ /// 响应对象
+ ///
+ public HttpWebClient HttpClient { get; set; }
+
+ ///
+ /// 进程ID
+ ///
+ public int ProcessID { get; set; }
+
+ ///
+ /// 进程名
+ ///
+ public string ProcessName { get; set; }
+
+ ///
+ /// 域名
+ ///
+ public string HostName { get; set; }
+ }
+}
diff --git a/BarrageGrab/Proxy/EventArgs/WsMessageEventArgs.cs b/BarrageGrab/Proxy/EventArgs/WsMessageEventArgs.cs
new file mode 100644
index 0000000..2d24c41
--- /dev/null
+++ b/BarrageGrab/Proxy/EventArgs/WsMessageEventArgs.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BarrageGrab.Proxy.ProxyEventArgs
+{
+ public class WsMessageEventArgs
+ {
+ ///
+ /// 消息体
+ ///
+ public byte[] Payload { get; set; }
+
+ ///
+ /// 进程ID
+ ///
+ public int ProcessID { get; set; }
+
+ ///
+ /// 进程名
+ ///
+ public string ProcessName { get; set; }
+
+ ///
+ /// 域名
+ ///
+ public string HostName { get; set; }
+ }
+}
diff --git a/BarrageGrab/Proxy/ISystemProxy.cs b/BarrageGrab/Proxy/ISystemProxy.cs
index 01b3385..0de6ffd 100644
--- a/BarrageGrab/Proxy/ISystemProxy.cs
+++ b/BarrageGrab/Proxy/ISystemProxy.cs
@@ -2,6 +2,7 @@
using Fiddler;
using System.Reflection;
using System.Collections.Generic;
+using BarrageGrab.Proxy.ProxyEventArgs;
namespace BarrageGrab.Proxy
{
@@ -9,6 +10,8 @@ namespace BarrageGrab.Proxy
{
event EventHandler OnWebSocketData;
+ event EventHandler OnResponse;
+
///
/// 域名过滤器
///
@@ -20,27 +23,5 @@ namespace BarrageGrab.Proxy
void Start();
}
- public class WsMessageEventArgs
- {
- ///
- /// 消息体
- ///
- public byte[] Payload { get; set; }
-
- ///
- /// 进程ID
- ///
- public int ProcessID { get; set; }
-
- ///
- /// 进程名
- ///
- public string ProcessName { get; set; }
-
- ///
- /// 域名
- ///
- public string HostName { get; set; }
-
- }
+
}
\ No newline at end of file
diff --git a/BarrageGrab/Proxy/SystemProxy.cs b/BarrageGrab/Proxy/SystemProxy.cs
index e94fedc..917e8ff 100644
--- a/BarrageGrab/Proxy/SystemProxy.cs
+++ b/BarrageGrab/Proxy/SystemProxy.cs
@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using System.Diagnostics;
+using BarrageGrab.Proxy.ProxyEventArgs;
namespace BarrageGrab.Proxy
{
@@ -23,6 +24,11 @@ namespace BarrageGrab.Proxy
///
public event EventHandler OnWebSocketData;
+ ///
+ /// 接收到http响应事件
+ ///
+ public event EventHandler OnResponse;
+
///
/// 代理端口
///
@@ -57,6 +63,15 @@ namespace BarrageGrab.Proxy
OnWebSocketData?.Invoke(this, args);
}
+ ///
+ /// 触发http响应事件
+ ///
+ ///
+ protected void FireOnResponse(HttpResponseEventArgs args)
+ {
+ OnResponse?.Invoke(this, args);
+ }
+
///
/// 获取进程名称
///
diff --git a/BarrageGrab/Proxy/TitaniumProxy.cs b/BarrageGrab/Proxy/TitaniumProxy.cs
index ce369aa..fb3f4a8 100644
--- a/BarrageGrab/Proxy/TitaniumProxy.cs
+++ b/BarrageGrab/Proxy/TitaniumProxy.cs
@@ -9,6 +9,7 @@ using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
+using BarrageGrab.Proxy.ProxyEventArgs;
using Microsoft.Win32;
using Titanium.Web.Proxy;
using Titanium.Web.Proxy.EventArguments;
@@ -43,12 +44,28 @@ namespace BarrageGrab.Proxy
proxyServer.ServerCertificateValidationCallback += ProxyServer_ServerCertificateValidationCallback; ;
proxyServer.BeforeResponse += ProxyServer_BeforeResponse;
+ proxyServer.AfterResponse += ProxyServer_AfterResponse;
explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, ProxyPort, true);
explicitEndPoint.BeforeTunnelConnectRequest += ExplicitEndPoint_BeforeTunnelConnectRequest;
proxyServer.AddEndPoint(explicitEndPoint);
}
+ private Task ProxyServer_AfterResponse(object sender, SessionEventArgs e)
+ {
+ string hostname = e.HttpClient.Request.RequestUri.Host;
+ var processid = e.HttpClient.ProcessId.Value;
+
+ this.FireOnResponse(new HttpResponseEventArgs()
+ {
+ ProcessID = processid,
+ HostName = hostname,
+ ProcessName = base.GetProcessName(processid),
+ HttpClient = e.HttpClient
+ });
+
+ return Task.CompletedTask;
+ }
private Task ProxyServer_ServerCertificateValidationCallback(object sender, CertificateValidationEventArgs e)
{
@@ -60,7 +77,6 @@ namespace BarrageGrab.Proxy
return Task.CompletedTask;
}
-
private async Task ProxyServer_BeforeResponse(object sender, SessionEventArgs e)
{
string hostname = e.HttpClient.Request.RequestUri.Host;
diff --git a/BarrageGrab/WsBarrageService.cs b/BarrageGrab/WsBarrageService.cs
index 24beef4..944e557 100644
--- a/BarrageGrab/WsBarrageService.cs
+++ b/BarrageGrab/WsBarrageService.cs
@@ -65,8 +65,19 @@ namespace BarrageGrab
Gender = data.Gender,
Id = data.Id,
Level = data.Level,
- Nickname = data.Nickname
+ Nickname = data.Nickname,
+ HeadImgUrl = data.avatarThumb.urlLists.FirstOrDefault()??"",
+ SecUid = data.sec_uid
};
+ if (data.fansClub.Data != null)
+ {
+ user.FansClub = new FansClubInfo()
+ {
+ ClubName = data.fansClub.Data.clubName,
+ Level = data.fansClub.Data.Level
+ };
+ }
+
return user;
}
diff --git a/BarrageGrab/WssBarrageGrab.cs b/BarrageGrab/WssBarrageGrab.cs
index 9ade026..fbb77dc 100644
--- a/BarrageGrab/WssBarrageGrab.cs
+++ b/BarrageGrab/WssBarrageGrab.cs
@@ -9,6 +9,7 @@ using BarrageGrab.ProtoEntity;
using ProtoBuf;
using ColorConsole;
using BarrageGrab.Proxy;
+using BarrageGrab.Proxy.ProxyEventArgs;
namespace BarrageGrab
{
@@ -70,7 +71,7 @@ namespace BarrageGrab
public WssBarrageGrab()
{
proxy.OnWebSocketData += Proxy_OnWebSocketData;
- proxy.HostNameFilter = HostNameChecker;
+ proxy.HostNameFilter = HostNameChecker;
}
public void Start()
@@ -83,7 +84,6 @@ namespace BarrageGrab
proxy.Dispose();
}
-
//域名过滤器
private bool HostNameChecker(string hostName)
{
@@ -122,7 +122,6 @@ namespace BarrageGrab
if (buff.Length == 0) return;
if (buff[0] != 0x08) return;
-
try
{
var enty = Serializer.Deserialize(new ReadOnlyMemory(buff));
@@ -147,6 +146,8 @@ namespace BarrageGrab
catch (Exception) { }
}
+
+
//发送事件
private void DoMessage(Message msg)
{
diff --git a/BarrageGrab/WssBarrageService.csproj b/BarrageGrab/WssBarrageService.csproj
index 337064f..12841af 100644
--- a/BarrageGrab/WssBarrageService.csproj
+++ b/BarrageGrab/WssBarrageService.csproj
@@ -117,6 +117,8 @@
+
+
diff --git a/BarrageGrab/proto/message.proto b/BarrageGrab/proto/message.proto
index 4cd59c5..b768192 100644
--- a/BarrageGrab/proto/message.proto
+++ b/BarrageGrab/proto/message.proto
@@ -323,6 +323,8 @@ message User{
AnchorInfo anchorInfo = 36;
int32 linkMicStats = 37;
string displayId = 38;
+ string sec_uid = 46; //用户主页ID
+ int32 user_role = 47; //用户角色
message UserAttr {
diff --git a/BarrageService.sln b/BarrageService.sln
index e55db5d..5d4f989 100644
--- a/BarrageService.sln
+++ b/BarrageService.sln
@@ -5,8 +5,6 @@ VisualStudioVersion = 17.2.32408.312
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WssBarrageService", "BarrageGrab\WssBarrageService.csproj", "{A07BB1DA-D5C2-4EEA-9F3F-E42AADB9C1D6}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FiddlerCore4", "FiddlerCore4\FiddlerCore4.csproj", "{6E137484-17DC-4AB2-A1BB-2E6E050A9F54}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -23,14 +21,6 @@ Global
{A07BB1DA-D5C2-4EEA-9F3F-E42AADB9C1D6}.Release|Any CPU.Build.0 = Release|Any CPU
{A07BB1DA-D5C2-4EEA-9F3F-E42AADB9C1D6}.Release|x86.ActiveCfg = Release|Any CPU
{A07BB1DA-D5C2-4EEA-9F3F-E42AADB9C1D6}.Release|x86.Build.0 = Release|Any CPU
- {6E137484-17DC-4AB2-A1BB-2E6E050A9F54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6E137484-17DC-4AB2-A1BB-2E6E050A9F54}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6E137484-17DC-4AB2-A1BB-2E6E050A9F54}.Debug|x86.ActiveCfg = Debug|Any CPU
- {6E137484-17DC-4AB2-A1BB-2E6E050A9F54}.Debug|x86.Build.0 = Debug|Any CPU
- {6E137484-17DC-4AB2-A1BB-2E6E050A9F54}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6E137484-17DC-4AB2-A1BB-2E6E050A9F54}.Release|Any CPU.Build.0 = Release|Any CPU
- {6E137484-17DC-4AB2-A1BB-2E6E050A9F54}.Release|x86.ActiveCfg = Release|Any CPU
- {6E137484-17DC-4AB2-A1BB-2E6E050A9F54}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE