Pārlūkot izejas kodu

Update Sample, fix bug

naibo 2 gadi atpakaļ
vecāks
revīzija
9c3675ac2d

BIN
ElectronJS/EasySpider_en.crx


BIN
ElectronJS/EasySpider_zh.crx


+ 1 - 1
ElectronJS/config.json

@@ -1 +1 @@
-{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","absolute_user_data_folder":"/Users/naibowang/Documents/EasySpider/ElectronJS/user_data"}
+{"webserver_address":"http://localhost","webserver_port":8074,"user_data_folder":"./user_data","absolute_user_data_folder":"D:\\Documents\\Projects\\EasySpider\\ElectronJS\\user_data"}

+ 2 - 1
ElectronJS/src/taskGrid/FlowChart.html

@@ -245,7 +245,7 @@
                             <option :value = 4>Image Address</option>
                         </select>
                         <div v-if='paras.parameters[paraIndex]["nodeType"] == 4'>
-                            <label>Whether to <b>download image</b> after extracting the image address</label>
+                            <label>Whether to <b>download image</b> after extracting the image address: </label>
                             <select v-model='paras.parameters[paraIndex]["downloadPic"]' class="form-control">
                                 <option :value = 0>No</option>
                                 <option :value = 1>Yes</option>
@@ -427,6 +427,7 @@
                 </div>
 
                 <div class="elements" v-if="nodeType==10">
+                    <label>The conditions are evaluated from left to right, which means if the condition in the leftmost branch is satisfied, the operations within that branch are executed. Otherwise, the condition in the next branch from left to right is evaluated, and so on.</label>
                     <label>Condition Type:</label>
                     <select v-model='TClass' class="form-control">
                         <option value = 0>No Condition</option>

+ 37 - 36
ElectronJS/src/taskGrid/FlowChart.js

@@ -1,6 +1,6 @@
 //处理表现层
-var nodeList = Array(); //所有新生成的节点全部存储在这里,并且有唯一索引号,所有的定位均通过index进行,即将图保存下来了
-var root = {
+let nodeList = Array(); //所有新生成的节点全部存储在这里,并且有唯一索引号,所有的定位均通过index进行,即将图保存下来了
+let root = {
     index: 0, //在nodeList中的索引号
     id: 0,
     parentId: 0,
@@ -18,16 +18,16 @@ var root = {
     isInLoop: false, //是否处于循环内
 };
 nodeList.push(root);
-var queue = new Array();
-var actionSequence = new Array(); //存储图结构,每个元素为在nodelist里面的索引值,下面的id和pid根据此数组进行索引,然后再在nodelist里找
-var nowNode = null; //存储现在所在的节点
-var vueData = { nowNodeIndex: 0 }; //存储目前所在节点的索引号,不能直接使用变量而需要用对象包起来
-var option = 0; //工具箱选项
-var title = "";
-var parameterNum = 1; //记录目前的参数个数
+let queue = new Array();
+let actionSequence = new Array(); //存储图结构,每个元素为在nodelist里面的索引值,下面的id和pid根据此数组进行索引,然后再在nodelist里找
+let nowNode = null; //存储现在所在的节点
+let vueData = { nowNodeIndex: 0 }; //存储目前所在节点的索引号,不能直接使用变量而需要用对象包起来
+let option = 0; //工具箱选项
+let title = "";
+let parameterNum = 1; //记录目前的参数个数
 
 //处理逻辑层
-var app = new Vue({
+let app = new Vue({
     el: '#app',
     data: {
         list: { nl: nodeList },
@@ -166,8 +166,8 @@ var app = new Vue({
 //深复制
 function DeepClone(obj) {
     if (obj === null || typeof obj !== 'object') return obj;
-    var cpObj = obj instanceof Array ? [] : {};
-    for (var key in obj) cpObj[key] = DeepClone(obj[key]);
+    let cpObj = obj instanceof Array ? [] : {};
+    for (let key in obj) cpObj[key] = DeepClone(obj[key]);
     return cpObj;
 }
 
@@ -227,8 +227,8 @@ function branchMouseDown(e) {
     if (e.button == 2) //右键点击
     {
         let judgeId = this.getAttribute('data');
-        var l = nodeList.length;
-        var t = {
+        let l = nodeList.length;
+        let t = {
             index: l,
             id: 0,
             parentId: 0,
@@ -260,8 +260,8 @@ function arrowMouseDown(e) {
 //增加分支点击事件
 function branchClick(e) {
     let judgeId = this.getAttribute('data');
-    var l = nodeList.length;
-    var t = {
+    let l = nodeList.length;
+    let t = {
         index: l,
         id: 0,
         parentId: 0,
@@ -305,7 +305,8 @@ function addElement(op, para) {
     option = op;
     if (option == 1) { //打开网页选项
         title = "Open Page";
-    } else {
+    }
+    else {
         title = $(".options")[option - 1].innerHTML; //获取新增操作名称
     }
 
@@ -327,13 +328,13 @@ function toolBoxKernel(e, para = null) {
         } else {
             let position = parseInt(nowNode.getAttribute('position'));
             let pId = nowNode.getAttribute('pId');
-            var tt = nodeList[nodeList[actionSequence[pId]]["sequence"][position]]; //在相应位置添加新元素
+            let tt = nodeList[nodeList[actionSequence[pId]]["sequence"][position]]; //在相应位置添加新元素
             t = DeepClone(tt); //浅复制元素
-            var l = nodeList.length;
+            let l = nodeList.length;
             t.index = l;
             nodeList.push(t);
-            var position2 = parseInt(app._data.nowArrow['position']);
-            var pId2 = app._data.nowArrow['pId'];
+            let position2 = parseInt(app._data.nowArrow['position']);
+            let pId2 = app._data.nowArrow['pId'];
             nodeList[actionSequence[pId2]]["sequence"].splice(position2 + 1, 0, t.index); //在相应位置添加新元素
             refresh(); //重新渲染页面
             app._data.nowArrow = { "position": t["position"], "pId": t["parentId"], "num": 0 };
@@ -349,11 +350,11 @@ function toolBoxKernel(e, para = null) {
         } else {
             let position = parseInt(nowNode.getAttribute('position'));
             let pId = nowNode.getAttribute('pId');
-            var position2 = parseInt(app._data.nowArrow['position']);
-            var pId2 = app._data.nowArrow['pId'];
-            var id = nowNode.getAttribute('data');
-            var pidt = pId2;
-            var move = true;
+            let position2 = parseInt(app._data.nowArrow['position']);
+            let pId2 = app._data.nowArrow['pId'];
+            let id = nowNode.getAttribute('data');
+            let pidt = pId2;
+            let move = true;
             console.log(pidt, id);
             while (pidt != 0) {
                 if (pidt == id) {
@@ -381,8 +382,8 @@ function toolBoxKernel(e, para = null) {
             e.stopPropagation(); //防止冒泡
         }
     } else if (option > 0) { //新增操作
-        var l = nodeList.length;
-        var t = {
+        let l = nodeList.length;
+        let t = {
             id: 0,
             index: l,
             parentId: 0,
@@ -400,7 +401,7 @@ function toolBoxKernel(e, para = null) {
         {
             t["type"] = 2;
             // 增加两个分支
-            var nt = {
+            let nt = {
                 id: 0,
                 parentId: 0,
                 index: l + 1,
@@ -410,7 +411,7 @@ function toolBoxKernel(e, para = null) {
                 sequence: [],
                 isInLoop: false,
             };
-            var nt2 = {
+            let nt2 = {
                 id: 0,
                 parentId: 0,
                 index: l + 2,
@@ -503,12 +504,12 @@ function refresh(nowArrowReset = true) {
                         <p id="firstArrow" class="arrow" position=-1 pId=0>↓</p>`);
     actionSequence.splice(0);
     queue.splice(0);
-    var idd = 1;
+    let idd = 1;
     queue.push(0);
     actionSequence.push(0);
     while (queue.length != 0) {
-        var nd = queue.shift(); //取出父元素并建立对子元素的链接
-        for (i = 0; i < nodeList[nd].sequence.length; i++) {
+        let nd = queue.shift(); //取出父元素并建立对子元素的链接
+        for (let i = 0; i < nodeList[nd].sequence.length; i++) {
             nodeList[nodeList[nd].sequence[i]].parentId = nodeList[nd].id;
             nodeList[nodeList[nd].sequence[i]]["position"] = i;
             nodeList[nodeList[nd].sequence[i]].id = idd++;
@@ -524,11 +525,11 @@ function refresh(nowArrowReset = true) {
     }
     if (nowArrowReset) //如果要重置锚点位置
     {
-        app._data.nowArrow = { "position": -1, "pId": 0, "num": 0 }; //设置默认要添加的位置是元素流程最开头处
+        app._data.nowArrow = { "position": nodeList[0].sequence.length - 1, "pId": 0, "num": 0 }; //设置默认要添加的位置是元素流程最开头处
     }
     //第一个元素不渲染
-    for (i = 1; i < actionSequence.length; i++) {
-        parentId = nodeList[actionSequence[i]]["parentId"];
+    for (let i = 1; i < actionSequence.length; i++) {
+        let parentId = nodeList[actionSequence[i]]["parentId"];
         $("#" + parentId).append(newNode(nodeList[actionSequence[i]]));
     }
     bindEvents();

+ 2 - 1
ElectronJS/src/taskGrid/FlowChart_CN.html

@@ -245,7 +245,7 @@
                             <option :value = 4>图片地址</option>
                         </select>
                         <div v-if='paras.parameters[paraIndex]["nodeType"] == 4'>
-                            <label>提取图片地址后是否同时<b>下载图片</b></label>
+                            <label>提取图片地址后是否同时<b>下载图片</b></label>
                             <select v-model='paras.parameters[paraIndex]["downloadPic"]' class="form-control">
                                 <option :value = 0>否</option>
                                 <option :value = 1>是</option>
@@ -427,6 +427,7 @@
                 </div>
 
                 <div class="elements" v-if="nodeType==10">
+                    <label>判断条件是从左往右判断的,即如果最左边的判断分支的条件满足,则执行最左边分支内的操作,否则判断从左向右第二个分支的条件是否满足,以此类推。</label>
                     <label>条件类型:</label>
                     <select v-model='TClass' class="form-control">
                         <option value = 0>无条件</option>

+ 35 - 35
ElectronJS/src/taskGrid/FlowChart_CN.js

@@ -1,6 +1,6 @@
 //处理表现层
-var nodeList = Array(); //所有新生成的节点全部存储在这里,并且有唯一索引号,所有的定位均通过index进行,即将图保存下来了
-var root = {
+let nodeList = Array(); //所有新生成的节点全部存储在这里,并且有唯一索引号,所有的定位均通过index进行,即将图保存下来了
+let root = {
     index: 0, //在nodeList中的索引号
     id: 0,
     parentId: 0,
@@ -18,16 +18,16 @@ var root = {
     isInLoop: false, //是否处于循环内
 };
 nodeList.push(root);
-var queue = new Array();
-var actionSequence = new Array(); //存储图结构,每个元素为在nodelist里面的索引值,下面的id和pid根据此数组进行索引,然后再在nodelist里找
-var nowNode = null; //存储现在所在的节点
-var vueData = { nowNodeIndex: 0 }; //存储目前所在节点的索引号,不能直接使用变量而需要用对象包起来
-var option = 0; //工具箱选项
-var title = "";
-var parameterNum = 1; //记录目前的参数个数
+let queue = new Array();
+let actionSequence = new Array(); //存储图结构,每个元素为在nodelist里面的索引值,下面的id和pid根据此数组进行索引,然后再在nodelist里找
+let nowNode = null; //存储现在所在的节点
+let vueData = { nowNodeIndex: 0 }; //存储目前所在节点的索引号,不能直接使用变量而需要用对象包起来
+let option = 0; //工具箱选项
+let title = "";
+let parameterNum = 1; //记录目前的参数个数
 
 //处理逻辑层
-var app = new Vue({
+let app = new Vue({
     el: '#app',
     data: {
         list: { nl: nodeList },
@@ -167,8 +167,8 @@ var app = new Vue({
 //深复制
 function DeepClone(obj) {
     if (obj === null || typeof obj !== 'object') return obj;
-    var cpObj = obj instanceof Array ? [] : {};
-    for (var key in obj) cpObj[key] = DeepClone(obj[key]);
+    let cpObj = obj instanceof Array ? [] : {};
+    for (let key in obj) cpObj[key] = DeepClone(obj[key]);
     return cpObj;
 }
 
@@ -228,8 +228,8 @@ function branchMouseDown(e) {
     if (e.button == 2) //右键点击
     {
         let judgeId = this.getAttribute('data');
-        var l = nodeList.length;
-        var t = {
+        let l = nodeList.length;
+        let t = {
             index: l,
             id: 0,
             parentId: 0,
@@ -261,8 +261,8 @@ function arrowMouseDown(e) {
 //增加分支点击事件
 function branchClick(e) {
     let judgeId = this.getAttribute('data');
-    var l = nodeList.length;
-    var t = {
+    let l = nodeList.length;
+    let t = {
         index: l,
         id: 0,
         parentId: 0,
@@ -328,13 +328,13 @@ function toolBoxKernel(e, para = null) {
         } else {
             let position = parseInt(nowNode.getAttribute('position'));
             let pId = nowNode.getAttribute('pId');
-            var tt = nodeList[nodeList[actionSequence[pId]]["sequence"][position]]; //在相应位置添加新元素
+            let tt = nodeList[nodeList[actionSequence[pId]]["sequence"][position]]; //在相应位置添加新元素
             t = DeepClone(tt); //浅复制元素
-            var l = nodeList.length;
+            let l = nodeList.length;
             t.index = l;
             nodeList.push(t);
-            var position2 = parseInt(app._data.nowArrow['position']);
-            var pId2 = app._data.nowArrow['pId'];
+            let position2 = parseInt(app._data.nowArrow['position']);
+            let pId2 = app._data.nowArrow['pId'];
             nodeList[actionSequence[pId2]]["sequence"].splice(position2 + 1, 0, t.index); //在相应位置添加新元素
             refresh(); //重新渲染页面
             app._data.nowArrow = { "position": t["position"], "pId": t["parentId"], "num": 0 };
@@ -350,11 +350,11 @@ function toolBoxKernel(e, para = null) {
         } else {
             let position = parseInt(nowNode.getAttribute('position'));
             let pId = nowNode.getAttribute('pId');
-            var position2 = parseInt(app._data.nowArrow['position']);
-            var pId2 = app._data.nowArrow['pId'];
-            var id = nowNode.getAttribute('data');
-            var pidt = pId2;
-            var move = true;
+            let position2 = parseInt(app._data.nowArrow['position']);
+            let pId2 = app._data.nowArrow['pId'];
+            let id = nowNode.getAttribute('data');
+            let pidt = pId2;
+            let move = true;
             console.log(pidt, id);
             while (pidt != 0) {
                 if (pidt == id) {
@@ -382,8 +382,8 @@ function toolBoxKernel(e, para = null) {
             e.stopPropagation(); //防止冒泡
         }
     } else if (option > 0) { //新增操作
-        var l = nodeList.length;
-        var t = {
+        let l = nodeList.length;
+        let t = {
             id: 0,
             index: l,
             parentId: 0,
@@ -401,7 +401,7 @@ function toolBoxKernel(e, para = null) {
         {
             t["type"] = 2;
             // 增加两个分支
-            var nt = {
+            let nt = {
                 id: 0,
                 parentId: 0,
                 index: l + 1,
@@ -411,7 +411,7 @@ function toolBoxKernel(e, para = null) {
                 sequence: [],
                 isInLoop: false,
             };
-            var nt2 = {
+            let nt2 = {
                 id: 0,
                 parentId: 0,
                 index: l + 2,
@@ -504,12 +504,12 @@ function refresh(nowArrowReset = true) {
                         <p id="firstArrow" class="arrow" position=-1 pId=0>↓</p>`);
     actionSequence.splice(0);
     queue.splice(0);
-    var idd = 1;
+    let idd = 1;
     queue.push(0);
     actionSequence.push(0);
     while (queue.length != 0) {
-        var nd = queue.shift(); //取出父元素并建立对子元素的链接
-        for (i = 0; i < nodeList[nd].sequence.length; i++) {
+        let nd = queue.shift(); //取出父元素并建立对子元素的链接
+        for (let i = 0; i < nodeList[nd].sequence.length; i++) {
             nodeList[nodeList[nd].sequence[i]].parentId = nodeList[nd].id;
             nodeList[nodeList[nd].sequence[i]]["position"] = i;
             nodeList[nodeList[nd].sequence[i]].id = idd++;
@@ -525,11 +525,11 @@ function refresh(nowArrowReset = true) {
     }
     if (nowArrowReset) //如果要重置锚点位置
     {
-        app._data.nowArrow = { "position": -1, "pId": 0, "num": 0 }; //设置默认要添加的位置是元素流程最开头处
+        app._data.nowArrow = { "position": nodeList[0].sequence.length - 1, "pId": 0, "num": 0 }; //设置默认要添加的位置是元素流程最开头处
     }
     //第一个元素不渲染
-    for (i = 1; i < actionSequence.length; i++) {
-        parentId = nodeList[actionSequence[i]]["parentId"];
+    for (let i = 1; i < actionSequence.length; i++) {
+        let parentId = nodeList[actionSequence[i]]["parentId"];
         $("#" + parentId).append(newNode(nodeList[actionSequence[i]]));
     }
     bindEvents();

+ 4 - 3
ElectronJS/src/taskGrid/taskInfo.html

@@ -47,9 +47,10 @@
             <p>{{"Task Name:~任务名称:" | lang}} {{task["name"]}}</p>
             <p style="word-wrap: break-word;word-break: break-all;overflow: hidden;max-height: 100px;">{{"Task Description:~任务描述:" | lang}} {{task["desc"]}}</p>
             <p style="word-wrap: break-word;word-break: break-all;overflow: hidden;max-height: 100px;">{{"Example URL:~样例网址:" | lang}} {{task["url"]}}</p>
+            <p>{{"Operations (Please close this window and select 'Design Task' button if you want to modify task with a browser)~操作(如要带浏览器修改任务流程请关闭此窗口并选择设计任务)" | lang}}</p>
             <p><a style="margin-top: 5px;" href="javascript:void(0)" v-on:click="modifyTask(task['id'],task['url'])" class="btn btn-primary">{{"Modify Task Workflow~修改任务流程" | lang}}</a>
-            <a style="margin-top: 5px;" href="javascript:void(0)" v-on:click="invokeTask(task['id'],task['url'])" class="btn btn-primary">{{"Invoke Task~调用任务" | lang}}</a></p>
-            <p>{{"Input Parameters:~输入参数" | lang}}</p>
+                <a style="margin-top: 5px;" href="javascript:void(0)" v-on:click="invokeTask(task['id'],task['url'])" class="btn btn-primary">{{"Invoke Task~调用任务" | lang}}</a></p>
+            <p>{{"Input Parameters~输入参数" | lang}}</p>
             <table class="table table-bordered">
                 <tbody>
                     <tr>
@@ -78,7 +79,7 @@
                     </tr>
                 </tbody>
             </table>
-            <p>{{"Output Parameters:~输出参数" | lang}}</p>
+            <p>{{"Output Parameters~输出参数" | lang}}</p>
             <table class="table table-bordered">
                 <tbody>
                     <tr>

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/86.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/87.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/88.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/89.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/90.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/91.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/92.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/93.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/94.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
ElectronJS/tasks/95.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Examples/汽车新闻采集/第一步:采集列表超链接地址.json


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Examples/汽车新闻采集/第二步:采集详情页标题内容并下载所有图片.json


+ 2 - 2
ExecuteStage/easyspider_executestage.py

@@ -49,10 +49,10 @@ def download_image(url, save_directory):
     # 检查响应状态码是否为成功状态
     if response.status_code == requests.codes.ok:
         # 提取文件名
-        file_name = url.split('/')[-1]
+        file_name = url.split('/')[-1].split("?")[0]
         
         # 生成唯一的新文件名
-        new_file_name = str(uuid.uuid4()) + '_' + file_name
+        new_file_name = file_name + '_' +  str(uuid.uuid4()) + '_' + file_name
         
         # 构建保存路径
         save_path = os.path.join(save_directory, new_file_name)

+ 1 - 1
Extension/manifest_v3/src/content-scripts/config.json

@@ -1 +1 @@
-{"language":"en"}
+{"language":"zh"}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels