怎么用 Claude Code 自动查竞品排名词和外链
用 Claude Code 配合 BeatAPI SEO Data API 与 web_read,按四步查 2 个竞品的排名词、去重外链与高流量正文,全程约 $0.43。

用 Claude Code 配合 BeatAPI SEO Data API 与 web_read,按四步查 2 个竞品的排名词、去重外链与高流量正文,全程约 $0.43。

如果你想用 Claude Code 配合 BeatAPI SEO Data API 查两个竞品的排名词和外链,可以直接按下面四步来做。跑完之后,你的本地项目目录里会多出三份能直接干活的文件:一份去掉品牌词和站内重复主题的关键词缺口表,一份每个网站只留一条链接、查过 DR 走势的外链名单,还有四篇竞品高流量文章的拆解大纲。
用 Claude Code 做这类多步 SEO 调研,有个习惯很省事:每一步查回来的原始数据都存成本地 JSON 或 CSV,别让几百行表格一直留在聊天框里。文件存好之后,对话上下文不会越拖越重,聊到后面模型也不容易忘掉你前面定好的筛选条件。
CLAUDE.md: 把目标国家、每次最多查多少行、文件存到哪写清楚,上下文长度和接口费用都能稳住。one_per_domain: true(每个网站只取一条链接): 准备联系对方之前再看一眼月度 DR 走势和垃圾风险分,能省去不少翻无效站的工夫。自己做过竞品调研大概都有体会:从工具里导出一张“竞品有排名、自己没排名”的词表,打开一看几百行,真正能立项的没几个。里面混得最多的就是三类词:竞品自己的品牌词、看着有搜索量但带不来转化的泛定义词,还有首页基本被维基百科和大厂文档占住的宽泛词。
没做过清洗的外链表也是一样。直接拉几百条原始反链下来,里面经常夹着同一个导航站页脚挂出的几十条重复链接,或者自动采集站的死链。做外链拓展时,真正值得花时间看的,是那些还在正常更新、在正文或产品目录里给竞品挂了链接的独立网站。
把这套活搬到终端里的 Claude Code 上来做,正好补上网页聊天工具的两处短板。一来,Claude Code 能直接看你本地仓库里的文章目录,给你推新词之前先查一遍站里有没有写过类似文章,少踩站内撞题的坑。二来,Claude Code 可以把接口返回的 JSON 存到磁盘,顺手写几十行 Python 做去重和比对,比把原始表格贴进聊天框让模型肉眼扫稳得多,也省 Token。
下面默认你的项目已经接好了 BeatAPI 远程 MCP(https://beatapi.io/mcp)。如果还没接,可以先照着 Claude Code SEO MCP 配置 在项目根目录放一份 .mcp.json,跑一次免费的 capabilities_inspect 确认连上就行。
拉数据之前,在项目根目录建一份 CLAUDE.md。这份常驻规则别写太长,控制在 60 行以内比较合适,省得每轮对话都在多吃上下文。下面这份模板把目标市场、单次行数上限和保存路径都定好了,直接贴进去改一下域名就能用:
# Competitor SEO Audit Rules
- Pass country="us" and language="en" for competitors, ranked_keywords, and top_pages.
- Never pass country or language to domain_rating, domain_rating_history, backlink_summary, or backlinks.
- Always pass bare domains (example.com), never https:// URLs or subpaths.
- Row caps per call: competitors limit=20, ranked_keywords limit=50, top_pages limit=10, backlinks limit=50 with one_per_domain=true.
- Save every raw JSON and filtered CSV under ./seo-audits/<YYYY-MM-DD>/; never print 50-row raw tables in chat.
- Keep domain_rating (0-100) and link_authority (0-1000) in separate columns; never convert between them.
- Preserve position_seen_at on every keyword row and print usage.price_usd after each step.
- Scan ./src/content/posts/ before proposing a new article and mark any existing slug overlap.
整个流程拆成四步按顺序跑。每一步都会先在本地目录写出文件,你扫一眼结果没问题再接着往下跑。
competitors 找真正在 Google 上跟你抢流量的同行别一上来就凭印象填竞品域名,先用 BeatAPI 的 data:seo.competitors 看 Google 搜索结果里到底是谁在跟你共享自然排名词。这个接口会自动排除 YouTube、Wikipedia 这类超级大站,不过列表里还是可能混进媒体站或者软件目录站。让 Claude Code 把前 20 个域名列成简表,你自己从中挑 2 个业务最接近的直接同行。
Run BeatAPI data:seo.competitors for yourdomain.com (country="us", language="en", limit=20).
Save the raw JSON to ./seo-audits/2026-12-01/competitors.json and print a short table with domain, shared_keywords, avg_position, and search_traffic_estimate.
Mark which 2-3 domains are direct product competitors versus media or directory sites, then stop so I can pick 2.
定好 2 个同行后,调用 data:seo.ranked_keywords 分别拉这两个同行和自己站点的前 50 个排名词。如果只想查某一条产品线,可以加上 contains 参数缩小范围(比如 api)。三份原始 JSON 存到本地后,让 Claude Code 写一段短 Python 脚本做差集,把品牌词和泛定义词筛掉,同时扫一遍本地文章目录,把可能撞题的旧文标出来。
For competitor1.com, competitor2.com, and yourdomain.com, call BeatAPI data:seo.ranked_keywords
(country="us", language="en", limit=50, optional contains="api").
Save the raw JSON files in ./seo-audits/2026-12-01/.
Write a Python script to generate ./seo-audits/2026-12-01/keyword-gap.csv keeping only keywords where:
1. A competitor ranks position <= 20 and yourdomain.com is absent or ranks > 20;
2. The term is not a competitor brand name;
3. The intent is commercial, comparison, pricing, or concrete technical how-to;
4. Check ./src/content/posts/ and add an `existing_slug_conflict` column if we already cover the topic.
Keep keyword, competitor_domain, competitor_position, competitor_url, search_volume, keyword_difficulty, intent, and position_seen_at.
调 data:seo.backlinks 拉竞品外链时,保持默认的 one_per_domain: true,让每个网站只返回一条链接,省得同一个网站的页脚或侧边栏把 50 行额度占满。数据存下来以后,在本地挑出还在生效的 dofollow 链接,去掉垃圾风险分偏高的网站;如果你打算做死链替换,就单独筛出 is_broken: true 的条目。
拿到候选网站后,别急着发邮件联系。先用 data:seo.domain_rating(每次 $0.005)把前 10 个站过一遍 DR,挑出 DR 在 40 以上的前 2 个重点站,再查它们的月度 DR 走势(domain_rating_history)和外链概况(backlink_summary)。要是哪个站某个月 DR 突然拉高又很快掉下来,或者垃圾分偏高,直接跳过就好。另外接口返回 has_data: false 只是暂时没收录到记录,单独标出来,别把它当成 DR 0。
Run BeatAPI data:seo.backlinks for competitor1.com and competitor2.com with one_per_domain=true and limit=50 (no country or language).
Save to ./seo-audits/2026-12-01/backlinks-raw.json.
Filter locally for dofollow=true, is_lost=false, and low spam_score, deduplicated by source_domain.
Pick the top 10 editorial or directory outreach targets and check data:seo.domain_rating ($0.005 each).
For the top 2 sites with domain_rating >= 40, check data:seo.domain_rating_history and data:seo.backlink_summary to flag sudden one-month spikes.
Export ./seo-audits/2026-12-01/backlink-prospects.csv with source_domain, source_url, target_url, anchor, domain_rating, link_authority, spam_score, and outreach_angle.
web_read 读竞品高流量文章,直接整理写作大纲光看关键词表还很难决定怎么写,最好直接打开对手拿流量的文章看看人家是怎么组织的。BeatAPI 远程 MCP 在同一把 Key 下带了 BeatAPI Web Search API 的 web_read,每读一个网页收 $0.002。先用 data:seo.top_pages 拉出两个同行流量最高的前 10 个 URL,对照第二步的关键词缺口挑出 4 篇,让 Claude Code 把正文读成干净的 Markdown,整理出对方的小标题结构、漏写的信息,以及我们准备怎么写的大纲。
Run BeatAPI data:seo.top_pages (country="us", language="en", limit=10) for competitor1.com and competitor2.com.
Cross-check with ./seo-audits/2026-12-01/keyword-gap.csv and select the 4 best competitor pages we can realistically beat.
Read those 4 URLs with BeatAPI web_read ($0.002 per URL) and save ./seo-audits/2026-12-01/content-briefs.md.
For each page, list its H2 structure, concrete gaps (outdated pricing, missing code or constraints), our recommended angle, and internal links.
Print the total usage.price_usd across all 4 steps.
按 BeatAPI 公开的按次和按行单价算,跑完上面 2 个竞品的四步一共花 $0.4314。每次扣费前都可以先跑一次免费的 capabilities_inspect 看报价,跑完在返回的 usage.price_usd 里核对实扣金额。
| 步骤 | 调用接口 | 用量 | 公开单价 | 小计(USD) |
|---|---|---|---|---|
| 第一步:找同行 | data:seo.competitors | 1 次 × 20 行 | $0.018/次 + $0.0003/行 | $0.0240 |
| 第二步:查排名词 | data:seo.ranked_keywords | 3 次 × 50 行(2 同行 + 自己) | $0.018/次 + $0.0003/行 | $0.0990 |
| 第三步:导竞品外链 | data:seo.backlinks | 2 次 × 50 行 | $0.035/次 + $0.0002/行 | $0.0900 |
| 第三步:DR 初筛 | data:seo.domain_rating | 10 个候选站 | $0.005/次 | $0.0500 |
| 第三步:重点站复核 | domain_rating_history + backlink_summary | 2 站 × 6 个月 + 2 次概况 | $0.004/月;$0.035/次 + $0.0002/行 | $0.1184 |
| 第四步:热门 URL + 读正文 | data:seo.top_pages + web_read | 2 次 × 10 行 + 4 篇网页 | $0.018/次 + $0.0003/行;$0.002/URL | $0.0500 |
| 合计 | 22 次调用 | 2 个竞品完整流程 | — | $0.4314 |
有一点要提前留个余额:调用 domain_rating_history 之前,账户里得够覆盖 24 个月的预授权额度($0.096),不过最后还是只按实际返回了几个月扣费。全部接口的实时价格在 BeatAPI 定价 都能查到。
如果你手头正在对比几种给 Claude Code 接 SEO 数据的方案,可以按起步门槛、计费方式和能不能顺手读网页来挑:
| 方案 | 起步门槛 | 计费方式 | 能不能顺手读竞品网页 | 适合什么情况 |
|---|---|---|---|---|
| Ahrefs MCP | 约 $129/月(Lite 套餐起) | 扣套餐 API 单位(Lite 单次限 100 行,最低扣 50 单位) | 不能,要另接抓取工具 | 团队本来就在长期付费使用 Ahrefs |
| Semrush MCP | 约 $199/月(Starter 套餐起) | 扣套餐 API 单位(50,000 单位起) | 不能,要另接抓取工具 | 团队日常就在 Semrush 里管项目 |
| DataForSEO MCP | $50 账户最低充值(余额不过期) | 纯按量,底层单行价更低(Backlinks Live 为 $0.024/次 + $0.000036/行) | 要另开 On-Page 模块并手动删减多余工具 | 每天大批量拉数、自己搭数据管线的技术团队 |
| BeatAPI 远程 MCP | 按次预付,无月费,无 $50 起充门槛 | 按次加按行计费(上面 2 个竞品流程约 $0.43) | 能,同一把 Key 直接调 web_read 和 web_search | 按内容排期不定期查竞品的小团队,7 个固定工具不会给 Claude Code 带来太多上下文负担 |
domain_rating、domain_rating_history、backlink_summary 和 backlinks 这四个接口不分国家语言,传了 country 或 language 会直接返回 400 bad_request。校验在扣费前面,报错不会扣钱。ranked_keywords 返回的是带 position_seen_at 时间的记录快照,不是此刻的实时搜索结果。刚发布的新产品或新模型词在词库里经常暂时查不到月搜量,这时候直接在当前对话里调 web_search($0.005/次)看公开搜索结果就行。link_authority 当成 DR: link_authority 是 0 到 1000 分制,domain_rating 是 0 到 100 分制,两者算法不同,导表时分两列放。POST /v1/seo/* 写一个带 Idempotency-Key 请求头的 Python 脚本挂定时任务跑,既防重试重复扣费,也省掉多余的对话 Token。动手时可以先在内容仓库里放好上面那份 CLAUDE.md,拿 1 个最直接的同行试跑一遍(花费约 $0.22–$0.25)。看一眼生成的 keyword-gap.csv、backlink-prospects.csv 和 content-briefs.md 合不合用,顺手了再扩到 3 到 5 个同行,或者通过 BeatAPI Integrations 接入其他编程代理。
不建议照单全收。ranked_keywords 只告诉你竞品靠哪些词拿了排名,不会替你判断这个词跟产品有没有关系,也不会自动检查你站内是不是已经写过同类文章。先跟本地文章目录去重,再用 web_read 看一眼竞品那一篇的写法,确认自己能写出更准或更全的内容再动笔。
BeatAPI 的 backlinks 接口默认开了 one_per_domain: true,省得同一个网站在页脚或侧边栏的重复链接把单次 50 行额度占满。如果确实想看某一家媒体有几篇文章链向了竞品,把 one_per_domain 改成 false,再配合 limit 和 offset 翻页就行。
日常找竞品、查排名词、筛外链和读对手文章出大纲都覆盖到了。BeatAPI 远程 MCP 在同一把 API Key 下提供了 12 个 SEO 接口和 web_read、web_search。如果你还要看自己站点的每日真实点击曲线,或者扫全站几万个 URL 的技术问题,再配合 Google Search Console 或专门的站内爬虫工具就行。
三个办法一起用就行:在 CLAUDE.md 里写死每个列表接口的 limit;让 Claude Code 每次扣费前先跑免费的 capabilities_inspect 报预估金额;在 BeatAPI 账户里放一笔小额预付余额当上限。