diff --git a/ElectronJS/config.json b/ElectronJS/config.json index cf29ca4..4cc4016 100644 --- a/ElectronJS/config.json +++ b/ElectronJS/config.json @@ -1 +1 @@ -{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","debug":false,"mysql_config_path":"./mysql_config.json","absolute_user_data_folder":"D:\\Document\\Projects\\EasySpider\\ElectronJS\\user_data"} \ No newline at end of file +{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","debug":false,"mysql_config_path":"./mysql_config.json","absolute_user_data_folder":"D:\\Documents\\Projects\\EasySpider\\ElectronJS\\user_data"} \ No newline at end of file diff --git a/ElectronJS/src/taskGrid/FlowChart_CN.html b/ElectronJS/src/taskGrid/FlowChart_CN.html index 7d17ba7..49e95c0 100644 --- a/ElectronJS/src/taskGrid/FlowChart_CN.html +++ b/ElectronJS/src/taskGrid/FlowChart_CN.html @@ -543,8 +543,8 @@ diff --git a/ElectronJS/src/taskGrid/FlowChart_CN.js b/ElectronJS/src/taskGrid/FlowChart_CN.js index d4ba72e..bc4fb04 100644 --- a/ElectronJS/src/taskGrid/FlowChart_CN.js +++ b/ElectronJS/src/taskGrid/FlowChart_CN.js @@ -14,6 +14,7 @@ let root = { useLoop: false, //是否使用循环中的元素 xpath: "", //xpath wait: 0, + waitType: 0, }, isInLoop: false, //是否处于循环内 }; diff --git a/ElectronJS/src/taskGrid/invokeTask.html b/ElectronJS/src/taskGrid/invokeTask.html index 9305bf4..52d70e3 100644 --- a/ElectronJS/src/taskGrid/invokeTask.html +++ b/ElectronJS/src/taskGrid/invokeTask.html @@ -209,7 +209,7 @@
- +
diff --git a/ElectronJS/tasks/4.json b/ElectronJS/tasks/4.json index b591156..ce5d9dd 100644 --- a/ElectronJS/tasks/4.json +++ b/ElectronJS/tasks/4.json @@ -1 +1 @@ -{"id":4,"name":"中国地震台网——历史查询","url":"http://www.ceic.ac.cn/history\t","links":"http://www.ceic.ac.cn/history\t","create_time":"7/7/2023, 6:52:43 AM","version":"0.3.5","saveThreshold":10,"cloudflare":0,"environment":0,"maxViewLength":15,"outputFormat":"mysql","saveName":"Time","containJudge":false,"desc":"http://www.ceic.ac.cn/history\t","inputParameters":[{"id":0,"name":"urlList_0","nodeId":1,"nodeName":"打开网页","value":"http://www.ceic.ac.cn/history\t","desc":"要采集的网址列表,多行以\\n分开","type":"text","exampleValue":"http://www.ceic.ac.cn/history\t"},{"id":1,"name":"inputText_1","nodeName":"输入文字","nodeId":3,"desc":"要输入的文本,如京东搜索框输入:电脑","type":"text","exampleValue":"12","value":"12"},{"id":2,"name":"loopTimes_循环_2","nodeId":5,"nodeName":"循环","desc":"循环循环执行的次数(0代表无限循环)","type":"int","exampleValue":0,"value":0}],"outputParameters":[{"id":0,"name":"参数2_文本","desc":"","type":"double","exampleValue":"3.3"},{"id":1,"name":"参数3_文本","desc":"","type":"datetime","exampleValue":"2023-06-2509:16:14"},{"id":2,"name":"参数4_文本","desc":"","type":"double","exampleValue":"37.56"},{"id":3,"name":"参数5_文本","desc":"","type":"text","exampleValue":"77.91"},{"id":4,"name":"参数6_文本","desc":"","type":"int","exampleValue":"20"},{"id":5,"name":"参数7_链接文本","desc":"","type":"varchar","exampleValue":"新疆和田地区皮山县"},{"id":6,"name":"参数8_链接地址","desc":"","type":"mediumText","exampleValue":"https://news.ceic.ac.cn/CD20230625091615.html"}],"graph":[{"index":0,"id":0,"parentId":0,"type":-1,"option":0,"title":"root","sequence":[1,3,4,5],"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":"http://www.ceic.ac.cn/history\t","links":"http://www.ceic.ac.cn/history\t","maxWaitTime":10,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"cookies":""}},{"id":-1,"index":2,"parentId":0,"type":0,"option":3,"title":"提取数据","sequence":[],"isInLoop":false,"position":1,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"paras":[{"nodeType":0,"contentType":0,"relative":false,"name":"参数1_文本","desc":"","extractType":0,"relativeXPath":"/html/body/div[1]/div[3]/div[1]/div[1]/div[1]/form[1]/div[1]/label[1]","allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[1]/form[1]/div[1]/label[1]","//label[contains(., '时间:')]","/html/body/div[last()-3]/div[last()-1]/div/div/div[last()-1]/form/div[last()-4]/label"],"exampleValues":[{"num":0,"value":"时间:"}],"unique_index":"z6h1qs129cljrktxax","iframe":false,"default":"","paraType":"text","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0}]}},{"id":2,"index":3,"parentId":0,"type":0,"option":4,"title":"输入文字","sequence":[],"isInLoop":false,"position":1,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"//*[@id=\"weidu1\"]","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"value":"12","allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[1]/form[1]/div[2]/input[1]","//input[contains(., '')]","id(\"weidu1\")","//INPUT[@class='span1']","//INPUT[@name='weidu1']","/html/body/div[last()-3]/div[last()-1]/div/div/div[last()-1]/form/div[last()-3]/input[last()-1]"]}},{"id":3,"index":4,"parentId":0,"type":0,"option":2,"title":"点击元素","sequence":[],"isInLoop":false,"position":2,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"//*[@id=\"search\"]","iframe":false,"wait":2,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"clickWay":0,"maxWaitTime":10,"paras":[],"allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[1]/form[1]/div[5]/a[1]","//a[contains(., '查询')]","id(\"search\")","//A[@class='check']","/html/body/div[last()-3]/div[last()-1]/div/div/div[last()-1]/form/div/a"]}},{"id":4,"index":5,"parentId":0,"type":1,"option":8,"title":"循环","sequence":[7,6],"isInLoop":false,"position":3,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"//*[contains(@class, \"pagination\")]/ul[1]/li[last()-1]/a[1]","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"loopType":0,"pathList":"","textList":"","code":"","waitTime":0,"exitCount":0,"historyWait":2,"breakMode":0,"breakCode":"","breakCodeWaitTime":0,"allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/ul[1]/li[10]/a[1]","//a[contains(., '»')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div/div/div/ul/li[last()-1]/a"]}},{"id":6,"index":6,"parentId":4,"type":0,"option":2,"title":"点击元素","sequence":[],"isInLoop":true,"position":1,"parameters":{"history":4,"tabIndex":-1,"useLoop":true,"xpath":"//*[contains(@class, \"pagination\")]/ul[1]/li[10]/a[1]","iframe":false,"wait":2,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"clickWay":0,"maxWaitTime":10,"paras":[],"allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/ul[1]/li[10]/a[1]","//a[contains(., '»')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div/div/div/ul/li[last()-1]/a"],"loopType":0}},{"id":5,"index":7,"parentId":4,"type":1,"option":8,"title":"循环","sequence":[8],"isInLoop":true,"position":0,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"loopType":2,"pathList":"//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[2]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[3]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[4]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[5]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[6]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[7]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[8]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[9]\n//*[contains(@class, \"tr-red\")]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[11]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[12]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[13]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[14]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[15]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[16]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[17]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[18]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[19]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[20]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[21]","textList":"","code":"","waitTime":0,"exitCount":0,"historyWait":2,"breakMode":0,"breakCode":"","breakCodeWaitTime":0,"allXPaths":""}},{"id":7,"index":8,"parentId":5,"type":0,"option":3,"title":"提取数据","sequence":[],"isInLoop":true,"position":0,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"paras":[{"nodeType":0,"contentType":1,"relative":true,"name":"参数2_文本","desc":"","relativeXPath":"/td[1]","allXPaths":["/td[1]","//td[contains(., '3.3')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-5]"],"exampleValues":[{"num":0,"value":"3.3"}],"unique_index":"/td[1]","iframe":false,"default":"","paraType":"double","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":0,"contentType":1,"relative":true,"name":"参数3_文本","desc":"","relativeXPath":"/td[2]","allXPaths":["/td[2]","//td[contains(., '2023-06-25')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-4]"],"exampleValues":[{"num":0,"value":"2023-06-2509:16:14"}],"unique_index":"/td[2]","iframe":false,"default":"","paraType":"datetime","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":0,"contentType":1,"relative":true,"name":"参数4_文本","desc":"","relativeXPath":"/td[3]","allXPaths":["/td[3]","//td[contains(., '37.56')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-3]"],"exampleValues":[{"num":0,"value":"37.56"}],"unique_index":"/td[3]","iframe":false,"default":"","paraType":"double","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":0,"contentType":1,"relative":true,"name":"参数5_文本","desc":"","relativeXPath":"/td[4]","allXPaths":["/td[4]","//td[contains(., '77.91')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-2]"],"exampleValues":[{"num":0,"value":"77.91"}],"unique_index":"/td[4]","iframe":false,"default":"","paraType":"text","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":0,"contentType":1,"relative":true,"name":"参数6_文本","desc":"","relativeXPath":"/td[5]","allXPaths":["/td[5]","//td[contains(., '20')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-1]"],"exampleValues":[{"num":0,"value":"20"}],"unique_index":"/td[5]","iframe":false,"default":"","paraType":"int","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":1,"contentType":0,"relative":true,"name":"参数7_链接文本","desc":"","relativeXPath":"/td[6]/a[1]","allXPaths":["/td[6]/a[1]","//a[contains(., '新疆和田地区皮山县')]","id(\"cid\")","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td/a"],"exampleValues":[{"num":0,"value":"新疆和田地区皮山县"}],"unique_index":"/td[6]/a[1]","iframe":false,"default":"","paraType":"varchar","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":2,"contentType":0,"relative":true,"name":"参数8_链接地址","desc":"","relativeXPath":"/td[6]/a[1]","allXPaths":["/td[6]/a[1]","//a[contains(., '新疆和田地区皮山县')]","id(\"cid\")","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td/a"],"exampleValues":[{"num":0,"value":"https://news.ceic.ac.cn/CD20230625091615.html"}],"unique_index":"/td[6]/a[1]","iframe":false,"default":"","paraType":"mediumText","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0}],"loopType":2}},{"id":-1,"index":9,"parentId":0,"type":0,"option":5,"title":"自定义操作","sequence":[],"isInLoop":false,"position":3,"parameters":{"history":1,"tabIndex":0,"useLoop":false,"xpath":"","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"codeMode":0,"code":"return window.innerHeight","waitTime":0,"recordASField":"1","paraType":"int"}}]} \ No newline at end of file +{"id":4,"name":"中国地震台网——历史查询","url":"http://www.ceic.ac.cn/history\t","links":"http://www.ceic.ac.cn/history\t","create_time":"7/7/2023, 7:08:34 AM","version":"0.3.5","saveThreshold":10,"cloudflare":0,"environment":0,"maxViewLength":15,"outputFormat":"mysql","saveName":"Time","containJudge":false,"desc":"http://www.ceic.ac.cn/history\t","inputParameters":[{"id":0,"name":"urlList_0","nodeId":1,"nodeName":"打开网页","value":"http://www.ceic.ac.cn/history\t","desc":"要采集的网址列表,多行以\\n分开","type":"text","exampleValue":"http://www.ceic.ac.cn/history\t"},{"id":1,"name":"inputText_1","nodeName":"输入文字","nodeId":3,"desc":"要输入的文本,如京东搜索框输入:电脑","type":"text","exampleValue":"12","value":"12"},{"id":2,"name":"loopTimes_循环_2","nodeId":5,"nodeName":"循环","desc":"循环循环执行的次数(0代表无限循环)","type":"int","exampleValue":2,"value":2}],"outputParameters":[{"id":0,"name":"震级","desc":"","type":"double","exampleValue":"3.3"},{"id":1,"name":"时间","desc":"","type":"datetime","exampleValue":"2023-06-2509:16:14"},{"id":2,"name":"参数4_文本","desc":"","type":"double","exampleValue":"37.56"},{"id":3,"name":"参数5_文本","desc":"","type":"text","exampleValue":"77.91"},{"id":4,"name":"参数6_文本","desc":"","type":"int","exampleValue":"20"},{"id":5,"name":"参数7_链接文本","desc":"","type":"varchar","exampleValue":"新疆和田地区皮山县"},{"id":6,"name":"参数8_链接地址","desc":"","type":"mediumText","exampleValue":"https://news.ceic.ac.cn/CD20230625091615.html"}],"graph":[{"index":0,"id":0,"parentId":0,"type":-1,"option":0,"title":"root","sequence":[1,3,4,5],"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":"http://www.ceic.ac.cn/history\t","links":"http://www.ceic.ac.cn/history\t","maxWaitTime":10,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"cookies":""}},{"id":-1,"index":2,"parentId":0,"type":0,"option":3,"title":"提取数据","sequence":[],"isInLoop":false,"position":1,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"paras":[{"nodeType":0,"contentType":0,"relative":false,"name":"参数1_文本","desc":"","extractType":0,"relativeXPath":"/html/body/div[1]/div[3]/div[1]/div[1]/div[1]/form[1]/div[1]/label[1]","allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[1]/form[1]/div[1]/label[1]","//label[contains(., '时间:')]","/html/body/div[last()-3]/div[last()-1]/div/div/div[last()-1]/form/div[last()-4]/label"],"exampleValues":[{"num":0,"value":"时间:"}],"unique_index":"z6h1qs129cljrktxax","iframe":false,"default":"","paraType":"text","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0}]}},{"id":2,"index":3,"parentId":0,"type":0,"option":4,"title":"输入文字","sequence":[],"isInLoop":false,"position":1,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"//*[@id=\"weidu1\"]","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"value":"12","allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[1]/form[1]/div[2]/input[1]","//input[contains(., '')]","id(\"weidu1\")","//INPUT[@class='span1']","//INPUT[@name='weidu1']","/html/body/div[last()-3]/div[last()-1]/div/div/div[last()-1]/form/div[last()-3]/input[last()-1]"]}},{"id":3,"index":4,"parentId":0,"type":0,"option":2,"title":"点击元素","sequence":[],"isInLoop":false,"position":2,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"//*[@id=\"search\"]","iframe":false,"wait":2,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"clickWay":0,"maxWaitTime":10,"paras":[],"allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[1]/form[1]/div[5]/a[1]","//a[contains(., '查询')]","id(\"search\")","//A[@class='check']","/html/body/div[last()-3]/div[last()-1]/div/div/div[last()-1]/form/div/a"]}},{"id":4,"index":5,"parentId":0,"type":1,"option":8,"title":"循环","sequence":[7,6],"isInLoop":false,"position":3,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"//*[contains(@class, \"pagination\")]/ul[1]/li[last()-1]/a[1]","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"loopType":0,"pathList":"","textList":"","code":"","waitTime":0,"exitCount":2,"historyWait":2,"breakMode":0,"breakCode":"","breakCodeWaitTime":0,"allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/ul[1]/li[10]/a[1]","//a[contains(., '»')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div/div/div/ul/li[last()-1]/a"]}},{"id":6,"index":6,"parentId":4,"type":0,"option":2,"title":"点击元素","sequence":[],"isInLoop":true,"position":1,"parameters":{"history":4,"tabIndex":-1,"useLoop":true,"xpath":"//*[contains(@class, \"pagination\")]/ul[1]/li[10]/a[1]","iframe":false,"wait":2,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"clickWay":0,"maxWaitTime":10,"paras":[],"allXPaths":["/html/body/div[1]/div[3]/div[1]/div[1]/div[2]/div[1]/div[2]/div[1]/div[1]/ul[1]/li[10]/a[1]","//a[contains(., '»')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div/div/div/ul/li[last()-1]/a"],"loopType":0}},{"id":5,"index":7,"parentId":4,"type":1,"option":8,"title":"循环","sequence":[8],"isInLoop":true,"position":0,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"scrollType":0,"scrollCount":1,"scrollWaitTime":1,"loopType":2,"pathList":"//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[2]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[3]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[4]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[5]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[6]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[7]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[8]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[9]\n//*[contains(@class, \"tr-red\")]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[11]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[12]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[13]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[14]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[15]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[16]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[17]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[18]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[19]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[20]\n//*[contains(@class, \"speed-table1\")]/tbody[1]/tr[21]","textList":"","code":"","waitTime":0,"exitCount":0,"historyWait":2,"breakMode":0,"breakCode":"","breakCodeWaitTime":0,"allXPaths":""}},{"id":7,"index":8,"parentId":5,"type":0,"option":3,"title":"提取数据","sequence":[],"isInLoop":true,"position":0,"parameters":{"history":4,"tabIndex":-1,"useLoop":false,"xpath":"","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"paras":[{"nodeType":0,"contentType":1,"relative":true,"name":"震级","desc":"","relativeXPath":"/td[1]","allXPaths":["/td[1]","//td[contains(., '3.3')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-5]"],"exampleValues":[{"num":0,"value":"3.3"}],"unique_index":"/td[1]","iframe":false,"default":"","paraType":"double","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":0,"contentType":1,"relative":true,"name":"时间","desc":"","relativeXPath":"/td[2]","allXPaths":["/td[2]","//td[contains(., '2023-06-25')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-4]"],"exampleValues":[{"num":0,"value":"2023-06-2509:16:14"}],"unique_index":"/td[2]","iframe":false,"default":"","paraType":"datetime","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":0,"contentType":1,"relative":true,"name":"参数4_文本","desc":"","relativeXPath":"/td[3]","allXPaths":["/td[3]","//td[contains(., '37.56')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-3]"],"exampleValues":[{"num":0,"value":"37.56"}],"unique_index":"/td[3]","iframe":false,"default":"","paraType":"double","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":0,"contentType":1,"relative":true,"name":"参数5_文本","desc":"","relativeXPath":"/td[4]","allXPaths":["/td[4]","//td[contains(., '77.91')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-2]"],"exampleValues":[{"num":0,"value":"77.91"}],"unique_index":"/td[4]","iframe":false,"default":"","paraType":"text","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":0,"contentType":1,"relative":true,"name":"参数6_文本","desc":"","relativeXPath":"/td[5]","allXPaths":["/td[5]","//td[contains(., '20')]","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td[last()-1]"],"exampleValues":[{"num":0,"value":"20"}],"unique_index":"/td[5]","iframe":false,"default":"","paraType":"int","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":1,"contentType":0,"relative":true,"name":"参数7_链接文本","desc":"","relativeXPath":"/td[6]/a[1]","allXPaths":["/td[6]/a[1]","//a[contains(., '新疆和田地区皮山县')]","id(\"cid\")","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td/a"],"exampleValues":[{"num":0,"value":"新疆和田地区皮山县"}],"unique_index":"/td[6]/a[1]","iframe":false,"default":"","paraType":"varchar","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0},{"nodeType":2,"contentType":0,"relative":true,"name":"参数8_链接地址","desc":"","relativeXPath":"/td[6]/a[1]","allXPaths":["/td[6]/a[1]","//a[contains(., '新疆和田地区皮山县')]","id(\"cid\")","/html/body/div[last()-3]/div[last()-1]/div/div/div/div/div[last()-1]/table/tbody/tr[last()-19]/td/a"],"exampleValues":[{"num":0,"value":"https://news.ceic.ac.cn/CD20230625091615.html"}],"unique_index":"/td[6]/a[1]","iframe":false,"default":"","paraType":"mediumText","beforeJS":"","beforeJSWaitTime":0,"JS":"","JSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"downloadPic":0}],"loopType":2}},{"id":-1,"index":9,"parentId":0,"type":0,"option":5,"title":"自定义操作","sequence":[],"isInLoop":false,"position":3,"parameters":{"history":1,"tabIndex":0,"useLoop":false,"xpath":"","iframe":false,"wait":0,"waitType":0,"beforeJS":"","beforeJSWaitTime":0,"afterJS":"","afterJSWaitTime":0,"codeMode":0,"code":"return window.innerHeight","waitTime":0,"recordASField":"1","paraType":"int"}}]} \ No newline at end of file diff --git a/ExecuteStage/.vscode/launch.json b/ExecuteStage/.vscode/launch.json index 5f89cf4..e5589bb 100644 --- a/ExecuteStage/.vscode/launch.json +++ b/ExecuteStage/.vscode/launch.json @@ -12,7 +12,7 @@ "justMyCode": true, // "args": ["--id", "[7]", "--read_type", "remote", "--headless", "0"] // "args": ["--id", "[9]", "--read_type", "remote", "--headless", "0", "--saved_file_name", "YOUTUBE"] - "args": ["--id", "[21]", "--headless", "0", "--user_data", "1"] + "args": ["--id", "[22]", "--headless", "0", "--user_data", "1"] } ] } \ No newline at end of file diff --git a/ExecuteStage/easyspider_executestage.py b/ExecuteStage/easyspider_executestage.py index c473167..d43e14b 100644 --- a/ExecuteStage/easyspider_executestage.py +++ b/ExecuteStage/easyspider_executestage.py @@ -1458,4 +1458,6 @@ if __name__ == '__main__': for thread in threads: thread.browser.quit() - print("Thread with task id: ", thread.id, " is closed") + # print("Thread with task id: ", thread.id, " is closed") + print("程序已运行完成,请手动关闭此窗口。") + print("The program has finished running, please manually close this window.") diff --git a/ExecuteStage/utils.py b/ExecuteStage/utils.py index 1fb1100..d3a7924 100644 --- a/ExecuteStage/utils.py +++ b/ExecuteStage/utils.py @@ -144,13 +144,17 @@ class Time: class myMySQL: def __init__(self, config_file="mysql_config.json"): # 读取配置文件 - with open(config_file, 'r') as f: - config = json.load(f) - host = config["host"] - port = config["port"] - user = config["user"] - passwd = config["password"] - db = config["database"] + try: + with open(config_file, 'r') as f: + config = json.load(f) + host = config["host"] + port = config["port"] + user = config["user"] + passwd = config["password"] + db = config["database"] + except: + print("读取配置文件失败,请检查配置文件:"+config_file+"是否存在。") + print("Failed to read configuration file, please check if the configuration file: "+config_file+" exists.") try: self.conn = pymysql.connect( host=host, port=port, user=user, passwd=passwd, db=db)