diff --git a/bot/Bilibili.mjs b/bot/Bilibili.mjs index 4201818..402a7b5 100644 --- a/bot/Bilibili.mjs +++ b/bot/Bilibili.mjs @@ -11,12 +11,10 @@ class Bilibili extends HeroBot { let options = { userAgent: configs.userAgent, viewport: configs.viewport, - showChrome: configs.showChrome, - showChromeInteractions: configs.showChromeInteractions, - showDevtools: configs.showDevtools, - showChromeAlive: configs.showChromeAlive, }; + options = common.mergeConfigs(configs.botOptions, options); + if (this.heroServer) { options.connectionToCore = this.heroServer; } diff --git a/bot/Douyin.mjs b/bot/Douyin.mjs index d9c36a7..e599c2c 100644 --- a/bot/Douyin.mjs +++ b/bot/Douyin.mjs @@ -11,12 +11,10 @@ class Douyin extends HeroBot { let options = { userAgent: configs.userAgent, viewport: configs.viewport, - showChrome: configs.showChrome, - showChromeInteractions: configs.showChromeInteractions, - showDevtools: configs.showDevtools, - showChromeAlive: configs.showChromeAlive, }; + options = common.mergeConfigs(configs.botOptions, options); + if (this.heroServer) { options.connectionToCore = this.heroServer; } diff --git a/bot/HeroBot.mjs b/bot/HeroBot.mjs index ba7a655..db12313 100644 --- a/bot/HeroBot.mjs +++ b/bot/HeroBot.mjs @@ -3,6 +3,7 @@ import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'url'; import ClientLogPlugin from '../plugin/ClientLogPlugin.mjs'; +import common from '../lib/common.mjs'; class HeroBot { constructor(heroCloudServer) { @@ -34,12 +35,10 @@ class HeroBot { let options = { userAgent: configs.userAgent, viewport: configs.viewport, - showChrome: configs.showChrome, - showChromeInteractions: configs.showChromeInteractions, - showDevtools: configs.showDevtools, - showChromeAlive: configs.showChromeAlive, }; + options = common.mergeConfigs(configs.botOptions, options); + if (this.heroServer) { options.connectionToCore = this.heroServer; } diff --git a/bot/Kuaishou.mjs b/bot/Kuaishou.mjs index e95bb46..397099b 100644 --- a/bot/Kuaishou.mjs +++ b/bot/Kuaishou.mjs @@ -11,12 +11,10 @@ class Kuaishou extends HeroBot { let options = { userAgent: configs.userAgent, viewport: configs.viewport, - showChrome: configs.showChrome, - showChromeInteractions: configs.showChromeInteractions, - showDevtools: configs.showDevtools, - showChromeAlive: configs.showChromeAlive, }; + options = common.mergeConfigs(configs.botOptions, options); + if (this.heroServer) { options.connectionToCore = this.heroServer; } diff --git a/bot/Xigua.mjs b/bot/Xigua.mjs index 1bc2f5b..aa4b9ed 100644 --- a/bot/Xigua.mjs +++ b/bot/Xigua.mjs @@ -11,12 +11,10 @@ class Xigua extends HeroBot { let options = { userAgent: configs.userAgent, viewport: configs.viewport, - showChrome: configs.showChrome, - showChromeInteractions: configs.showChromeInteractions, - showDevtools: configs.showDevtools, - showChromeAlive: configs.showChromeAlive, }; + options = common.mergeConfigs(configs.botOptions, options); + if (this.heroServer) { options.connectionToCore = this.heroServer; } diff --git a/config.mjs b/config.mjs index 8f42809..b3e2cb1 100644 --- a/config.mjs +++ b/config.mjs @@ -32,10 +32,14 @@ let configs = { width: 1440, height: 900 }, - showChrome: false, - showChromeInteractions: false, - showDevtools: false, - showChromeAlive: false, + + //可选项参考官方文档:https://ulixee.org/docs/hero/basic-client/hero + botOptions: { + showChrome: false, + showChromeInteractions: false, + showDevtools: false, + showChromeAlive: false, + }, viewports: { mob: {