支持在any端口上监听ws
This commit is contained in:
+24
-27
@@ -1,29 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!--配置更改后重启才能生效-->
|
<!--配置更改后重启才能生效-->
|
||||||
<appSettings>
|
<appSettings>
|
||||||
|
<!--过滤Websocket数据源进程,可用','进行分隔,程序将会监听以下进程的弹幕信息-->
|
||||||
<!--过滤Websocket数据源进程,可用','进行分隔,程序将会监听以下进程的弹幕信息-->
|
<add key="processFilter" value="直播伴侣,chrome,msedge,douyin" />
|
||||||
<add key="processFilter" value="直播伴侣,chrome,msedge,douyin"/>
|
<!--Websocket监听端口-->
|
||||||
|
<add key="wsListenPort" value="8888" />
|
||||||
<!--Websocket监听端口-->
|
<!--true:监听在0.0.0.0,接受任意Ip连接,false:监听在127.0.0.1,仅接受本机连接-->
|
||||||
<add key="wsListenPort" value="8888"/>
|
<add key="listenAny" value="true" />
|
||||||
<!--在控制台输出弹幕-->
|
<!--系统代理端口-->
|
||||||
<add key="printBarrage" value="true"/>
|
<add key="proxyPort" value="8827" />
|
||||||
<!--要在控制台打印的弹幕类型,可以用','隔开 all[全部],1[普通弹幕],2[点赞消息],3[进入直播间],4[关注消息],5[礼物消息],6[统计消息],7[粉丝团消息]-->
|
<!--在控制台输出弹幕-->
|
||||||
<add key="printFilter" value="all"/>
|
<add key="printBarrage" value="true" />
|
||||||
<!--系统代理端口-->
|
<!--要在控制台打印的弹幕类型,可以用','隔开 all[全部],1[普通弹幕],2[点赞消息],3[进入直播间],4[关注消息],5[礼物消息],6[统计消息],7[粉丝团消息]-->
|
||||||
<add key="proxyPort" value="8827"/>
|
<add key="printFilter" value="all" />
|
||||||
<!--开启内置的域名过滤,设置为false会解包所有https请求,cpu占用很高,建议在无法获取弹幕数据时调整 -->
|
<!--是否启用系统代理,若设置为false 则需要在程序手动指定代理地址 -->
|
||||||
<add key="filterHostName" value="true"/>
|
<add key="usedProxy" value="true" />
|
||||||
<!--已知的弹幕域名列表 ','分隔 用作过滤规则中,凡是webcast开头的域名程序都会自动列入白名单-->
|
<!--开启内置的域名过滤,设置为false会解包所有https请求,cpu占用很高,建议在无法获取弹幕数据时调整 -->
|
||||||
<add key="hostNameFilter" value="
|
<add key="filterHostName" value="true" />
|
||||||
webcast3-ws-web-hl.douyin.com,
|
<!--已知的弹幕域名列表 ','分隔 用作过滤规则中,凡是webcast开头的域名程序都会自动列入白名单-->
|
||||||
webcast3-ws-web-lf.douyin.com,
|
<add key="hostNameFilter" value="" />
|
||||||
webcast100-ws-web-lq.amemv.com,
|
<!--要进行过滤的房间ID,不填代表监听所有,多项使用','分隔,浏览器进入直播间 F12 控制台输入 'window.localStorage.playRoom' 即可快速看到房间ID(不是地址栏中的那个) -->
|
||||||
frontier-im.douyin.com,
|
<add key="roomIds" value="" />
|
||||||
"/>
|
</appSettings>
|
||||||
<!--要进行过滤的房间ID,不填代表监听所有,多项使用','分隔,浏览器进入直播间 F12 控制台输入 'window.localStorage.playRoom' 即可快速看到房间ID(不是地址栏中的那个) -->
|
|
||||||
<add key="roomIds" value=""/>
|
|
||||||
</appSettings>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -4,7 +4,7 @@ using System.Configuration;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BarrageGrab.JsonEntity;
|
using BarrageGrab.Modles.JsonEntity;
|
||||||
using static System.Configuration.ConfigurationManager;
|
using static System.Configuration.ConfigurationManager;
|
||||||
namespace BarrageGrab
|
namespace BarrageGrab
|
||||||
{
|
{
|
||||||
@@ -24,8 +24,10 @@ namespace BarrageGrab
|
|||||||
ProxyPort = int.Parse(AppSettings["proxyPort"]);
|
ProxyPort = int.Parse(AppSettings["proxyPort"]);
|
||||||
PrintFilter = Enum.GetValues(typeof(BarrageMsgType)).Cast<int>().ToArray();
|
PrintFilter = Enum.GetValues(typeof(BarrageMsgType)).Cast<int>().ToArray();
|
||||||
FilterHostName = bool.Parse(AppSettings["filterHostName"].Trim());
|
FilterHostName = bool.Parse(AppSettings["filterHostName"].Trim());
|
||||||
HostNameFilter = AppSettings["hostNameFilter"].Trim().Split(',').Where(w=>!string.IsNullOrWhiteSpace(w)).ToArray();
|
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();
|
||||||
|
UsedProxy = bool.Parse(AppSettings["usedProxy"].Trim());
|
||||||
|
ListenAny = bool.Parse(AppSettings["listenAny"].Trim());
|
||||||
|
|
||||||
var printFilter = AppSettings["printFilter"].Trim().ToLower();
|
var printFilter = AppSettings["printFilter"].Trim().ToLower();
|
||||||
if (printFilter != "all")
|
if (printFilter != "all")
|
||||||
@@ -38,9 +40,14 @@ namespace BarrageGrab
|
|||||||
{
|
{
|
||||||
Console.WriteLine("配置文件读取失败,请检查配置文件是否正确");
|
Console.WriteLine("配置文件读取失败,请检查配置文件是否正确");
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用系统代理
|
||||||
|
/// </summary>
|
||||||
|
public bool UsedProxy { get; private set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 过滤的进程
|
/// 过滤的进程
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -49,7 +56,12 @@ namespace BarrageGrab
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 端口号
|
/// 端口号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int WsProt { get; private set; }
|
public int WsProt { get; private set; } = 8888;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// true:监听在0.0.0.0,接受任意Ip连接,false:监听在127.0.0.1,仅接受本机连接
|
||||||
|
/// </summary>
|
||||||
|
public bool ListenAny { get; private set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 控制台打印消息开关
|
/// 控制台打印消息开关
|
||||||
|
|||||||
Reference in New Issue
Block a user