Browse Source

add botOption for all bots

master
filesite 7 months ago
parent
commit
5b8aa16ca1
  1. 6
      bot/Bilibili.mjs
  2. 6
      bot/Douyin.mjs
  3. 7
      bot/HeroBot.mjs
  4. 6
      bot/Kuaishou.mjs
  5. 6
      bot/Xigua.mjs
  6. 4
      config.mjs

6
bot/Bilibili.mjs

@ -11,12 +11,10 @@ class Bilibili extends HeroBot { @@ -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;
}

6
bot/Douyin.mjs

@ -11,12 +11,10 @@ class Douyin extends HeroBot { @@ -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;
}

7
bot/HeroBot.mjs

@ -3,6 +3,7 @@ import fs from 'node:fs'; @@ -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 { @@ -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;
}

6
bot/Kuaishou.mjs

@ -11,12 +11,10 @@ class Kuaishou extends HeroBot { @@ -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;
}

6
bot/Xigua.mjs

@ -11,12 +11,10 @@ class Xigua extends HeroBot { @@ -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;
}

4
config.mjs

@ -32,10 +32,14 @@ let configs = { @@ -32,10 +32,14 @@ let configs = {
width: 1440,
height: 900
},
//可选项参考官方文档:https://ulixee.org/docs/hero/basic-client/hero
botOptions: {
showChrome: false,
showChromeInteractions: false,
showDevtools: false,
showChromeAlive: false,
},
viewports: {
mob: {

Loading…
Cancel
Save