octoparse-cli 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +271 -0
- package/RUNTIME_SECURITY_NOTICE.txt +41 -0
- package/SECURITY.md +24 -0
- package/dist/cli/args.js +34 -0
- package/dist/cli/help.js +214 -0
- package/dist/cli/output.js +39 -0
- package/dist/commands/auth.js +283 -0
- package/dist/commands/capabilities.js +118 -0
- package/dist/commands/cloud.js +241 -0
- package/dist/commands/data.js +220 -0
- package/dist/commands/doctor.js +73 -0
- package/dist/commands/env.js +63 -0
- package/dist/commands/local.js +251 -0
- package/dist/commands/run.js +622 -0
- package/dist/commands/runs.js +171 -0
- package/dist/commands/task.js +101 -0
- package/dist/index.js +133 -0
- package/dist/runtime/account-capabilities.js +71 -0
- package/dist/runtime/api-client.js +290 -0
- package/dist/runtime/artifacts.js +33 -0
- package/dist/runtime/auth.js +94 -0
- package/dist/runtime/bridge-hub.js +173 -0
- package/dist/runtime/client-headers.js +23 -0
- package/dist/runtime/cloud-data.js +75 -0
- package/dist/runtime/config.js +48 -0
- package/dist/runtime/data-exporter.js +267 -0
- package/dist/runtime/engine-host.js +449 -0
- package/dist/runtime/local-runs.js +92 -0
- package/dist/runtime/naming.js +13 -0
- package/dist/runtime/run-control.js +363 -0
- package/dist/runtime/run-services.js +380 -0
- package/dist/runtime/security-notice.js +78 -0
- package/dist/runtime/task-definition-provider.js +282 -0
- package/dist/types.js +4 -0
- package/examples/minimal-task.json +6 -0
- package/examples/navigate-example-task.json +6 -0
- package/node_modules/@octopus/bpmn/index.js +3 -0
- package/node_modules/@octopus/bpmn/lib/Context.js +245 -0
- package/node_modules/@octopus/bpmn/lib/Definition.js +258 -0
- package/node_modules/@octopus/bpmn/lib/Engine.js +275 -0
- package/node_modules/@octopus/bpmn/lib/PrematureStopError.js +7 -0
- package/node_modules/@octopus/bpmn/lib/activities/Activity.js +202 -0
- package/node_modules/@octopus/bpmn/lib/activities/BaseProcess.js +308 -0
- package/node_modules/@octopus/bpmn/lib/activities/BaseTask.js +145 -0
- package/node_modules/@octopus/bpmn/lib/activities/BoundaryEvent.js +12 -0
- package/node_modules/@octopus/bpmn/lib/activities/Dummy.js +10 -0
- package/node_modules/@octopus/bpmn/lib/activities/EventDefinition.js +99 -0
- package/node_modules/@octopus/bpmn/lib/activities/Flow.js +52 -0
- package/node_modules/@octopus/bpmn/lib/activities/Form.js +67 -0
- package/node_modules/@octopus/bpmn/lib/activities/InputOutput.js +53 -0
- package/node_modules/@octopus/bpmn/lib/activities/IntermediateCatchEvent.js +12 -0
- package/node_modules/@octopus/bpmn/lib/activities/MessageFlow.js +19 -0
- package/node_modules/@octopus/bpmn/lib/activities/MultiInstanceLoopCharacteristics.js +160 -0
- package/node_modules/@octopus/bpmn/lib/activities/Properties.js +27 -0
- package/node_modules/@octopus/bpmn/lib/activities/SequenceFlow.js +56 -0
- package/node_modules/@octopus/bpmn/lib/activities/ServiceConnector.js +71 -0
- package/node_modules/@octopus/bpmn/lib/context-helper.js +198 -0
- package/node_modules/@octopus/bpmn/lib/events/EndEvent.js +22 -0
- package/node_modules/@octopus/bpmn/lib/events/ErrorEvent.js +41 -0
- package/node_modules/@octopus/bpmn/lib/events/MessageEvent.js +19 -0
- package/node_modules/@octopus/bpmn/lib/events/StartEvent.js +55 -0
- package/node_modules/@octopus/bpmn/lib/events/TimerEvent.js +75 -0
- package/node_modules/@octopus/bpmn/lib/expressions.js +41 -0
- package/node_modules/@octopus/bpmn/lib/gateways/ExclusiveGateway.js +86 -0
- package/node_modules/@octopus/bpmn/lib/gateways/InclusiveGateway.js +56 -0
- package/node_modules/@octopus/bpmn/lib/gateways/ParallelGateway.js +195 -0
- package/node_modules/@octopus/bpmn/lib/getPropertyValue.js +83 -0
- package/node_modules/@octopus/bpmn/lib/index.js +6 -0
- package/node_modules/@octopus/bpmn/lib/mapper.js +55 -0
- package/node_modules/@octopus/bpmn/lib/parameter.js +119 -0
- package/node_modules/@octopus/bpmn/lib/script-helper.js +45 -0
- package/node_modules/@octopus/bpmn/lib/tasks/ManualTask.js +31 -0
- package/node_modules/@octopus/bpmn/lib/tasks/ReceiveTask.js +31 -0
- package/node_modules/@octopus/bpmn/lib/tasks/ScriptTask.js +35 -0
- package/node_modules/@octopus/bpmn/lib/tasks/SendTask.js +16 -0
- package/node_modules/@octopus/bpmn/lib/tasks/ServiceTask.js +68 -0
- package/node_modules/@octopus/bpmn/lib/tasks/SubProcess.js +17 -0
- package/node_modules/@octopus/bpmn/lib/tasks/Task.js +16 -0
- package/node_modules/@octopus/bpmn/lib/tasks/UserTask.js +47 -0
- package/node_modules/@octopus/bpmn/lib/transformer.js +13 -0
- package/node_modules/@octopus/bpmn/lib/validation.js +111 -0
- package/node_modules/@octopus/bpmn/package.json +17 -0
- package/node_modules/@octopus/bpmn/types/bpmn.d.ts +85 -0
- package/node_modules/@octopus/engine/README.md +370 -0
- package/node_modules/@octopus/engine/dist/actions/BackPreWebPageAction.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/actions/BackPreWebPageAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/BaseAction.d.ts +339 -0
- package/node_modules/@octopus/engine/dist/actions/BaseAction.js +1559 -0
- package/node_modules/@octopus/engine/dist/actions/BranchAction.d.ts +9 -0
- package/node_modules/@octopus/engine/dist/actions/BranchAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/ClickAction.d.ts +22 -0
- package/node_modules/@octopus/engine/dist/actions/ClickAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/ConditionAction.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/actions/ConditionAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/EmptyAction.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/actions/EmptyAction.js +12 -0
- package/node_modules/@octopus/engine/dist/actions/EnterCaptchaAction.d.ts +28 -0
- package/node_modules/@octopus/engine/dist/actions/EnterCaptchaAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/EnterTextAction.d.ts +20 -0
- package/node_modules/@octopus/engine/dist/actions/EnterTextAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/ExtractDataAction.d.ts +40 -0
- package/node_modules/@octopus/engine/dist/actions/ExtractDataAction.js +1 -0
- package/node_modules/@octopus/engine/dist/actions/LoopAction.d.ts +41 -0
- package/node_modules/@octopus/engine/dist/actions/LoopAction.js +526 -0
- package/node_modules/@octopus/engine/dist/actions/LoopStartAction.d.ts +47 -0
- package/node_modules/@octopus/engine/dist/actions/LoopStartAction.js +607 -0
- package/node_modules/@octopus/engine/dist/actions/MouseOverAction.d.ts +8 -0
- package/node_modules/@octopus/engine/dist/actions/MouseOverAction.js +34 -0
- package/node_modules/@octopus/engine/dist/actions/NavigateAction.d.ts +38 -0
- package/node_modules/@octopus/engine/dist/actions/NavigateAction.js +535 -0
- package/node_modules/@octopus/engine/dist/actions/SwitchComboAction.d.ts +13 -0
- package/node_modules/@octopus/engine/dist/actions/SwitchComboAction.js +69 -0
- package/node_modules/@octopus/engine/dist/browser.d.ts +17 -0
- package/node_modules/@octopus/engine/dist/browser.js +157 -0
- package/node_modules/@octopus/engine/dist/browserProxy.d.ts +90 -0
- package/node_modules/@octopus/engine/dist/browserProxy.js +1 -0
- package/node_modules/@octopus/engine/dist/configs/BaseConfig.d.ts +20 -0
- package/node_modules/@octopus/engine/dist/configs/BaseConfig.js +88 -0
- package/node_modules/@octopus/engine/dist/configs/BranchConfig.d.ts +7 -0
- package/node_modules/@octopus/engine/dist/configs/BranchConfig.js +1 -0
- package/node_modules/@octopus/engine/dist/configs/ClickConfig.d.ts +36 -0
- package/node_modules/@octopus/engine/dist/configs/ClickConfig.js +65 -0
- package/node_modules/@octopus/engine/dist/configs/EnterCaptchaConfig.d.ts +19 -0
- package/node_modules/@octopus/engine/dist/configs/EnterCaptchaConfig.js +25 -0
- package/node_modules/@octopus/engine/dist/configs/EnterTextConfig.d.ts +24 -0
- package/node_modules/@octopus/engine/dist/configs/EnterTextConfig.js +36 -0
- package/node_modules/@octopus/engine/dist/configs/ExtractDataConfig.d.ts +12 -0
- package/node_modules/@octopus/engine/dist/configs/ExtractDataConfig.js +1 -0
- package/node_modules/@octopus/engine/dist/configs/LoopConfig.d.ts +25 -0
- package/node_modules/@octopus/engine/dist/configs/LoopConfig.js +40 -0
- package/node_modules/@octopus/engine/dist/configs/LoopStartConfig.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/configs/LoopStartConfig.js +12 -0
- package/node_modules/@octopus/engine/dist/configs/MouseOverConfig.d.ts +8 -0
- package/node_modules/@octopus/engine/dist/configs/MouseOverConfig.js +15 -0
- package/node_modules/@octopus/engine/dist/configs/NavigateConfig.d.ts +41 -0
- package/node_modules/@octopus/engine/dist/configs/NavigateConfig.js +121 -0
- package/node_modules/@octopus/engine/dist/configs/SwitchComboConfig.d.ts +8 -0
- package/node_modules/@octopus/engine/dist/configs/SwitchComboConfig.js +15 -0
- package/node_modules/@octopus/engine/dist/enums/index.d.ts +419 -0
- package/node_modules/@octopus/engine/dist/enums/index.js +314 -0
- package/node_modules/@octopus/engine/dist/extension/BrowserWebSocketTransport-D_zAGZMQ.js +1 -0
- package/node_modules/@octopus/engine/dist/extension/LaunchOptions-DxvePrV4.js +6 -0
- package/node_modules/@octopus/engine/dist/extension/NodeWebSocketTransport-BTgRVB7Z.js +6 -0
- package/node_modules/@octopus/engine/dist/extension/background.js +396 -0
- package/node_modules/@octopus/engine/dist/extension/bidi-C_GIZ8Uz.js +131 -0
- package/node_modules/@octopus/engine/dist/extension/manifest.json +27 -0
- package/node_modules/@octopus/engine/dist/extension/src/content/anti-detection.js +1 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/BaseExtensionBridge.d.ts +21 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/BaseExtensionBridge.js +117 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/SessionExtensionBridge.d.ts +17 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/SessionExtensionBridge.js +29 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/index.d.ts +2 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/index.js +5 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/types.d.ts +159 -0
- package/node_modules/@octopus/engine/dist/extension-bridge/types.js +5 -0
- package/node_modules/@octopus/engine/dist/extensions/ublock-origin/uBlock0.chromium.tar.xz +0 -0
- package/node_modules/@octopus/engine/dist/extensions/ublock-origin-lite/uBOLite.chromium.tar.xz +0 -0
- package/node_modules/@octopus/engine/dist/index.d.ts +169 -0
- package/node_modules/@octopus/engine/dist/index.js +1 -0
- package/node_modules/@octopus/engine/dist/models/actionItem.d.ts +16 -0
- package/node_modules/@octopus/engine/dist/models/actionItem.js +15 -0
- package/node_modules/@octopus/engine/dist/models/conditionCheckArgs.d.ts +11 -0
- package/node_modules/@octopus/engine/dist/models/conditionCheckArgs.js +11 -0
- package/node_modules/@octopus/engine/dist/models/customizeCookie.d.ts +14 -0
- package/node_modules/@octopus/engine/dist/models/customizeCookie.js +6 -0
- package/node_modules/@octopus/engine/dist/models/downloadFileConfig.d.ts +17 -0
- package/node_modules/@octopus/engine/dist/models/downloadFileConfig.js +26 -0
- package/node_modules/@octopus/engine/dist/models/elementNotFoundArgs.d.ts +8 -0
- package/node_modules/@octopus/engine/dist/models/elementNotFoundArgs.js +12 -0
- package/node_modules/@octopus/engine/dist/models/elementNotFoundError.d.ts +2 -0
- package/node_modules/@octopus/engine/dist/models/elementNotFoundError.js +6 -0
- package/node_modules/@octopus/engine/dist/models/extractItem.d.ts +37 -0
- package/node_modules/@octopus/engine/dist/models/extractItem.js +35 -0
- package/node_modules/@octopus/engine/dist/models/extractTemplate.d.ts +11 -0
- package/node_modules/@octopus/engine/dist/models/extractTemplate.js +48 -0
- package/node_modules/@octopus/engine/dist/models/extractTextItem.d.ts +10 -0
- package/node_modules/@octopus/engine/dist/models/extractTextItem.js +17 -0
- package/node_modules/@octopus/engine/dist/models/globalConfig.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/models/globalConfig.js +1 -0
- package/node_modules/@octopus/engine/dist/models/httpHeader.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/models/httpHeader.js +10 -0
- package/node_modules/@octopus/engine/dist/models/operation.d.ts +27 -0
- package/node_modules/@octopus/engine/dist/models/operation.js +242 -0
- package/node_modules/@octopus/engine/dist/models/retryCondition.d.ts +7 -0
- package/node_modules/@octopus/engine/dist/models/retryCondition.js +10 -0
- package/node_modules/@octopus/engine/dist/models/task.d.ts +89 -0
- package/node_modules/@octopus/engine/dist/models/task.js +120 -0
- package/node_modules/@octopus/engine/dist/models/trigger.d.ts +66 -0
- package/node_modules/@octopus/engine/dist/models/trigger.js +117 -0
- package/node_modules/@octopus/engine/dist/package.json +26 -0
- package/node_modules/@octopus/engine/dist/public-types.d.ts +13 -0
- package/node_modules/@octopus/engine/dist/public-types.js +2 -0
- package/node_modules/@octopus/engine/dist/settings.d.ts +41 -0
- package/node_modules/@octopus/engine/dist/settings.js +20 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/ClickCaptchaSolver.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/ClickCaptchaSolver.js +1 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/HCaptchaSolver.d.ts +4 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/HCaptchaSolver.js +73 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/ImageCaptchaSolver.d.ts +2 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/ImageCaptchaSolver.js +74 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/RecaptchaSolver.d.ts +9 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/RecaptchaSolver.js +371 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/SliderCaptchaSolver.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/SliderCaptchaSolver.js +184 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/SlidingTrajectory.d.ts +50 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/SlidingTrajectory.js +125 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/types.d.ts +68 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/types.js +34 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/utils.d.ts +2 -0
- package/node_modules/@octopus/engine/dist/solvers/captcha/utils.js +15 -0
- package/node_modules/@octopus/engine/dist/translator/actionFactory.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/translator/actionFactory.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/activityTypeEnum.d.ts +22 -0
- package/node_modules/@octopus/engine/dist/translator/activityTypeEnum.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/backPreWebPageAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/backPreWebPageAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/baseAction.d.ts +31 -0
- package/node_modules/@octopus/engine/dist/translator/baseAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/breakActivity.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/breakActivity.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/clickAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/clickAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/completeWF.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/completeWF.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/conditionAction.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/translator/conditionAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/emptyAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/emptyAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/enterCapachaAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/enterCapachaAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/enterTextAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/enterTextAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/extractDataAction.d.ts +13 -0
- package/node_modules/@octopus/engine/dist/translator/extractDataAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/loopAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/loopAction.js +1 -0
- package/node_modules/@octopus/engine/dist/translator/mouseOverAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/mouseOverAction.js +19 -0
- package/node_modules/@octopus/engine/dist/translator/navigateAction.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/navigateAction.js +117 -0
- package/node_modules/@octopus/engine/dist/translator/rootAction.d.ts +6 -0
- package/node_modules/@octopus/engine/dist/translator/rootAction.js +80 -0
- package/node_modules/@octopus/engine/dist/translator/switchCombo2Action.d.ts +5 -0
- package/node_modules/@octopus/engine/dist/translator/switchCombo2Action.js +19 -0
- package/node_modules/@octopus/engine/dist/translator/translator.d.ts +1 -0
- package/node_modules/@octopus/engine/dist/translator/translator.js +36 -0
- package/node_modules/@octopus/engine/dist/type.d.ts +25 -0
- package/node_modules/@octopus/engine/dist/type.js +2 -0
- package/node_modules/@octopus/engine/dist/types/browser.d.ts +191 -0
- package/node_modules/@octopus/engine/dist/types/browser.js +1 -0
- package/node_modules/@octopus/engine/dist/types/browserManager.d.ts +41 -0
- package/node_modules/@octopus/engine/dist/types/browserManager.js +1 -0
- package/node_modules/@octopus/engine/dist/types/index.d.ts +40 -0
- package/node_modules/@octopus/engine/dist/types/index.js +2 -0
- package/node_modules/@octopus/engine/dist/types/plugin.d.ts +29 -0
- package/node_modules/@octopus/engine/dist/types/plugin.js +2 -0
- package/node_modules/@octopus/engine/dist/utils/AsyncEmitter.d.ts +15 -0
- package/node_modules/@octopus/engine/dist/utils/AsyncEmitter.js +1 -0
- package/node_modules/@octopus/engine/dist/utils/DataStore.d.ts +58 -0
- package/node_modules/@octopus/engine/dist/utils/DataStore.js +1 -0
- package/node_modules/@octopus/engine/dist/utils/DateTimeFormatHelper.d.ts +22 -0
- package/node_modules/@octopus/engine/dist/utils/DateTimeFormatHelper.js +173 -0
- package/node_modules/@octopus/engine/dist/utils/FileDownloader.d.ts +108 -0
- package/node_modules/@octopus/engine/dist/utils/FileDownloader.js +1 -0
- package/node_modules/@octopus/engine/dist/utils/HttpRequester.d.ts +43 -0
- package/node_modules/@octopus/engine/dist/utils/HttpRequester.js +174 -0
- package/node_modules/@octopus/engine/dist/utils/JsonParser.d.ts +95 -0
- package/node_modules/@octopus/engine/dist/utils/JsonParser.js +439 -0
- package/node_modules/@octopus/engine/dist/utils/Operations.d.ts +27 -0
- package/node_modules/@octopus/engine/dist/utils/Operations.js +115 -0
- package/node_modules/@octopus/engine/dist/utils/index.d.ts +28 -0
- package/node_modules/@octopus/engine/dist/utils/index.js +356 -0
- package/node_modules/@octopus/engine/package.json +58 -0
- package/package.json +79 -0
- package/schemas/capabilities-v1.schema.json +234 -0
- package/schemas/detached-bootstrap-v1.schema.json +42 -0
- package/schemas/json-envelope-v1.schema.json +39 -0
- package/schemas/run-event-v1.schema.json +47 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.cleanupChromeCache = cleanupChromeCache;
|
|
7
|
+
exports.resolveChrome = resolveChrome;
|
|
8
|
+
const browsers_1 = require("@puppeteer/browsers");
|
|
9
|
+
const node_child_process_1 = require("node:child_process");
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const os_1 = __importDefault(require("os"));
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const CHROME_BASE_URL_OP = 'https://client-resource.octoparse.com/chrome';
|
|
14
|
+
const CHROME_BASE_URL_CN = 'https://client-resource.bazhuayu.com/chrome';
|
|
15
|
+
const CACHE_ROOT_DIR = '.cache';
|
|
16
|
+
const CACHE_DIR_NAME = 'octorunner';
|
|
17
|
+
const DEFAULT_BUILD_ID = '147.0.7727.50';
|
|
18
|
+
const ARCH_ALIASES = {
|
|
19
|
+
amd64: 'x64',
|
|
20
|
+
x86_64: 'x64',
|
|
21
|
+
x64: 'x64',
|
|
22
|
+
aarch64: 'arm64',
|
|
23
|
+
arm64: 'arm64',
|
|
24
|
+
arm64e: 'arm64'
|
|
25
|
+
};
|
|
26
|
+
function normalizeArchitecture(arch) {
|
|
27
|
+
if (!arch)
|
|
28
|
+
return undefined;
|
|
29
|
+
const normalized = arch.trim().toLowerCase();
|
|
30
|
+
return ARCH_ALIASES[normalized] || normalized;
|
|
31
|
+
}
|
|
32
|
+
function runArchitectureCommand(command, args) {
|
|
33
|
+
const result = (0, node_child_process_1.spawnSync)(command, args, {
|
|
34
|
+
encoding: 'utf8',
|
|
35
|
+
timeout: 1000,
|
|
36
|
+
windowsHide: true
|
|
37
|
+
});
|
|
38
|
+
if (result.error || result.status !== 0) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const output = result.stdout.trim();
|
|
42
|
+
return output || undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 当前支持 win64、mac-arm64、mac-x64、linux-arm64、linux-x64。
|
|
46
|
+
* macOS / Linux 使用 `uname -m` 区分架构。
|
|
47
|
+
*/
|
|
48
|
+
function getSystemArchitecture() {
|
|
49
|
+
const architecture = normalizeArchitecture(runArchitectureCommand('uname', ['-m']));
|
|
50
|
+
return architecture === 'arm64' ? 'arm64' : 'x64';
|
|
51
|
+
}
|
|
52
|
+
function ensureCacheDir() {
|
|
53
|
+
const cacheDir = path_1.default.join(os_1.default.homedir(), CACHE_ROOT_DIR, CACHE_DIR_NAME);
|
|
54
|
+
if (!fs_1.default.existsSync(cacheDir)) {
|
|
55
|
+
fs_1.default.mkdirSync(cacheDir, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
return cacheDir;
|
|
58
|
+
}
|
|
59
|
+
function getDefaultBaseUrl() {
|
|
60
|
+
return process.env.IS_OP
|
|
61
|
+
? CHROME_BASE_URL_OP
|
|
62
|
+
: CHROME_BASE_URL_CN;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
** 检测浏览器平台补丁
|
|
66
|
+
* 当前仅映射 win64、mac-arm64、mac-x64、linux-arm64、linux-x64
|
|
67
|
+
*/
|
|
68
|
+
function detectBrowserPlatform() {
|
|
69
|
+
const platform = os_1.default.platform();
|
|
70
|
+
switch (platform) {
|
|
71
|
+
case 'darwin': {
|
|
72
|
+
const arch = getSystemArchitecture();
|
|
73
|
+
return arch === 'arm64' ? browsers_1.BrowserPlatform.MAC_ARM : browsers_1.BrowserPlatform.MAC;
|
|
74
|
+
}
|
|
75
|
+
case 'linux': {
|
|
76
|
+
const arch = getSystemArchitecture();
|
|
77
|
+
return arch === 'arm64'
|
|
78
|
+
? browsers_1.BrowserPlatform.LINUX_ARM
|
|
79
|
+
: browsers_1.BrowserPlatform.LINUX;
|
|
80
|
+
}
|
|
81
|
+
case 'win32':
|
|
82
|
+
return browsers_1.BrowserPlatform.WIN64;
|
|
83
|
+
default:
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function resolveInstallOptions(platform, installOptions) {
|
|
88
|
+
return {
|
|
89
|
+
browser: browsers_1.Browser.CHROME,
|
|
90
|
+
platform,
|
|
91
|
+
baseUrl: (installOptions === null || installOptions === void 0 ? void 0 : installOptions.baseUrl) || getDefaultBaseUrl(),
|
|
92
|
+
buildId: (installOptions === null || installOptions === void 0 ? void 0 : installOptions.buildId) || DEFAULT_BUILD_ID,
|
|
93
|
+
cacheDir: (installOptions === null || installOptions === void 0 ? void 0 : installOptions.cacheDir) || ensureCacheDir()
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
async function cleanupChromeCache(installOptions) {
|
|
97
|
+
const cacheDir = (installOptions === null || installOptions === void 0 ? void 0 : installOptions.cacheDir) || ensureCacheDir();
|
|
98
|
+
const currentBuildId = (installOptions === null || installOptions === void 0 ? void 0 : installOptions.buildId) || DEFAULT_BUILD_ID;
|
|
99
|
+
const cache = new browsers_1.Cache(cacheDir);
|
|
100
|
+
const installedBrowsers = cache.getInstalledBrowsers();
|
|
101
|
+
for (const browser of installedBrowsers) {
|
|
102
|
+
if (browser.browser !== browsers_1.Browser.CHROME || browser.buildId === currentBuildId) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
cache.uninstall(browser.browser, browser.platform, browser.buildId);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function resolveChrome(options) {
|
|
109
|
+
var _a, _b, _c, _d, _e;
|
|
110
|
+
const platform = detectBrowserPlatform();
|
|
111
|
+
if (!platform) {
|
|
112
|
+
throw new Error('暂不支持当前系统,仅支持 win64、mac-x64、mac-arm64、linux-x64、linux-arm64');
|
|
113
|
+
}
|
|
114
|
+
(_a = options === null || options === void 0 ? void 0 : options.onStatus) === null || _a === void 0 ? void 0 : _a.call(options, { state: 'checking', progress: 0 });
|
|
115
|
+
const chromeOptions = resolveInstallOptions(platform, options === null || options === void 0 ? void 0 : options.installOptions);
|
|
116
|
+
const executablePath = (0, browsers_1.computeExecutablePath)(chromeOptions);
|
|
117
|
+
if (fs_1.default.existsSync(executablePath)) {
|
|
118
|
+
(_b = options === null || options === void 0 ? void 0 : options.onStatus) === null || _b === void 0 ? void 0 : _b.call(options, { state: 'completed', progress: 100 });
|
|
119
|
+
return { executablePath };
|
|
120
|
+
}
|
|
121
|
+
const maxAttempts = 3;
|
|
122
|
+
let attempt = 0;
|
|
123
|
+
let lastError = null;
|
|
124
|
+
const cache = new browsers_1.Cache(chromeOptions.cacheDir);
|
|
125
|
+
const installationDir = cache.installationDir(chromeOptions.browser, chromeOptions.platform, chromeOptions.buildId);
|
|
126
|
+
do {
|
|
127
|
+
attempt += 1;
|
|
128
|
+
try {
|
|
129
|
+
const result = await (0, browsers_1.install)({
|
|
130
|
+
...chromeOptions,
|
|
131
|
+
downloadProgressCallback: (downloadedBytes, totalBytes) => {
|
|
132
|
+
var _a;
|
|
133
|
+
const progress = totalBytes > 0 ? (downloadedBytes / totalBytes) * 100 : 0;
|
|
134
|
+
(_a = options === null || options === void 0 ? void 0 : options.onStatus) === null || _a === void 0 ? void 0 : _a.call(options, {
|
|
135
|
+
state: 'downloading',
|
|
136
|
+
progress
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
unpack: true
|
|
140
|
+
});
|
|
141
|
+
(_c = options === null || options === void 0 ? void 0 : options.onStatus) === null || _c === void 0 ? void 0 : _c.call(options, { state: 'completed', progress: 100 });
|
|
142
|
+
return { executablePath: result.executablePath };
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
lastError = error;
|
|
146
|
+
fs_1.default.rmSync(installationDir, { recursive: true, force: true });
|
|
147
|
+
(_d = options === null || options === void 0 ? void 0 : options.onStatus) === null || _d === void 0 ? void 0 : _d.call(options, {
|
|
148
|
+
state: 'retrying',
|
|
149
|
+
progress: 0
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
} while (attempt < maxAttempts);
|
|
153
|
+
(_e = options === null || options === void 0 ? void 0 : options.onStatus) === null || _e === void 0 ? void 0 : _e.call(options, {
|
|
154
|
+
state: 'failed'
|
|
155
|
+
});
|
|
156
|
+
throw new Error(`Chrome 安装失败,已重试 ${maxAttempts} 次。最后一次错误: ${(lastError === null || lastError === void 0 ? void 0 : lastError.message) || 'unknown error'}`);
|
|
157
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { BrowserContext, Page, Target, type Handler } from 'puppeteer-core';
|
|
2
|
+
import { NavigateType } from './enums';
|
|
3
|
+
import type { ExtensionBridgeLike } from './extension-bridge';
|
|
4
|
+
import { CookiesRule } from './models/task';
|
|
5
|
+
import { BrokerSettings, WorkflowSetting } from './settings';
|
|
6
|
+
import JsonParser from './utils/JsonParser';
|
|
7
|
+
import { ProxyMessage } from './types';
|
|
8
|
+
interface BrowserProxyProps {
|
|
9
|
+
globalCookie?: string;
|
|
10
|
+
isSetGlobalCookie?: boolean;
|
|
11
|
+
cookiesRule?: CookiesRule;
|
|
12
|
+
workflowSetting?: WorkflowSetting;
|
|
13
|
+
userAgent?: string;
|
|
14
|
+
brokerSettings?: BrokerSettings;
|
|
15
|
+
downloadFolderPath?: string;
|
|
16
|
+
taskName?: string;
|
|
17
|
+
startTime?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class BrowserProxy {
|
|
20
|
+
#private;
|
|
21
|
+
currentTarget: Target;
|
|
22
|
+
globalCookie?: string;
|
|
23
|
+
isSetGlobalCookie?: boolean;
|
|
24
|
+
cookiesRule?: CookiesRule;
|
|
25
|
+
navigateType: NavigateType;
|
|
26
|
+
workflowSetting: WorkflowSetting;
|
|
27
|
+
userAgent: string;
|
|
28
|
+
brokerSettings: BrokerSettings;
|
|
29
|
+
isSetedProxy: boolean;
|
|
30
|
+
latestSetProxyTime: number;
|
|
31
|
+
isClearedCookie: boolean;
|
|
32
|
+
latestClearCookieTime: number;
|
|
33
|
+
shouldWait: boolean;
|
|
34
|
+
navigateURL: string;
|
|
35
|
+
pendingProxyRequest: Promise<any> | null;
|
|
36
|
+
jsonParser: JsonParser;
|
|
37
|
+
downloadFolderPath?: string;
|
|
38
|
+
taskName?: string;
|
|
39
|
+
startTime?: string;
|
|
40
|
+
threeFolderPath?: string;
|
|
41
|
+
timer: NodeJS.Timeout;
|
|
42
|
+
pageLoadStatus?: {
|
|
43
|
+
url: string;
|
|
44
|
+
statusCode?: number;
|
|
45
|
+
isLoadFailed: boolean;
|
|
46
|
+
timestamp: number;
|
|
47
|
+
error?: string;
|
|
48
|
+
};
|
|
49
|
+
private lastCheckTime;
|
|
50
|
+
/** 浏览器插件桥接(可选),用于通过 Extension 执行以避免焦点抢夺 */
|
|
51
|
+
extensionBridge?: ExtensionBridgeLike;
|
|
52
|
+
/** 记录当前代理IP的信息 */
|
|
53
|
+
proxyInfo: ProxyMessage;
|
|
54
|
+
/** 页面成功打开时是否已经上传过了代理IP日志 */
|
|
55
|
+
isUploadedProxyInfoOpenedPage: boolean;
|
|
56
|
+
constructor(context: BrowserContext, globalProps: BrowserProxyProps);
|
|
57
|
+
/**
|
|
58
|
+
* 定时清除cookie
|
|
59
|
+
* todo 代理IP是否优化放在这里,考虑是否会影响采集流程
|
|
60
|
+
*/
|
|
61
|
+
clearCookiesPeriodically(): Promise<void>;
|
|
62
|
+
switchTarget(target: Target): void;
|
|
63
|
+
onTargetChanged(handler: Handler<Target>): void;
|
|
64
|
+
onTargetCreated(handler: Handler<Target>): void;
|
|
65
|
+
onLoginOrCaptchaDetected(handler: (data: {
|
|
66
|
+
url: string;
|
|
67
|
+
hasLoginForm: boolean;
|
|
68
|
+
}) => void): void;
|
|
69
|
+
removeTargetChanged(handler: Handler<Target>): void;
|
|
70
|
+
removeTargetCreated(handler: Handler<Target>): void;
|
|
71
|
+
/**
|
|
72
|
+
* 过滤出正常的用户页面(排除扩展页面)
|
|
73
|
+
*/
|
|
74
|
+
private filterUserPages;
|
|
75
|
+
private isSamePageUrl;
|
|
76
|
+
bindExtensionTab(tabId: number, timeoutMs?: number): Promise<Page | undefined>;
|
|
77
|
+
resolveCurrentPage(): Promise<Page>;
|
|
78
|
+
resolveContext(): BrowserContext;
|
|
79
|
+
setNavigateType(val: NavigateType): void;
|
|
80
|
+
/**
|
|
81
|
+
* 页面完全加载后的回调
|
|
82
|
+
* 在每次页面 load 事件触发时调用
|
|
83
|
+
*/
|
|
84
|
+
private onPageFullyLoaded;
|
|
85
|
+
/**
|
|
86
|
+
* 检测指定页面是否存在登录表单或验证码
|
|
87
|
+
*/
|
|
88
|
+
private checkLoginCaptchaForPage;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var __createBinding=this&&this['__createBinding']||(Object['create']?function(_0x5a5c97,_0x13295f,_0x2ae670,_0x25b6b5){if(_0x25b6b5===undefined)_0x25b6b5=_0x2ae670;var _0xb5a9a5=Object['getOwnPropertyDescriptor'](_0x13295f,_0x2ae670);(!_0xb5a9a5||('get'in _0xb5a9a5?!_0x13295f['__esModule']:_0xb5a9a5['writable']||_0xb5a9a5['configurable']))&&(_0xb5a9a5={'enumerable':!![],'get':function(){return _0x13295f[_0x2ae670];}}),Object['defineProperty'](_0x5a5c97,_0x25b6b5,_0xb5a9a5);}:function(_0x3ebd75,_0x32355c,_0x3281eb,_0x2b5ed1){if(_0x2b5ed1===undefined)_0x2b5ed1=_0x3281eb;_0x3ebd75[_0x2b5ed1]=_0x32355c[_0x3281eb];}),__setModuleDefault=this&&this['__setModuleDefault']||(Object['create']?function(_0x4e1c30,_0x19abf1){Object['defineProperty'](_0x4e1c30,'default',{'enumerable':!![],'value':_0x19abf1});}:function(_0x20f68e,_0xd000c9){_0x20f68e['default']=_0xd000c9;}),__importStar=this&&this['__importStar']||(function(){var _0x4c84b1=function(_0x19a5a8){return _0x4c84b1=Object['getOwnPropertyNames']||function(_0x449f1a){var _0x56df1a=[];for(var _0x2f230f in _0x449f1a)if(Object['prototype']['hasOwnProperty']['call'](_0x449f1a,_0x2f230f))_0x56df1a[_0x56df1a['length']]=_0x2f230f;return _0x56df1a;},_0x4c84b1(_0x19a5a8);};return function(_0x2099bc){if(_0x2099bc&&_0x2099bc['__esModule'])return _0x2099bc;var _0x477082={};if(_0x2099bc!=null){for(var _0x5a88a6=_0x4c84b1(_0x2099bc),_0x245601=0x0;_0x245601<_0x5a88a6['length'];_0x245601++)if(_0x5a88a6[_0x245601]!=='default')__createBinding(_0x477082,_0x2099bc,_0x5a88a6[_0x245601]);}return __setModuleDefault(_0x477082,_0x2099bc),_0x477082;};}()),__classPrivateFieldSet=this&&this['__classPrivateFieldSet']||function(_0x2208a4,_0x6c084c,_0x2c6fdf,_0x494109,_0x4915cb){if(_0x494109==='m')throw new TypeError('Private\x20method\x20is\x20not\x20writable');if(_0x494109==='a'&&!_0x4915cb)throw new TypeError('Private\x20accessor\x20was\x20defined\x20without\x20a\x20setter');if(typeof _0x6c084c==='function'?_0x2208a4!==_0x6c084c||!_0x4915cb:!_0x6c084c['has'](_0x2208a4))throw new TypeError('Cannot\x20write\x20private\x20member\x20to\x20an\x20object\x20whose\x20class\x20did\x20not\x20declare\x20it');return _0x494109==='a'?_0x4915cb['call'](_0x2208a4,_0x2c6fdf):_0x4915cb?_0x4915cb['value']=_0x2c6fdf:_0x6c084c['set'](_0x2208a4,_0x2c6fdf),_0x2c6fdf;},__classPrivateFieldGet=this&&this['__classPrivateFieldGet']||function(_0x4a4656,_0x491c40,_0x3b4bf1,_0x56e3d5){if(_0x3b4bf1==='a'&&!_0x56e3d5)throw new TypeError('Private\x20accessor\x20was\x20defined\x20without\x20a\x20getter');if(typeof _0x491c40==='function'?_0x4a4656!==_0x491c40||!_0x56e3d5:!_0x491c40['has'](_0x4a4656))throw new TypeError('Cannot\x20read\x20private\x20member\x20from\x20an\x20object\x20whose\x20class\x20did\x20not\x20declare\x20it');return _0x3b4bf1==='m'?_0x56e3d5:_0x3b4bf1==='a'?_0x56e3d5['call'](_0x4a4656):_0x56e3d5?_0x56e3d5['value']:_0x491c40['get'](_0x4a4656);},__importDefault=this&&this['__importDefault']||function(_0x7a79ee){return _0x7a79ee&&_0x7a79ee['__esModule']?_0x7a79ee:{'default':_0x7a79ee};},_BrowserProxy_context,_BrowserProxy_event;Object['defineProperty'](exports,'__esModule',{'value':!![]}),exports['BrowserProxy']=void 0x0;const node_events_1=__importDefault(require('node:events')),path=__importStar(require('path')),fs=__importStar(require('fs')),enums_1=require('./enums'),task_1=require('./models/task'),settings_1=require('./settings'),JsonParser_1=__importDefault(require('./utils/JsonParser')),Operations_1=require('./utils/Operations'),index_1=require('./index');class BrowserProxy{constructor(_0x5a9713,_0x57537c){_BrowserProxy_context['set'](this,void 0x0),_BrowserProxy_event['set'](this,new node_events_1['default']()),this['cookiesRule']=new task_1['CookiesRule'](),this['navigateType']='None',this['workflowSetting']=new settings_1['WorkflowSetting'](),this['isSetedProxy']=![],this['latestSetProxyTime']=0x0,this['isClearedCookie']=![],this['latestClearCookieTime']=0x0,this['shouldWait']=!![],this['pendingProxyRequest']=null,this['lastCheckTime']=new Map(),this['isUploadedProxyInfoOpenedPage']=![];const {globalCookie:_0x42e17c,isSetGlobalCookie:_0x549b1c,workflowSetting:_0x408c58,userAgent:_0xc2e98a,brokerSettings:_0x37170d,downloadFolderPath:_0x17b5cd,taskName:_0x5058e7,startTime:_0x11a323}=_0x57537c;this['globalCookie']=_0x42e17c,this['isSetGlobalCookie']=_0x549b1c,__classPrivateFieldSet(this,_BrowserProxy_context,_0x5a9713,'f'),this['workflowSetting']=_0x408c58,this['userAgent']=_0xc2e98a,this['brokerSettings']=_0x37170d,this['downloadFolderPath']=_0x17b5cd,this['taskName']=_0x5058e7,this['startTime']=_0x11a323,this['jsonParser']=new JsonParser_1['default']();if(_0x17b5cd){const _0x473872=[_0x17b5cd];_0x5058e7&&_0x473872['push'](_0x5058e7),_0x11a323&&_0x473872['push'](_0x11a323),this['threeFolderPath']=path['join'](..._0x473872),!fs['existsSync'](this['threeFolderPath'])&&fs['mkdirSync'](this['threeFolderPath'],{'recursive':!![]});}__classPrivateFieldGet(this,_BrowserProxy_context,'f')['on']('targetchanged',_0x523fd6=>{this['switchTarget'](_0x523fd6),this['shouldWait']=!![],__classPrivateFieldGet(this,_BrowserProxy_event,'f')['emit']('targetchanged',_0x523fd6);}),__classPrivateFieldGet(this,_BrowserProxy_context,'f')['on']('targetcreated',async _0x3b9286=>{this['switchTarget'](_0x3b9286),this['shouldWait']=!![],__classPrivateFieldGet(this,_BrowserProxy_event,'f')['emit']('targetcreated',_0x3b9286);if(_0x3b9286['type']()==='page'){const _0x41bcef=await _0x3b9286['page']();_0x41bcef&&_0x41bcef['on']('domcontentloaded',async()=>{const _0x56e2e9=_0x41bcef['url'](),_0x1c2133=Date['now'](),_0xcaf483=this['lastCheckTime']['get'](_0x56e2e9)||0x0;if(_0x1c2133-_0xcaf483<0x2710){console['log']('防抖跳过检测\x20-\x20URL:',_0x56e2e9);return;}this['lastCheckTime']['set'](_0x56e2e9,_0x1c2133),await this['onPageFullyLoaded'](_0x41bcef);});}}),__classPrivateFieldGet(this,_BrowserProxy_context,'f')['on']('close',()=>{__classPrivateFieldGet(this,_BrowserProxy_event,'f')['removeAllListeners']();}),this['clearCookiesPeriodically']();}async['clearCookiesPeriodically'](){var _0x379949,_0x586886;const _0x52b510=((_0x586886=(_0x379949=this['brokerSettings'])===null||_0x379949===void 0x0?void 0x0:_0x379949['cookieClearSettings'])===null||_0x586886===void 0x0?void 0x0:_0x586886['customPeriod'])*0x3e8||0x0;if(this['brokerSettings']['cookieClearSettings']['clearType']===enums_1['CookieClearType']['None']||!__classPrivateFieldGet(this,_BrowserProxy_context,'f')||(_0x52b510||0x0)<=0x0)return;this['timer']&&clearInterval(this['timer']),this['timer']=setInterval(async()=>{const _0x480ebe=await __classPrivateFieldGet(this,_BrowserProxy_context,'f')['cookies']();_0x480ebe['length']!==0x0&&await __classPrivateFieldGet(this,_BrowserProxy_context,'f')['deleteCookie'](..._0x480ebe);},_0x52b510);}['switchTarget'](_0x21785d){(_0x21785d===null||_0x21785d===void 0x0?void 0x0:_0x21785d['type']())==='page'&&(this['currentTarget']=_0x21785d);}['onTargetChanged'](_0x1b5f4d){__classPrivateFieldGet(this,_BrowserProxy_event,'f')['on']('targetchanged',_0x1b5f4d);}['onTargetCreated'](_0x12f75b){__classPrivateFieldGet(this,_BrowserProxy_event,'f')['on']('targetcreated',_0x12f75b);}['onLoginOrCaptchaDetected'](_0x5645a7){__classPrivateFieldGet(this,_BrowserProxy_event,'f')['on'](index_1['WorkflowEvents']['LoginOrCaptchaDetected'],_0x5645a7);}['removeTargetChanged'](_0x13840c){__classPrivateFieldGet(this,_BrowserProxy_event,'f')['off']('targetchanged',_0x13840c);}['removeTargetCreated'](_0x12a839){__classPrivateFieldGet(this,_BrowserProxy_event,'f')['off']('targetcreated',_0x12a839);}async['filterUserPages'](_0x477600){const _0x4b4c21=[];for(const _0x4a44af of _0x477600){try{if(!_0x4a44af['isClosed']()){const _0x3b5414=_0x4a44af['url']();!_0x3b5414['startsWith']('chrome-extension://')&&!_0x3b5414['startsWith']('devtools://')&&_0x4b4c21['push'](_0x4a44af);}}catch(_0x4765e4){}}return _0x4b4c21;}['isSamePageUrl'](_0x1f0c3f,_0x16ff70){if(_0x1f0c3f===_0x16ff70)return!![];const _0x28b922=_0x1f0c3f['split']('#')[0x0],_0x52b7a9=_0x16ff70['split']('#')[0x0];if(_0x28b922===_0x52b7a9)return!![];try{const _0x37c452=new URL(_0x1f0c3f)['origin']+new URL(_0x1f0c3f)['pathname'],_0x4d1eab=new URL(_0x16ff70)['origin']+new URL(_0x16ff70)['pathname'];return _0x37c452===_0x4d1eab;}catch{return![];}}async['bindExtensionTab'](_0x2e259d,_0x42ac9b=0x1388){const _0x15389f=this['extensionBridge'];if(!_0x15389f)return undefined;console['log']('[Engine/BrowserProxy]\x20bindExtensionTab\x20start\x20tabId='+_0x2e259d+'\x20timeoutMs='+_0x42ac9b);const _0x3f6fe4=Date['now']();while(Date['now']()-_0x3f6fe4<_0x42ac9b){const _0x780d45=_0x15389f['getTabUrl'](_0x2e259d);if(_0x780d45&&_0x780d45!=='about:blank'){const _0x1a2a1a=await __classPrivateFieldGet(this,_BrowserProxy_context,'f')['pages'](),_0x45b361=await this['filterUserPages'](_0x1a2a1a),_0x3ee7b9=_0x45b361['find'](_0x2af3d8=>{try{return this['isSamePageUrl'](_0x2af3d8['url'](),_0x780d45);}catch{return![];}});if(_0x3ee7b9)return this['switchTarget'](_0x3ee7b9['target']()),this['shouldWait']=!![],console['log']('[Engine/BrowserProxy]\x20bindExtensionTab\x20adopted\x20tabId='+_0x2e259d+'\x20pageUrl='+_0x3ee7b9['url']()),_0x3ee7b9;}await new Promise(_0x576b34=>setTimeout(_0x576b34,0x64));}return console['log']('[Engine/BrowserProxy]\x20bindExtensionTab\x20missed\x20tabId='+_0x2e259d),undefined;}async['resolveCurrentPage'](){try{if(this['currentTarget']){const _0x2b1c3e=await this['currentTarget']['page']();if(_0x2b1c3e&&!_0x2b1c3e['isClosed']())return _0x2b1c3e;}const _0x24c1df=await __classPrivateFieldGet(this,_BrowserProxy_context,'f')['pages'](),_0x1b110a=await this['filterUserPages'](_0x24c1df);if(_0x1b110a['length']===0x1){const [,_0x31afbe]=await Promise['all']([new Promise(_0x5a4f3a=>{this['onTargetCreated'](()=>{_0x5a4f3a(!![]);});}),__classPrivateFieldGet(this,_BrowserProxy_context,'f')['newPage']()]);return _0x31afbe;}if(_0x1b110a['length']===0x0){const _0x58a8c3=await __classPrivateFieldGet(this,_BrowserProxy_context,'f')['newPage']();return _0x58a8c3;}const _0x448860=_0x1b110a[_0x1b110a['length']-0x1];return this['currentTarget']=_0x448860['target'](),_0x448860;}catch(_0x53d089){console['error']('❌\x20resolveCurrentPage失败:',_0x53d089);}}['resolveContext'](){return __classPrivateFieldGet(this,_BrowserProxy_context,'f');}['setNavigateType'](_0xbb9e9a){this['navigateType']=_0xbb9e9a;}async['onPageFullyLoaded'](_0x307c18){try{if(__classPrivateFieldGet(this,_BrowserProxy_event,'f')['listenerCount'](index_1['WorkflowEvents']['LoginOrCaptchaDetected'])===0x0)return;const _0x267f17=_0x307c18['url']();if(_0x267f17==='about:blank'||_0x267f17['startsWith']('chrome-extension://')||_0x267f17['startsWith']('devtools://'))return;await new Promise(_0x2972ba=>setTimeout(_0x2972ba,0x2710));const _0x506d05=await this['checkLoginCaptchaForPage'](_0x307c18);console['log']('检查登录表单或验证码结果:',_0x506d05),_0x506d05&&__classPrivateFieldGet(this,_BrowserProxy_event,'f')['emit'](index_1['WorkflowEvents']['LoginOrCaptchaDetected'],{'url':_0x267f17,'hasLoginOrCaptcha':_0x506d05});}catch(_0x89c783){console['error']('onPageFullyLoaded\x20error:',_0x89c783);}}async['checkLoginCaptchaForPage'](_0x3cefec){if(!_0x3cefec||_0x3cefec['isClosed']())return![];try{const _0x26d17b=await _0x3cefec['evaluate'](()=>{const _0x3ec147=_0x56ffa1=>{if(!_0x56ffa1)return![];const {display:_0x1b4c27,visibility:_0x2d1268,opacity:_0x7e9cbb}=getComputedStyle(_0x56ffa1);return _0x1b4c27!=='none'&&_0x2d1268!=='hidden'&&_0x2d1268!=='collapse'&&_0x7e9cbb!=='0'&&_0x56ffa1['offsetParent']!==null;},_0x5574f1=_0x1eaf7f=>{const _0x4d0f1b=Array['from'](_0x1eaf7f['getElementsByTagName']('form')),_0x20e757=_0x4d0f1b['filter'](_0x461494=>_0x3ec147(_0x461494)),_0x4e4f40=Array['from'](_0x1eaf7f['getElementsByTagName']('input')),_0x32adbc=_0x4e4f40['filter'](_0x18095e=>_0x3ec147(_0x18095e));for(const _0x114d0b of _0x20e757){const _0x490f34=/(?=.*(?:用户名|密码|手机号|邮箱|账号|获取验证码|短信验证码|验证码|注册|登录).*)(?=.*(?:用户名|密码|手机号|邮箱|账号|获取验证码|短信验证码|验证码|注册|登录).*)/;if(_0x490f34['test'](_0x114d0b['textContent']||''))return!![];const _0x569f51=/(?=.*(?:扫码登录|输入验证码|点击按钮进行验证|完成拼图验证|完成验证|点选文字验证|拖动滑块|填充拼图|安全验证|请完成下列验证后继续|按住左边按钮拖动完成上方拼图|依次点击文字).*)/;if(_0x569f51['test'](_0x114d0b['textContent']||''))return!![];}for(const _0x177912 of _0x32adbc){if(_0x177912['type']==='password')return!![];const _0x355c20=/(?=.*(?:手机号|用户名|账号|邮箱|验证码).*)/;if(_0x355c20['test'](_0x177912['placeholder']||''))return!![];}return![];};return _0x5574f1(document);});if(_0x26d17b)return!![];const _0x398576=_0x3cefec['frames']();for(const _0x37f435 of _0x398576){if(_0x37f435===_0x3cefec['mainFrame']())continue;try{const _0x3de6ce=await _0x37f435['evaluate'](()=>{const _0x1ea2f0=_0xe5f9f1=>{if(!_0xe5f9f1)return![];const {display:_0x318a68,visibility:_0xae17fc,opacity:_0x399b97}=getComputedStyle(_0xe5f9f1);return _0x318a68!=='none'&&_0xae17fc!=='hidden'&&_0xae17fc!=='collapse'&&_0x399b97!=='0'&&_0xe5f9f1['offsetParent']!==null;};if(window['location']['href']&&window['location']['href']['includes']('captcha'))return!![];const _0x53fdd1=Array['from'](document['getElementsByTagName']('form'));for(const _0x1f39ac of _0x53fdd1){if(!_0x1ea2f0(_0x1f39ac))continue;const _0x379fda=/(?=.*(?:用户名|密码|手机号|邮箱|账号|获取验证码|短信验证码|验证码|注册|登录).*)(?=.*(?:用户名|密码|手机号|邮箱|账号|获取验证码|短信验证码|验证码|注册|登录).*)/;if(_0x379fda['test'](_0x1f39ac['textContent']||''))return!![];const _0xbb8d6=/(?=.*(?:扫码登录|输入验证码|点击按钮进行验证|完成拼图验证|完成验证|点选文字验证|拖动滑块|填充拼图|安全验证|请完成下列验证后继续|按住左边按钮拖动完成上方拼图|依次点击文字).*)/;if(_0xbb8d6['test'](_0x1f39ac['textContent']||''))return!![];}const _0x5ff14a=Array['from'](document['getElementsByTagName']('input'));for(const _0x8294a3 of _0x5ff14a){if(!_0x1ea2f0(_0x8294a3))continue;if(_0x8294a3['type']==='password')return!![];const _0x1da6ca=/(?=.*(?:手机号|用户名|账号|邮箱|验证码).*)/;if(_0x1da6ca['test'](_0x8294a3['placeholder']||''))return!![];}return![];});if(_0x3de6ce)return!![];}catch(_0x5eb154){(0x0,Operations_1['isTransientContextError'])(_0x5eb154)&&console['warn']('checkLoginCaptchaForPage\x20transient\x20frame\x20context\x20error:',{'url':_0x3cefec['url'](),'error':_0x5eb154 instanceof Error?_0x5eb154['message']:String(_0x5eb154)});}}return![];}catch(_0x42673c){if((0x0,Operations_1['isTransientContextError'])(_0x42673c))return console['warn']('checkLoginCaptchaForPage\x20transient\x20context\x20error:',{'url':_0x3cefec['url'](),'error':_0x42673c instanceof Error?_0x42673c['message']:String(_0x42673c)}),![];return console['error']('checkLoginCaptchaForPage\x20error:',_0x42673c),![];}}}exports['BrowserProxy']=BrowserProxy,(_BrowserProxy_context=new WeakMap(),_BrowserProxy_event=new WeakMap());
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ActionItem } from '../models/actionItem';
|
|
2
|
+
export default class BaseConfig {
|
|
3
|
+
caption: string;
|
|
4
|
+
waitSeconds: number;
|
|
5
|
+
waitItem?: string;
|
|
6
|
+
useLoopItem: boolean;
|
|
7
|
+
loopItem?: any;
|
|
8
|
+
targetQueue?: string;
|
|
9
|
+
description: string;
|
|
10
|
+
isRandomWait: boolean;
|
|
11
|
+
pageIndex: number;
|
|
12
|
+
loopType?: string;
|
|
13
|
+
WaitAfterSeconds: number;
|
|
14
|
+
WaitAfterItem?: string;
|
|
15
|
+
IsRandomWaitAfter: boolean;
|
|
16
|
+
constructor(config: any);
|
|
17
|
+
getElementXPath(str?: string): ActionItem;
|
|
18
|
+
getInputElementXPaths(val?: string): Array<ActionItem> | [];
|
|
19
|
+
getEntityFromExtensionElements(tag: string, extensionElements: any, callback: any): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const actionItem_1 = require("../models/actionItem");
|
|
5
|
+
class BaseConfig {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.caption = config.Caption;
|
|
8
|
+
this.waitSeconds = parseInt(config.WaitSeconds) || 0;
|
|
9
|
+
this.waitItem = config.WaitItem;
|
|
10
|
+
this.useLoopItem = config.UseLoopItem == 'true';
|
|
11
|
+
this.targetQueue = config.TargetQueue;
|
|
12
|
+
this.description = config.Description;
|
|
13
|
+
this.isRandomWait = config.IsRandomWait == 'true';
|
|
14
|
+
this.pageIndex = parseInt(config.PageIndex);
|
|
15
|
+
this.loopType = config.loopType;
|
|
16
|
+
this.WaitAfterSeconds = parseInt(config.WaitAfterSeconds) || 0;
|
|
17
|
+
this.WaitAfterItem = config.WaitAfterItem;
|
|
18
|
+
this.IsRandomWaitAfter = config.IsRandomWaitAfter == 'true';
|
|
19
|
+
}
|
|
20
|
+
getElementXPath(str) {
|
|
21
|
+
const actionItem = new actionItem_1.ActionItem('', false);
|
|
22
|
+
str &&
|
|
23
|
+
(0, utils_1.parseXML)(str, (err, result) => {
|
|
24
|
+
if (!err) {
|
|
25
|
+
// 单个 ActionItem 的基础字段解析。
|
|
26
|
+
// 这里顺手兼容 InputMode,方便输入步骤直接从 XML 透传到运行时。
|
|
27
|
+
actionItem.AbsXpath = result.ActionItem.AbsXpath;
|
|
28
|
+
actionItem.IsIFrame = result.ActionItem.IsIFrame;
|
|
29
|
+
actionItem.IFrameAbsXPath = result.ActionItem.IFrameAbsXPath;
|
|
30
|
+
actionItem.ListXpath = result.ActionItem.ListXpath;
|
|
31
|
+
actionItem.SampleText = result.ActionItem.SampleText;
|
|
32
|
+
actionItem.InputMode = result.ActionItem.InputMode;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return actionItem;
|
|
36
|
+
}
|
|
37
|
+
getInputElementXPaths(val) {
|
|
38
|
+
if (val) {
|
|
39
|
+
let actionItems = [new actionItem_1.ActionItem('', false, '', '', '')];
|
|
40
|
+
(0, utils_1.parseXML)(val, (err, result) => {
|
|
41
|
+
if (err) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const { InputElementXPaths } = result;
|
|
45
|
+
if (InputElementXPaths) {
|
|
46
|
+
if (Array.isArray(InputElementXPaths.ElementXPath)) {
|
|
47
|
+
actionItems = InputElementXPaths.ElementXPath.map((el) => {
|
|
48
|
+
// XML 解析出来的布尔值/可选字段统一在这里做一次归一化,
|
|
49
|
+
// 避免 Action 层到处兼容字符串 true/false。
|
|
50
|
+
el.IsIFrame = el.IsIFrame === 'true';
|
|
51
|
+
el.IsPassword = el.IsPassword === 'true';
|
|
52
|
+
el.SampleText = el.SampleText || '';
|
|
53
|
+
el.ListXpath = el.ListXpath || '';
|
|
54
|
+
el.IFrameAbsXPath = el.IFrameAbsXPath || '';
|
|
55
|
+
return el;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
else if (InputElementXPaths.ElementXPath) {
|
|
59
|
+
// 单输入框场景和数组场景保持同样的字段归一化逻辑。
|
|
60
|
+
InputElementXPaths.ElementXPath.IsIFrame =
|
|
61
|
+
InputElementXPaths.ElementXPath.IsIFrame === 'true';
|
|
62
|
+
InputElementXPaths.ElementXPath.IsPassword =
|
|
63
|
+
InputElementXPaths.ElementXPath.IsPassword === 'true';
|
|
64
|
+
InputElementXPaths.ElementXPath.SampleText = InputElementXPaths.ElementXPath.SampleText || '';
|
|
65
|
+
InputElementXPaths.ElementXPath.ListXpath = InputElementXPaths.ElementXPath.ListXpath || '';
|
|
66
|
+
InputElementXPaths.ElementXPath.IFrameAbsXPath = InputElementXPaths.ElementXPath.IFrameAbsXPath || '';
|
|
67
|
+
actionItems = [InputElementXPaths.ElementXPath];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
return actionItems;
|
|
72
|
+
}
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
getEntityFromExtensionElements(tag, extensionElements, callback) {
|
|
76
|
+
if (extensionElements && extensionElements.values) {
|
|
77
|
+
for (const key in extensionElements.values) {
|
|
78
|
+
const items = extensionElements.values[key];
|
|
79
|
+
if (items.$type == tag && items.$children) {
|
|
80
|
+
for (const c of items.$children) {
|
|
81
|
+
callback.call(this, c);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.default = BaseConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var __importDefault=this&&this['__importDefault']||function(_0xdc1f26){return _0xdc1f26&&_0xdc1f26['__esModule']?_0xdc1f26:{'default':_0xdc1f26};};Object['defineProperty'](exports,'__esModule',{'value':!![]});const BaseConfig_1=__importDefault(require('./BaseConfig'));class BranchConfig extends BaseConfig_1['default']{constructor(_0x195c5e){super(_0x195c5e),this['checkType']=_0x195c5e['CheckType'],this['checkValue']=_0x195c5e['CheckValue'];}}exports['default']=BranchConfig;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ScrollScope, ScrollType } from '../enums';
|
|
2
|
+
import { ActionItem } from '../models/actionItem';
|
|
3
|
+
import { RetryCondition } from '../models/retryCondition';
|
|
4
|
+
import BaseConfig from './BaseConfig';
|
|
5
|
+
export default class ClickConfig extends BaseConfig {
|
|
6
|
+
elementXPath?: ActionItem;
|
|
7
|
+
ajaxLoad: boolean;
|
|
8
|
+
ajaxTimeout: number;
|
|
9
|
+
timeOut: number;
|
|
10
|
+
scrollDown: boolean;
|
|
11
|
+
scrollTime: number;
|
|
12
|
+
scrollInterval: number;
|
|
13
|
+
scrollIntervalUnit?: string;
|
|
14
|
+
scrollType: ScrollType;
|
|
15
|
+
scrollScope?: ScrollScope;
|
|
16
|
+
scrollXPath?: ActionItem;
|
|
17
|
+
IfStopScroll: boolean;
|
|
18
|
+
retryConditions: RetryCondition[];
|
|
19
|
+
maxRetry: number;
|
|
20
|
+
enableRetry: boolean;
|
|
21
|
+
timeInterval: number;
|
|
22
|
+
enableSwitchIp: boolean;
|
|
23
|
+
enableSwitchUserAgent: boolean;
|
|
24
|
+
clearCache: boolean;
|
|
25
|
+
autoRetry: boolean;
|
|
26
|
+
textContain?: string;
|
|
27
|
+
urlContain?: string;
|
|
28
|
+
textNotContain?: string;
|
|
29
|
+
iPType: number;
|
|
30
|
+
openInNewWindow: boolean;
|
|
31
|
+
openByHref: boolean;
|
|
32
|
+
locateAnchor: boolean;
|
|
33
|
+
anchorId: string;
|
|
34
|
+
userAgents: Array<string>;
|
|
35
|
+
constructor(config: any, extensionElements: any);
|
|
36
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const retryCondition_1 = require("../models/retryCondition");
|
|
7
|
+
const BaseConfig_1 = __importDefault(require("./BaseConfig"));
|
|
8
|
+
class ClickConfig extends BaseConfig_1.default {
|
|
9
|
+
constructor(config, extensionElements) {
|
|
10
|
+
super(config);
|
|
11
|
+
// 超时设置
|
|
12
|
+
this.timeOut = 120;
|
|
13
|
+
this.userAgents = [];
|
|
14
|
+
this.timeOut = parseInt(config.TimeOut);
|
|
15
|
+
this.ajaxLoad = config.AjaxLoad == 'true';
|
|
16
|
+
this.ajaxTimeout = parseInt(config.AjaxTimeout);
|
|
17
|
+
this.elementXPath = this.getElementXPath(config.ElementXPath);
|
|
18
|
+
this.scrollDown = config.ScrollDown == 'true';
|
|
19
|
+
this.scrollTime = parseInt(config.ScrollTime);
|
|
20
|
+
if (config.ScrollIntervalUnit == 'ms') {
|
|
21
|
+
this.scrollInterval = parseInt(config.ScrollInterval);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.scrollInterval = parseInt(config.ScrollInterval) * 1000;
|
|
25
|
+
}
|
|
26
|
+
this.scrollIntervalUnit = config.ScrollIntervalUnit;
|
|
27
|
+
this.scrollType = parseInt(config.ScrollType);
|
|
28
|
+
this.scrollScope = config.ScrollScope === '1' ? 1 /* ScrollScope.Local */ : 0 /* ScrollScope.AllDocument */;
|
|
29
|
+
if (this.scrollScope === 1 /* ScrollScope.Local */) {
|
|
30
|
+
this.scrollXPath = this.getElementXPath(config.ScrollXPath);
|
|
31
|
+
}
|
|
32
|
+
this.IfStopScroll = config.IfStopScroll === 'true';
|
|
33
|
+
// 读取重试配置
|
|
34
|
+
this.maxRetry = parseInt(config.MaxRetry);
|
|
35
|
+
this.enableRetry = config.EnableRetry == 'true';
|
|
36
|
+
this.timeInterval = parseInt(config.TimeInterval);
|
|
37
|
+
this.enableSwitchIp = config.EnableSwitchIp == 'true';
|
|
38
|
+
this.enableSwitchUserAgent = config.EnableSwitchUserAgent == 'true';
|
|
39
|
+
this.clearCache = config.ClearCache == 'true';
|
|
40
|
+
this.iPType = parseInt(config.IPType);
|
|
41
|
+
if (this.enableRetry) {
|
|
42
|
+
this.retryConditions = new Array();
|
|
43
|
+
this.getEntityFromExtensionElements("xml:ClickAction.RetryConditions" /* ActionTags.ClickActionRetryConditions */, extensionElements, (result) => {
|
|
44
|
+
const rc = new retryCondition_1.RetryCondition();
|
|
45
|
+
rc.conditionType = result.ConditionType;
|
|
46
|
+
rc.containsOrNot = result.ContainsOrNot == 'true';
|
|
47
|
+
rc.mainValue = result.MainValue;
|
|
48
|
+
rc.minorValue = result.MinorValue;
|
|
49
|
+
this.retryConditions[this.retryConditions.length] = rc;
|
|
50
|
+
});
|
|
51
|
+
this.getEntityFromExtensionElements("xml:ClickAction.UserAgents" /* ActionTags.ClickActionRetryUserAgent */, extensionElements, (result) => {
|
|
52
|
+
this.userAgents[this.userAgents.length] = result.userAgent;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
this.textContain = config.TextContain;
|
|
56
|
+
this.urlContain = config.UrlContain;
|
|
57
|
+
this.textNotContain = config.TextNotContain;
|
|
58
|
+
this.autoRetry = config.AutoRetry == 'true';
|
|
59
|
+
this.openInNewWindow = config.OpenInNewWindow == 'true';
|
|
60
|
+
this.openByHref = config.OpenByHref == 'true';
|
|
61
|
+
this.locateAnchor = config.LocateAnchor == 'true';
|
|
62
|
+
this.anchorId = config.AnchorId;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.default = ClickConfig;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CaptchaFailureElementType } from '../enums';
|
|
2
|
+
import { ActionItem } from '../models/actionItem';
|
|
3
|
+
import BaseConfig from './BaseConfig';
|
|
4
|
+
export default class EnterCaptchaConfig extends BaseConfig {
|
|
5
|
+
elementXPath?: ActionItem;
|
|
6
|
+
capachaType: number;
|
|
7
|
+
capachaFailureElementType: CaptchaFailureElementType;
|
|
8
|
+
ajaxLoad: boolean;
|
|
9
|
+
imageXPath?: ActionItem;
|
|
10
|
+
capachaMaxRetry: number;
|
|
11
|
+
inputXPath?: ActionItem;
|
|
12
|
+
failureText: string;
|
|
13
|
+
submitXPath?: ActionItem;
|
|
14
|
+
failureXPath?: ActionItem;
|
|
15
|
+
ajaxTimeout: number;
|
|
16
|
+
autoSubmit: boolean;
|
|
17
|
+
subImgXPath?: ActionItem;
|
|
18
|
+
constructor(config: any);
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseConfig_1 = __importDefault(require("./BaseConfig"));
|
|
7
|
+
class EnterCaptchaConfig extends BaseConfig_1.default {
|
|
8
|
+
constructor(config) {
|
|
9
|
+
super(config);
|
|
10
|
+
this.elementXPath = this.getElementXPath(config.ElementXPath);
|
|
11
|
+
this.capachaType = parseInt(config.CaptchaType);
|
|
12
|
+
this.capachaFailureElementType = config.CapachaFailureElementType;
|
|
13
|
+
this.ajaxLoad = config.AjaxLoad == 'true';
|
|
14
|
+
this.imageXPath = this.getElementXPath(config.ImageXPath);
|
|
15
|
+
this.capachaMaxRetry = parseInt(config.CapachaMaxRetry);
|
|
16
|
+
this.inputXPath = this.getElementXPath(config.InputXPath);
|
|
17
|
+
this.failureText = config.FailureText;
|
|
18
|
+
this.submitXPath = this.getElementXPath(config.SubmitXPath);
|
|
19
|
+
this.failureXPath = this.getElementXPath(config.FailureXPath);
|
|
20
|
+
this.ajaxTimeout = parseInt(config.AjaxTimeout);
|
|
21
|
+
this.autoSubmit = config.AutoSubmit == 'true';
|
|
22
|
+
this.subImgXPath = this.getElementXPath(config.SubImgXPath);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = EnterCaptchaConfig;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ScrollScope, ScrollType } from '../enums';
|
|
2
|
+
import { ActionItem } from '../models/actionItem';
|
|
3
|
+
import BaseConfig from './BaseConfig';
|
|
4
|
+
export default class EnterTextConfig extends BaseConfig {
|
|
5
|
+
elementXPath?: ActionItem;
|
|
6
|
+
inputElementXPaths?: ActionItem[];
|
|
7
|
+
/** 步骤级默认输入模式;单个输入框可再通过 ActionItem.InputMode 覆盖 */
|
|
8
|
+
inputMode?: 'native-setter' | 'fill' | 'type';
|
|
9
|
+
isPassword: boolean;
|
|
10
|
+
textToSet?: string;
|
|
11
|
+
autoSubmit: boolean;
|
|
12
|
+
autoSubmitTimeout: number;
|
|
13
|
+
ajaxLoad: boolean;
|
|
14
|
+
ajaxTimeout: number;
|
|
15
|
+
scrollDown: boolean;
|
|
16
|
+
scrollTime: number;
|
|
17
|
+
scrollInterval: number;
|
|
18
|
+
scrollIntervalUnit?: string;
|
|
19
|
+
scrollType: ScrollType;
|
|
20
|
+
scrollScope?: ScrollScope;
|
|
21
|
+
scrollXPath?: ActionItem;
|
|
22
|
+
IfStopScroll: boolean;
|
|
23
|
+
constructor(config: any);
|
|
24
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseConfig_1 = __importDefault(require("./BaseConfig"));
|
|
7
|
+
class EnterTextConfig extends BaseConfig_1.default {
|
|
8
|
+
constructor(config) {
|
|
9
|
+
super(config);
|
|
10
|
+
this.elementXPath = this.getElementXPath(config.ElementXPath);
|
|
11
|
+
this.inputElementXPaths = this.getInputElementXPaths(config.InputElementXPaths);
|
|
12
|
+
this.inputMode = config.InputMode;
|
|
13
|
+
this.isPassword = config.IsPassword == 'true';
|
|
14
|
+
this.textToSet = config.TextToSet;
|
|
15
|
+
this.autoSubmit = config.AutoSubmit == 'true';
|
|
16
|
+
this.autoSubmitTimeout = parseInt(config.AutoSubmitTimeout);
|
|
17
|
+
this.ajaxLoad = config.AjaxLoad == 'true';
|
|
18
|
+
this.ajaxTimeout = parseInt(config.AjaxTimeout);
|
|
19
|
+
this.scrollDown = config.ScrollDown == 'true';
|
|
20
|
+
this.scrollTime = parseInt(config.ScrollTime);
|
|
21
|
+
if (config.ScrollIntervalUnit == 'ms') {
|
|
22
|
+
this.scrollInterval = parseInt(config.ScrollInterval);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.scrollInterval = parseInt(config.ScrollInterval) * 1000;
|
|
26
|
+
}
|
|
27
|
+
this.scrollIntervalUnit = config.ScrollIntervalUnit;
|
|
28
|
+
this.scrollType = parseInt(config.ScrollType);
|
|
29
|
+
this.scrollScope = config.ScrollScope === '1' ? 1 /* ScrollScope.Local */ : 0 /* ScrollScope.AllDocument */;
|
|
30
|
+
if (this.scrollScope === 1 /* ScrollScope.Local */) {
|
|
31
|
+
this.scrollXPath = this.getElementXPath(config.ScrollXPath);
|
|
32
|
+
}
|
|
33
|
+
this.IfStopScroll = config.IfStopScroll === 'true';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.default = EnterTextConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ExtractItem } from '../models/extractItem';
|
|
2
|
+
import { Trigger } from '../models/trigger';
|
|
3
|
+
import BaseConfig from './BaseConfig';
|
|
4
|
+
export default class ExtractDataConfig extends BaseConfig {
|
|
5
|
+
url: string;
|
|
6
|
+
extractTriggerStatus: number;
|
|
7
|
+
filePath?: string;
|
|
8
|
+
extractTemplate: Array<ExtractItem>;
|
|
9
|
+
triggers: Array<Trigger>;
|
|
10
|
+
uniqueGroup: Array<string>;
|
|
11
|
+
constructor(config: any, extensionElements: any);
|
|
12
|
+
}
|