mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-20 08:04:59 +08:00
MACOS version
This commit is contained in:
parent
f54ebcd74a
commit
79d0144e77
BIN
ElectronJS/.DS_Store
vendored
BIN
ElectronJS/.DS_Store
vendored
Binary file not shown.
@ -94,7 +94,7 @@ function createWindow() {
|
||||
}
|
||||
|
||||
|
||||
async function beginInvoke(msg) {
|
||||
async function beginInvoke(msg, ws) {
|
||||
if (msg.type == 1) {
|
||||
if (msg.message.id != -1) {
|
||||
let url = "";
|
||||
@ -220,6 +220,8 @@ async function beginInvoke(msg) {
|
||||
child_process.stdout.on('data', function (data) {
|
||||
console.log(data.toString());
|
||||
});
|
||||
} else {
|
||||
ws.send(task_server.getDir() + "/");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -265,7 +267,7 @@ wss.on('connection', function (ws) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
await beginInvoke(msg);
|
||||
await beginInvoke(msg, ws);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -3,12 +3,12 @@
|
||||
# This script is used to build.md the package for Linux 64-bit.
|
||||
rm -rf out
|
||||
rm -r ../Releases/EasySpider_MacOS_all_arch/EasySpider.app
|
||||
npm run package
|
||||
# unzip out/EasySpider-darwin-x64 -d ../Releases/EasySpider_MacOS_all_arch/
|
||||
mv out/EasySpider-darwin-x64/EasySpider.app ../Releases/EasySpider_MacOS_all_arch/
|
||||
npm run make
|
||||
unzip out/make/zip/darwin/x64/EasySpider-darwin-x64* -d ../Releases/EasySpider_MacOS_all_arch/
|
||||
# mv out/EasySpider-darwin-x64/EasySpider.app ../Releases/EasySpider_MacOS_all_arch/
|
||||
rm ../Releases/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/VS_BuildTools.exe
|
||||
rm -r ../Releases/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/chrome_win64
|
||||
# rm -r ../Releases/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/Data
|
||||
rm -r ../Releases/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/Data
|
||||
rm -r ../Releases/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/.idea
|
||||
# rm -r ../Releases/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/tasks
|
||||
# rm -r ../Releases/EasySpider_MacOS_all_arch/EasySpider.app/Contents/Resources/app/execution_instances
|
||||
|
@ -3,6 +3,7 @@ const querystring = require('querystring');
|
||||
const url = require('url');
|
||||
const fs = require('fs');
|
||||
const path=require('path');
|
||||
const {app, dialog} = require('electron');
|
||||
function travel(dir,callback){
|
||||
fs.readdirSync(dir).forEach((file)=>{
|
||||
const pathname=path.join(dir,file)
|
||||
@ -24,7 +25,7 @@ function compare(p){ //这是比较函数
|
||||
function getDir(){
|
||||
if(__dirname.indexOf("app") >= 0 && __dirname.indexOf("sources") >= 0){
|
||||
if(process.platform == "darwin"){
|
||||
return __dirname;
|
||||
return app.getPath("userData");
|
||||
} else {
|
||||
return path.join(__dirname,"../../..");
|
||||
}
|
||||
@ -32,6 +33,15 @@ function getDir(){
|
||||
return __dirname;
|
||||
}
|
||||
}
|
||||
if(!fs.existsSync(path.join(getDir(), "tasks"))){
|
||||
fs.mkdirSync(path.join(getDir(), "tasks"));
|
||||
}
|
||||
if(!fs.existsSync(path.join(getDir(), "execution_instances"))){
|
||||
fs.mkdirSync(path.join(getDir(), "execution_instances"));
|
||||
}
|
||||
if(!fs.existsSync(path.join(getDir(), "config.json"))){
|
||||
fs.writeFileSync(path.join(getDir(), "config.json"), JSON.stringify({"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","absolute_user_data_folder":""}));
|
||||
}
|
||||
|
||||
exports.getDir = getDir;
|
||||
FileMimes = JSON.parse(fs.readFileSync(path.join(__dirname,'mime.json')).toString());
|
||||
|
@ -50,7 +50,7 @@
|
||||
<input onkeydown="inputDelete(event)" id="serviceId" type="hidden" name="serviceId" value="-1"></input>
|
||||
<input onkeydown="inputDelete(event)" id="url" type="hidden" name="url" value="about:blank"></input>
|
||||
<label>{{"For MacOS, please open a terminal, go to EasySpider's folder, and then type the following command to run the task (EasySpider cannot quit when executing command):~对于MacOS系统,请在EasySpider目录下打开命令行工具Terminal,然后复制和运行以下命令以执行任务(执行命令时不能退出EasySpider):" | lang}}</label>
|
||||
<textarea class="form-control">{{command}}</textarea>
|
||||
<textarea class="form-control" style="height:150px">{{command}} --config_folder "{{config_folder}}"</textarea>
|
||||
</div>
|
||||
<!-- <div class="modal-footer">
|
||||
<button type="button" id="saveAsButton" class="btn btn-outline-primary">另存为</button>
|
||||
@ -152,7 +152,8 @@
|
||||
user_data_folder:"",
|
||||
with_user_data: true,
|
||||
backEndAddressServiceWrapper: getUrlParam("backEndAddressServiceWrapper"),
|
||||
command: "./easyspider_executestage "
|
||||
command: "./easyspider_executestage ",
|
||||
config_folder: "",
|
||||
}, mounted() {
|
||||
$.get(this.backEndAddressServiceWrapper + "/getConfig", function (result) {
|
||||
app.$data.user_data_folder = result.user_data_folder;
|
||||
@ -287,6 +288,9 @@
|
||||
};
|
||||
this.send(JSON.stringify(message));
|
||||
};
|
||||
ws.onmessage = function(message){
|
||||
app.$data.config_folder = message.data;
|
||||
}
|
||||
ws.onclose = function () {
|
||||
// 关闭 websocket
|
||||
console.log("连接已关闭...");
|
||||
|
@ -683,6 +683,7 @@ if __name__ == '__main__':
|
||||
"saved_file_name": "",
|
||||
"read_type": "remote",
|
||||
"user_data": False,
|
||||
"config_folder": ""
|
||||
}
|
||||
c = Config(config)
|
||||
print(c)
|
||||
@ -759,7 +760,7 @@ if __name__ == '__main__':
|
||||
# 3. 就算User Profile相同,chrome版本不同所存储的cookie信息也不同,也不能爬
|
||||
# 4. TMALL如果一直弹出验证码,而且无法通过验证,那么需要在其他浏览器上用
|
||||
if c.user_data:
|
||||
with open("config.json","r") as f:
|
||||
with open(c.config_folder + "config.json","r") as f:
|
||||
config = json.load(f)
|
||||
absolute_user_data_folder = config["absolute_user_data_folder"]
|
||||
print("\nAbsolute_user_data_folder:",absolute_user_data_folder,"\n")
|
||||
|
1
Releases/EasySpider_MacOS_all_arch/.gitignore
vendored
Normal file
1
Releases/EasySpider_MacOS_all_arch/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
easyspider_executestage
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
|
@ -0,0 +1,3 @@
|
||||
openPage
|
||||
Loading page: https://www.jd.com
|
||||
Done!
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1 @@
|
||||
|
|
@ -0,0 +1,3 @@
|
||||
openPage
|
||||
Loading page: https://www.jd.com
|
||||
Done!
|
Binary file not shown.
@ -2,7 +2,7 @@
|
||||
|
||||
文件访问权限必须给,麦克风权限完全用不到,作者也不清楚为什么会需要麦克风,因此可以拒绝。
|
||||
|
||||
可以从其他机器导入任务,只需要打开此目录的EasySpider软件右键“显示包内容”,然后把其他机器的tasks文件夹里的.json文件放入Contents/Resources/app/tasks文件夹里即可。同理执行号文件可以通过复制execution_instances文件夹中的.json文件来导入。注意,两个文件夹里的.json文件只支持命名为大于0的数字。
|
||||
可以从其他机器导入任务,只需要打开此目录的EasySpider软件右键“显示包内容”,然后把其他机器的tasks文件夹里的.json文件放入/Users/你的用户名/Library/Application Support/EasySpider/tasks文件夹里即可。同理执行号文件可以通过复制execution_instances文件夹中的.json文件来导入。注意,两个文件夹里的.json文件只支持命名为大于0的数字。
|
||||
|
||||
MacOS版本的软件有一个问题可能存在,即软件所调用的Chrome软件会在打开后经常性自动更新,但软件所依赖的Chromedriver版本并不会随着chrome自动更新,从而导致软件打不开chrome的问题。注意此版本的EasySpider使用的Chrome为111.0版本,如果使用过程中发现Chrome无法打开,请到Github Issues页面提issue,作者将会更新最新版本的软件供大家使用。
|
||||
|
||||
@ -19,7 +19,7 @@ https://github.com/NaiboWang/EasySpider/wiki/MacOS-Guide
|
||||
File access permissions must be granted, microphone permissions are not necessary at all, and the author is not sure why microphone permissions are being requested, so they can be declined.
|
||||
|
||||
|
||||
You can import tasks from other machines by simply opening the EasySpider software in this directory, right-clicking "Show Package Contents", and then placing the .json files from the tasks folder in the Contents/Resources/app/tasks folder of the other machine. Similarly, execution ID files can be imported by copying the .json files from the execution_instances folder. Please note that the .json files in both folders only support names greater than 0.
|
||||
You can import tasks from other machines by simply opening the EasySpider software in this directory, right-clicking "Show Package Contents", and then placing the .json files from the tasks folder in the /Users/your user name/Library/Application Support/EasySpider/tasks folder of the other machine. Similarly, execution ID files can be imported by copying the .json files from the execution_instances folder. Please note that the .json files in both folders only support names greater than 0.
|
||||
|
||||
There is a potential issue with the software for MacOS, in that the Chrome software called by the software often updates automatically after opening, but the version of Chromedriver that the software relies on does not update automatically with Chrome, leading to the problem of being unable to open Chrome. Note that the EasySpider version used for Chrome is 111.0. If Chrome cannot be opened during use, please report the issue on the GitHub Issues page, and the author will update the latest version of the software for everyone to use.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user