Resources
2Install
npx skillscat add yanglei1826877278/myskills/skills-seo-traffic Install via the SkillsCat registry.
SKILL.md
流量分析
前置条件
在 ~/.seo-skills/config.json 中配置 CapSolver API Key:
{
"CAPSOLVER_API_KEY": "CAP-你的API密钥"
}需要安装 Python 依赖:requests
使用方法
运行脚本(脚本位于本 skill 目录的 scripts/ 下):
python scripts/run.py --domain <域名或URL> [--country <国家代码>] [--mode <subdomains|exact>]参数说明
| 参数 | 必填 | 默认值 | 说明 | 示例 |
|---|---|---|---|---|
--domain |
✅ | - | 要分析的域名或 URL | example.com |
--country |
❌ | None(全球) |
国家筛选 | us、cn |
--mode |
❌ | subdomains |
subdomains(含子域名)或 exact(精确匹配) |
exact |
使用示例
# 分析 example.com 的全球流量(含子域名)
python scripts/run.py --domain example.com
# 仅分析美国流量
python scripts/run.py --domain example.com --country us
# 精确匹配模式
python scripts/run.py --domain example.com --mode exact输出格式
脚本以 JSON 格式输出到 stdout:
{
"traffic_history": [...],
"traffic": {
"trafficMonthlyAvg": 50000,
"costMontlyAvg": 25000
},
"top_pages": [...],
"top_countries": [...],
"top_keywords": [...]
}字段说明
traffic.trafficMonthlyAvg:月均自然搜索流量traffic.costMontlyAvg:月均流量价值(美元估算)traffic_history:流量历史趋势数据top_pages:流量最高的页面列表top_countries:流量来源国家分布top_keywords:排名关键词列表
错误处理
- 错误信息以 JSON 格式输出到 stderr:
{"error": "错误描述"} - 脚本返回退出码 1 表示失败
- 常见错误:未配置 API Key、验证码解决失败、API 请求失败
注意事项
- 流量数据为 Ahrefs 的估算值,仅供参考
- 每次请求都需要获取新的验证码 Token,会消耗 CapSolver 余额
- 需要能访问
ahrefs.com和api.capsolver.com