🦀 ClawHub
Category Link Collector
by @qirongzhang
采集电商网站分类链接信息,提取分类层级数据并保存为CSV文件。当需要从电商网站分类链接中提取结构化数据时使用此技能。
TERMINAL
clawhub install category-link-collector📖 About This Skill
name: category-link-collector description: 采集电商网站分类链接信息,提取分类层级数据并保存为CSV文件。当需要从电商网站分类链接中提取结构化数据时使用此技能。
Category Link Collector Skill
功能
使用方法
基本用法
采集以下分类链接:
https://lulumonclick-eu.shop/collections/women-women-clothes-tank-tops
https://lulumonclick-eu.shop/collections/women-women-clothes-bras-underwear
参数说明
/Users/zhangqirong/工作/caiji,可自定义lulumonclick-eu.shop.csv)数据结构
生成的CSV文件包含以下列: 1. 完整链接: 原始分类链接 2. 分类路径: 从URL中提取的分类路径(如women-women-clothes-tank-tops)
3. 域名: 网站域名
4. 1级分类: 提取的一级分类名称(如 Women)
5. 2级分类: 提取的二级分类名称(如 Tank Tops)
6. 3级分类: 提取的三级分类名称(如存在)
7. 4级分类: 提取的四级分类名称(如存在)
8. ...: 更多级别分类(根据实际深度动态生成)多级分类支持
技能现在支持无限级分类提取:处理逻辑
1. 从URL中提取域名部分 2. 从/collections/ 后提取分类路径
3. 解析分类路径:
- 使用智能算法分割分类路径
- 识别一级分类(Women, Men, Kids, Beauty等)
- 提取所有级别的下级分类
- 智能合并特殊词组和数字范围
4. 根据最大分类深度动态生成CSV列
5. 生成CSV文件,保存到指定目录示例
输入链接:https://lulumonclick-eu.shop/collections/women-women-clothes-tank-tops
输出CSV行: | 完整链接 | 分类路径 | 一级分类 | 二级分类 | 域名 | |---------|---------|---------|---------|------| | https://lulumonclick-eu.shop/collections/women-women-clothes-tank-tops | women-women-clothes-tank-tops | Women | Tank Tops | lulumonclick-eu.shop |
文件位置
SKILL.mdscripts/collect_categories.pyconfig/settings.json (可选)