forked from satrong/node-crawler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
52 lines (43 loc) · 1.13 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* 配置文件
*
*/
/// 示例抓取:妹子图
/*module.exports = {
mode: 'web',
/// 是否是分页
isPagination: true,
/// 开始页码
from: 8,
/// 结束页码
to: 9,
/// 抓取的类型 text:文本,images:图片
type: 'image',
/// %% 表示页码
url: 'http://sexy.faceks.com/?page=%%',
/// 保存的路径
saveDir: 'E:/img',
/// 选择器
/// $:{String} 选择器,与jQuery的语法相似
/// attr:{String} url所在的属性
selector: [
{ $: '$("a.img")', attr: 'href' },
{ $: '$("a[bigimgsrc]")', attr: 'bigimgsrc' }
]
};*/
module.exports = {
mode: 'web', /// console:cmd窗口方式,web:网页形式
isPagination: true,
from: 1,
to: 1,
type: 'image',
url: 'http://list.jd.com/list.html?cat=670%2C671%2C672&JL=6_0_0&page=%%',
charset: 'gbk',
saveDir: 'E:/jd',
selector: [
{ $: '$(".p-img a")', attr: 'href' },
{ $: '$("#spec-list").find("img[data-url]")', attr: 'src' }
],
imageFn: function (url) {
return url.replace('/n5/', '/n0/')
}
};