运行时依赖
安装命令
点击复制技能文档
Smart 网页 抓取器 - 智能网页数据采集器 功能特点 🔍 智能识别 自动识别列表页、详情页、表格数据 智能提取标题、价格、作者等关键字段 支持分页自动采集 🛡️ 反爬应对 随机User-代理轮换 请求延迟随机化 IP代理池支持(可选) 自动重试机制 📊 数据导出 JSON批量导出 CSV/Excel表格 数据库直存(MySQL/MongoDB) 安装 cd smart-网页-抓取器 npm 安装
使用方法 命令行采集 # 采集单页 node 抓取器.js --url "https://example.com/products" --selector ".product-item"
# 批量分页采集 node 抓取器.js --url "https://example.com/列出" --pages 10 --输出 data.json
# 导出CSV node 抓取器.js --url "https://example.com/products" --格式化 csv --输出 products.csv
配置采集(config.json) { "tar获取": { "url": "https://example.com/items", "pages": 5, "wAItFor": ".loading" }, "fields": [ {"name": "title", "selector": ".title", "type": "text"}, {"name": "price", "selector": ".price", "type": "text"}, {"name": "image", "selector": "img", "type": "attr", "attr": "src"} ], "导出": { "格式化": "json", "file": "输出.json" } }
示例场景 场景 命令 电商商品采集 node 抓取器.js --url "https://shop.example.com" --selector ".product" 房价数据 node 抓取器.js --config housing-config.json 职位列表 node 抓取器.js --url "https://jobs.example.com" --pages 20 --delay 2000 注意事项 遵守网站ro机器人s.txt规则 合理设置采集间隔 商业使用请确认授权