amis爬蟲配置界面

記錄一下多層嵌套配置界面

{
    "status": 0,
    "msg": "",
    "data": {
        "title": "采集向?qū)?,
        "definitions": {
            "selectCtrl": {
                "type": "combo",
                "name": "items",
                "required": true,
                "value": [
                    {
                        "type": "xpath"
                    }
                ],
                "minLength": 1,
                "multiple": true,
                "typeSwitchable": false,
                "conditions": [
                    {
                        "label": "xpath",
                        "test": "this.type === \"xpath\"",
                        "scaffold": {
                            "type": "xpath"
                        },
                        "items": [
                            {
                                "name": "arg",
                                "required": true,
                                "label": "${index+1}. ${type}",
                                "type": "input-text"
                            }
                        ]
                    },
                    {
                        "label": "jpath",
                        "test": "this.type === \"jpath\"",
                        "scaffold": {
                            "type": "jpath"
                        },
                        "items": [
                            {
                                "name": "arg",
                                "required": true,
                                "label": "${index+1}. ${type}",
                                "type": "input-text"
                            }
                        ]
                    },
                    {
                        "label": "mix",
                        "test": "this.type === \"mix\"",
                        "scaffold": {
                            "type": "mix"
                        },
                        "items": [
                            {
                                "name": "arg",
                                "required": true,
                                "label": "${index+1}. ${type}",
                                "type": "input-text"
                            }
                        ]
                    },
                    {
                        "label": "split",
                        "test": "this.type === \"split\"",
                        "scaffold": {
                            "type": "split"
                        },
                        "items": [
                            {
                                "name": "arg",
                                "required": true,
                                "label": "${index+1}. ${type}",
                                "type": "input-text"
                            }
                        ]
                    },
                    {
                        "label": "replace",
                        "test": "this.type === \"replace\"",
                        "scaffold": {
                            "type": "replace"
                        },
                        "items": [
                            {
                                "name": "arg",
                                "required": true,
                                "label": "${index+1}. ${type}",
                                "type": "input-text"
                            },
                            {
                                "name": "arg1",
                                "required": true,
                                "type": "input-text"
                            }
                        ]
                    },
                    {
                        "label": "regex",
                        "test": "this.type === \"regex\"",
                        "scaffold": {
                            "type": "regex"
                        },
                        "items": [
                            {
                                "name": "arg",
                                "required": true,
                                "label": "${index+1}. ${type}",
                                "type": "input-text"
                            },
                            {
                                "name": "arg1",
                                "type": "input-number"
                            }
                        ]
                    },
                    {
                        "label": "object",
                        "test": "this.type === \"more\" && this.isArray === false",
                        "scaffold": {
                            "type": "more",
                            "isArray": false
                        },
                        "items": [
                            {
                                "$ref": "subItemObjCtrl",
                                "label": "${index+1}. ${type}",
                                "name": "arg"
                            }
                        ]
                    },
                    {
                        "label": "array",
                        "test": "this.type === \"more\" && this.isArray === true",
                        "scaffold": {
                            "type": "more",
                            "isArray": true
                        },
                        "items": [
                            {
                                "$ref": "subItemArrayCtrl",
                                "label": "${index+1}. ${type}",
                                "name": "arg"
                            }
                        ]
                    }
                ]
            },
            "subItemObjCtrl": {
                "type": "input-kvs",
                "addButtonText": "新增子選擇器",
                "minLength": 1,
                "draggable": false,
                "keyItem": {
                    "label": "字段名"
                },
                "required": true,
                "valueItems": [
                    {
                        "$ref": "selectCtrl",
                        "name": "_value"
                    }
                ]
            },
            "subItemArrayCtrl": {
                "type": "input-array",
                "addButtonText": "新增子選擇器",
                "minLength": 1,
                "draggable": false,
                "items": {
                    "$ref": "selectCtrl",
                    "name": "_value",
                    "label": "子選擇器 [${index+1}]"
                }
            },
            "itemsCtrl": {
                "type": "input-array",
                "addButtonText": "新增字段",
                "minLength": 1,
                "draggable": false,
                "required": true,
                "items": {
                    "type": "group",
                    "mode": "vertical",
                    "body": [
                        {
                            "type": "divider"
                        },
                        {
                            "name": "name",
                            "type": "input-text",
                            "required": true,
                            "label": "字段名 [${index+1}]"
                        },
                        {
                            "type": "group",
                            "mode": "inline",
                            "body": [
                                {
                                    "name": "isExtend",
                                    "type": "checkbox",
                                    "trueValue": true,
                                    "falseValue": false,
                                    "option": "結(jié)果向后傳遞"
                                },
                                {
                                    "name": "isHelpUrls",
                                    "type": "checkbox",
                                    "trueValue": true,
                                    "falseValue": false,
                                    "option": "添加采集URL"
                                },
                                {
                                    "name": "mutil",
                                    "type": "checkbox",
                                    "trueValue": true,
                                    "falseValue": false,
                                    "value": true,
                                    "option": "結(jié)果為數(shù)組"
                                },
                                {
                                    "type": "radios",
                                    "name": "araeSpace",
                                    "label": "采集區(qū)域",
                                    "value": "BODY",
                                    "options": [
                                        {
                                            "label": "BODY",
                                            "value": "BODY"
                                        },
                                        {
                                            "label": "URL",
                                            "value": "URL"
                                        },
                                        {
                                            "label": "BLOCK",
                                            "value": "BLOCK"
                                        },
                                        {
                                            "label": "PAGE",
                                            "value": "PAGE"
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            "$ref": "selectCtrl",
                            "name": "selector",
                            "label": "抽取規(guī)則"
                        }
                    ]
                }
            }
        },
        "body": {
            "type": "wizard",
            "api": {
                "method": "post",
                "url": "/api/save.aardio"
            },
            "initApi": "/data${window:document.location.pathname}",
            "mode": "vertical",
            "debug": true,
            "steps": [
                {
                    "title": "基礎(chǔ)信息配置",
                    "body": {
                        "type": "json-schema",
                        "name": "site",
                        "value": {
                            "downloaderPoolSize": 100,
                            "downloaderThreadSize": 10,
                            "retryTimes": 1,
                            "cycleRetryTimes": 0,
                            "sleepTime": 100
                        },
                        "required": true,
                        "schema": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                                "domain",
                                "downloaderPoolSize",
                                "downloaderThreadSize",
                                "retryTimes",
                                "cycleRetryTimes",
                                "sleepTime"
                            ],
                            "properties": {
                                "domain": {
                                    "type": "string",
                                    "title": "爬蟲唯一標識"
                                },
                                "downloaderThreadSize": {
                                    "type": "number",
                                    "title": "下載器線程池數(shù)量"
                                },
                                "downloaderPoolSize": {
                                    "type": "number",
                                    "title": "單次批量下載條數(shù)"
                                },
                                "retryTimes": {
                                    "type": "number",
                                    "title": "失敗立即重試次數(shù)"
                                },
                                "cycleRetryTimes": {
                                    "type": "number",
                                    "title": "失敗循環(huán)重試次數(shù)"
                                },
                                "sleepTime": {
                                    "type": "number",
                                    "title": "下載間隔(毫秒)"
                                }
                            }
                        }
                    }
                },
                {
                    "title": "抽取規(guī)則配置",
                    "body": [
                        {
                            "type": "combo",
                            "name": "modles",
                            "label": "模板配置",
                            "multiple": true,
                            "multiLine": true,
                            "value": [
                                {
                                    "parse": "http://page.request\n//page.response\n//page.result\n//page.extend\n//page.helpUrls",
                                    "items": [
                                        {
                                            "selector": [
                                                {
                                                    "type": "xpath"
                                                }
                                            ]
                                        }
                                    ],
                                    "tagUrl": "https?\\://"
                                }
                            ],
                            "tabsMode": true,
                            "tabsStyle": "chrome",
                            "minLength": 1,
                            "tabsLabelTpl": "模板 [${index|plus}]",
                            "items": [
                                {
                                    "name": "tagUrl",
                                    "label": "網(wǎng)頁過濾",
                                    "required": true,
                                    "type": "input-text",
                                    "value": ""
                                },
                                {
                                    "type": "divider"
                                },
                                {
                                    "type": "combo",
                                    "name": "items",
                                    "label": "抽取規(guī)則配置",
                                    "multiple": true,
                                    "multiLine": true,
                                    "tabsMode": true,
                                    "tabsStyle": "simple",
                                    "minLength": 1,
                                    "tabsLabelTpl": "字段 [${index|plus}]",
                                    "items": [
                                        {
                                            "name": "name",
                                            "type": "input-text",
                                            "required": true,
                                            "label": "字段名"
                                        },
                                        {
                                            "type": "group",
                                            "mode": "inline",
                                            "body": [
                                                {
                                                    "name": "isExtend",
                                                    "type": "checkbox",
                                                    "trueValue": true,
                                                    "falseValue": false,
                                                    "option": "結(jié)果向后傳遞"
                                                },
                                                {
                                                    "name": "isHelpUrls",
                                                    "type": "checkbox",
                                                    "trueValue": true,
                                                    "falseValue": false,
                                                    "option": "添加采集URL"
                                                },
                                                {
                                                    "name": "mutil",
                                                    "type": "checkbox",
                                                    "trueValue": true,
                                                    "falseValue": false,
                                                    "value": true,
                                                    "option": "結(jié)果為數(shù)組"
                                                },
                                                {
                                                    "type": "radios",
                                                    "name": "araeSpace",
                                                    "label": "采集區(qū)域",
                                                    "value": "BODY",
                                                    "options": [
                                                        {
                                                            "label": "BODY",
                                                            "value": "BODY"
                                                        },
                                                        {
                                                            "label": "URL",
                                                            "value": "URL"
                                                        },
                                                        {
                                                            "label": "BLOCK",
                                                            "value": "BLOCK"
                                                        },
                                                        {
                                                            "label": "PAGE",
                                                            "value": "PAGE"
                                                        }
                                                    ]
                                                }
                                            ]
                                        },
                                        {
                                            "$ref": "selectCtrl",
                                            "name": "selector",
                                            "label": "抽取規(guī)則"
                                        }
                                    ]
                                },
                                {
                                    "type": "divider"
                                },
                                {
                                    "name": "parse",
                                    "type": "editor",
                                    "label": "后處理",
                                    "language": "javascript",
                                    "value": ""
                                }
                            ]
                        }
                    ]
                },
                {
                    "title": "調(diào)度器配置",
                    "body": [
                        "這是最后一步了"
                    ]
                }
            ]
        }
    }
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容