diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..b8a30f6 Binary files /dev/null and b/.DS_Store differ diff --git a/ElectronJS/.DS_Store b/ElectronJS/.DS_Store new file mode 100644 index 0000000..fa61b31 Binary files /dev/null and b/ElectronJS/.DS_Store differ diff --git a/ElectronJS/.gitignore b/ElectronJS/.gitignore index 2aacbb7..2e1be61 100644 --- a/ElectronJS/.gitignore +++ b/ElectronJS/.gitignore @@ -3,8 +3,9 @@ out/ chrome_win32/ chrome_win64/ chrome_linux64/ -chrome_macos/ +chrome_mac64.app/ +chromedriver_mac64 user-data/ user_data/ Data/ -execution_instances/* \ No newline at end of file +execution_instances/* diff --git a/ElectronJS/config.json b/ElectronJS/config.json index d7f6cab..78a2110 100644 --- a/ElectronJS/config.json +++ b/ElectronJS/config.json @@ -1 +1 @@ -{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","absolute_user_data_folder":"D:\\Documents\\Projects\\EasySpider\\ElectronJS\\user_data"} \ No newline at end of file +{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","absolute_user_data_folder":"/Users/naibowang/Documents/EasySpider/ElectronJS/user_data"} \ No newline at end of file diff --git a/ElectronJS/easyspider_executestage b/ElectronJS/easyspider_executestage new file mode 100755 index 0000000..33259c4 Binary files /dev/null and b/ElectronJS/easyspider_executestage differ diff --git a/ElectronJS/execute_macos.sh b/ElectronJS/execute_macos.sh new file mode 100755 index 0000000..4ce2ef6 --- /dev/null +++ b/ElectronJS/execute_macos.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./easyspider_executestage $1 $2 $3 $4 $5 $6 $7 $8 $9 diff --git a/ElectronJS/main.js b/ElectronJS/main.js index da00025..e0cfd9e 100644 --- a/ElectronJS/main.js +++ b/ElectronJS/main.js @@ -7,7 +7,6 @@ const chrome = require('selenium-webdriver/chrome'); const {ServiceBuilder} = require('selenium-webdriver/chrome'); const {rootCertificates} = require('tls'); const {exit} = require('process'); -const {windowManager} = require("node-window-manager"); const path = require('path'); const fs = require('fs'); const {exec} = require('child_process'); @@ -35,7 +34,7 @@ if (process.platform === 'win32' && process.arch === 'ia32') { } else if (process.platform === 'darwin') { driverPath = path.join(__dirname, "chromedriver_mac64"); chromeBinaryPath = path.join(__dirname, "chrome_mac64.app/Contents/MacOS/Google Chrome"); - execute_path = path.join(__dirname, "easyspider_executestage"); + execute_path = path.join(__dirname, "execute_macos.sh"); } else if (process.platform === 'linux') { driverPath = path.join(__dirname, "chrome_linux64/chromedriver_linux64"); chromeBinaryPath = path.join(__dirname, "chrome_linux64/chrome"); @@ -113,7 +112,8 @@ async function beginInvoke(msg) { console.log(window); // This method has to be called on macOS before changing the window's bounds, otherwise it will throw an error. // It will prompt an accessibility permission request dialog, if needed. - if (window != undefined) { + if(!process.platform == "linux" && !process.platform == "darwin"){ + const {windowManager} = require("node-window-manager"); windowManager.requestAccessibility(); // Sets the active window's bounds. let size = screen.getPrimaryDisplay().workAreaSize @@ -333,7 +333,9 @@ function handleOpenBrowser(event, lang = "en", user_data_folder = "") { } // and load the index.html of the app. flowchart_window.loadURL(url); - flowchart_window.hide(); + if(process.platform != "darwin"){ + flowchart_window.hide(); + } flowchart_window.on('close', function (event) { mainWindow.show(); driver.quit(); diff --git a/ElectronJS/package.json b/ElectronJS/package.json index 32702b6..3bc978b 100644 --- a/ElectronJS/package.json +++ b/ElectronJS/package.json @@ -62,7 +62,7 @@ "icon": "favicon.ico", "appVersion": "0.1.0", "name": "EasySpider", - "executableName":"easy-spider", + "executableName": "easy-spider", "appCopyright": "Naibo Wang (naibowang@foxmail.com)", "win32metadata": { "ProductName": "EasySpider", diff --git a/ElectronJS/tasks/34.json b/ElectronJS/tasks/34.json new file mode 100644 index 0000000..72f0129 --- /dev/null +++ b/ElectronJS/tasks/34.json @@ -0,0 +1 @@ +{"id":34,"name":"新web采adsf","url":"https://www.jd.com","links":"https://www.jd.com","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"},{"id":1,"name":"inputText_1","nodeName":"提取数据","nodeId":2,"desc":"要输入的文本,如京东搜索框输入:电脑","type":"string","exampleValue":"赛跟","value":"赛跟"}],"outputParameters":[],"graph":[{"index":0,"id":0,"parentId":0,"type":-1,"option":0,"title":"root","sequence":[1,2,3],"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,"url":"https://www.jd.com","links":"https://www.jd.com","scrollType":0,"scrollCount":0}},{"id":2,"index":2,"parentId":0,"type":0,"option":4,"title":"提取数据","sequence":[],"isInLoop":false,"position":1,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"//*[@id=\"key\"]","wait":0,"value":"赛跟"}},{"id":3,"index":3,"parentId":0,"type":0,"option":2,"title":"打开网页","sequence":[],"isInLoop":false,"position":2,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"//*[@id=\"search-btn\"]/i[1]","wait":0,"scrollType":0,"scrollCount":0,"paras":[]}}]} \ No newline at end of file diff --git a/ExecuteStage/.DS_Store b/ExecuteStage/.DS_Store new file mode 100644 index 0000000..77adf36 Binary files /dev/null and b/ExecuteStage/.DS_Store differ diff --git a/ExecuteStage/generateExecutable_Macos.sh b/ExecuteStage/generateExecutable_Macos.sh new file mode 100755 index 0000000..11fdf4e --- /dev/null +++ b/ExecuteStage/generateExecutable_Macos.sh @@ -0,0 +1,5 @@ +rm -r build +rm -r dist +pyinstaller -F --icon=favicon.ico easyspider_executestage.py +rm ../ElectronJS/chrome_mac64/easyspider_executestage +mv dist/easyspider_executestage ../ElectronJS/chrome_linux64/easyspider_executestage