Skip to content

star rules

憧憬Licoy edited this page Oct 24, 2019 · 1 revision
    [{
        "name": "图片站", //采集源站标题
        "key":"key", //标示KEY
        "url": "https://www.xxx.com", //域名,主要用于组合链接
        "tags": [ //分类列表
            {"name": "女神", "url": "https://www.xxx.com/t/nvshen/"},  //name:分类名称, url:分类地址
        ], 
        "pages": { //外层页面采集规则
            "element": "body > div.main > div.boxs > ul > li",  //元素selector
            "name": { //名称采集规则
                "element": "p.p_title > a", //元素selector
                "attr": "@text" //@text是取html元素的text值,非此值则取attr属性,如title
            },
            "url": { //图集采集规则
                "element": "p.p_title > a", //元素selector
                "attr": "href", //@text是取html元素的text值,非此值则取attr属性,如title
                "needMerge": false, //是否需要合并地址
            },
            "nextPageUrlMode": { //下一页采集规则
                "mode": "add", //模式:add(添加) replace(替换)
                "replaceSearchValue": ".html", //替换搜索字符串
                "replaceValue": "_{page}.html", //目标替换值
                "addValue": "{page}.html" //添加值
            }, 
            "lastPage": { //最后一页匹配规则,主要是用于统计总页码
                "element": "#pages > a",  //元素selector
                "minPageLength": 2, //最小采集的到页码数量才进行匹配,否则只执行当页
                "attr": "@text", //@text是取html元素的text值,非此值则取attr属性,如title
                "descIndex": 2, //页码的元素index,倒序
                "isNeedSplit": false, //是否需要分割
                "splits": [ //分割,例如xxx_xx_1.html的格式需要用到此值
                    {"str":"_","index":2}, // str: 分割字符串, index: 下次分页的字符索引
                    {"str":".","index":0}
                 ]
            }
        }, 
        "imgs": { //内页图片采集规则
            "element": "body > div.content > center > img", //元素selector
            "attr":"href", //[v2] 图片的属性值
            "singlePage":true, //[v2] 是否是单页面,即所有图片呈现在一个页面上
            "urlNeedMerge": true, //[v2] 图片链接是否需要合并拼接
            "imgUrlMode":{ //[v2]图片url变换规则,同上,此值与urlNeedMerge不冲突,urlNeedMerge优先执行
                "mode":"replace",
                "addValue": "",
                "replaceSearchValue": "//", 
                "replaceValue": "http://"
            },
            "nextPageUrlMode": { //同上
                "incrementMode": "image", //采集增长模式 image:图片 page:页面
                "mode": "replace", //页面页码替换模式,当incrementMode为image时此值无效
                "imageSuffix":"jpg" //图片后缀名
                "replaceSearchValue": ".html", //同pages此属性,当incrementMode为image时此值无效
                "replaceValue": "_{page}.html",  //同pages此属性,当incrementMode为image时此值无效
                "addValue": "{page}.html" //同pages此属性,当incrementMode为image时此值无效
            }, 
            "lastPage": { //通pages此属性
                "element": "#pages > a", 
                "minPageLength": 2, 
                "attr": "@text", 
                "descIndex": 2, 
                "isNeedSplit": false, 
                "splits": []
            }
        }, 
        "supportReptileVersion": 1 //支持采集器的版本号
    }]
Clone this wiki locally