mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-19 23:14:54 +08:00
Debug when production
This commit is contained in:
parent
b6fb244837
commit
cbf48d4426
1
ElectronJS/.gitignore
vendored
1
ElectronJS/.gitignore
vendored
@ -12,4 +12,5 @@ Data/
|
||||
Chrome/
|
||||
execution_instances/*
|
||||
.DS_Store
|
||||
info.log
|
||||
npminstall-debug.log
|
||||
|
@ -1 +1,7 @@
|
||||
{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","absolute_user_data_folder":"D:\\Document\\Projects\\EasySpider\\ElectronJS\\user_data"}
|
||||
{
|
||||
"webserver_address": "http://localhost",
|
||||
"webserver_port": 8074,
|
||||
"user_data_folder": "./user_data",
|
||||
"debug": true,
|
||||
"absolute_user_data_folder": "D:\\Document\\Projects\\EasySpider\\ElectronJS\\user_data"
|
||||
}
|
||||
|
@ -11,9 +11,24 @@ const fs = require('fs');
|
||||
const {exec} = require('child_process');
|
||||
const iconPath = path.join(__dirname, 'favicon.ico');
|
||||
const task_server = require(path.join(__dirname, 'server.js'));
|
||||
const util = require('util');
|
||||
|
||||
let config = fs.readFileSync(path.join(task_server.getDir(), `config.json`), 'utf8');
|
||||
config = JSON.parse(config);
|
||||
|
||||
if(config.debug){
|
||||
let logPath = 'info.log'
|
||||
let logFile = fs.createWriteStream(logPath, { flags: 'a' })
|
||||
console.log = function() {
|
||||
logFile.write(util.format.apply(null, arguments) + '\n')
|
||||
process.stdout.write(util.format.apply(null, arguments) + '\n')
|
||||
}
|
||||
console.error = function() {
|
||||
logFile.write(util.format.apply(null, arguments) + '\n')
|
||||
process.stderr.write(util.format.apply(null, arguments) + '\n')
|
||||
}
|
||||
}
|
||||
|
||||
task_server.start(config.webserver_port); //start local server
|
||||
let server_address = `${config.webserver_address}:${config.webserver_port}`;
|
||||
const websocket_port = 8084; //目前只支持8084端口,写死,因为扩展里面写死了
|
||||
|
File diff suppressed because one or more lines are too long
1
ElectronJS/tasks/139.json
Normal file
1
ElectronJS/tasks/139.json
Normal file
@ -0,0 +1 @@
|
||||
{"id":139,"name":"京东全球版-专业的综合网上购物商城","url":"https://www.jd.com","links":"https://www.jd.com","create_time":"7/5/2023, 8:59:32 PM","version":"0.3.5","saveThreshold":10,"cloudflare":0,"environment":0,"containJudge":false,"desc":"https://www.jd.com","inputParameters":[{"id":0,"name":"urlList_0","nodeId":1,"nodeName":"打开网页","value":"https://www.jd.com","desc":"要采集的网址列表,多行以\\n分开","type":"string","exampleValue":"https://www.jd.com"}],"outputParameters":[],"graph":[{"index":0,"id":0,"parentId":0,"type":-1,"option":0,"title":"root","sequence":[1,2],"parameters":{"history":1,"tabIndex":0,"useLoop":false,"xpath":"","wait":0},"isInLoop":false},{"id":1,"index":1,"parentId":0,"type":0,"option":1,"title":"打开网页","sequence":[],"isInLoop":false,"position":0,"parameters":{"useLoop":false,"xpath":"","wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"url":"https://www.jd.com","links":"https://www.jd.com","maxWaitTime":10,"scrollType":0,"scrollCount":1,"scrollWaitTime":1}},{"id":2,"index":2,"parentId":0,"type":1,"option":8,"title":"循环","sequence":[3,4],"isInLoop":false,"position":1,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"/html/body/div[5]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div/a","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"loopType":1,"pathList":"","textList":"","code":"","waitTime":0,"exitCount":0,"historyWait":2,"breakMode":0,"breakCode":"","breakCodeWaitTime":0,"allXPaths":""}},{"id":3,"index":3,"parentId":2,"type":0,"option":2,"title":"点击元素","sequence":[],"isInLoop":true,"position":0,"parameters":{"history":4,"tabIndex":-1,"useLoop":true,"xpath":"/html/body/div[5]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div[1]/div/a","iframe":false,"wait":4,"waitType":0,"beforeJS":"arguments[0].innerText += \"类别\"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"clickWay":0,"maxWaitTime":10,"paras":[],"allXPaths":"","loopType":1}},{"id":4,"index":4,"parentId":2,"type":0,"option":5,"title":"自定义操作","sequence":[],"isInLoop":true,"position":1,"parameters":{"history":1,"tabIndex":0,"useLoop":false,"xpath":"","iframe":false,"wait":3,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"codeMode":0,"code":"document.body.innerText = \"1\"","waitTime":0,"recordASField":0}}]}
|
1
ElectronJS/tasks/140.json
Normal file
1
ElectronJS/tasks/140.json
Normal file
File diff suppressed because one or more lines are too long
2
ExecuteStage/.vscode/launch.json
vendored
2
ExecuteStage/.vscode/launch.json
vendored
@ -10,7 +10,7 @@
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": true,
|
||||
"args": ["--id", "[95]", "--read_type", "remote", "--headless", "0"]
|
||||
"args": ["--id", "[1]", "--read_type", "remote", "--headless", "0"]
|
||||
// "args": ["--id", "[2]", "--read_type", "remote", "--headless", "0", "--saved_file_name", "YOUTUBE"]
|
||||
// "args": ["--id", "[44]", "--headless", "0", "--user_data", "1"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user