长尾关键词是SEO的蓝海。我开发了一套系统,能从1个种子词自动扩展到1000个长尾词,并且评估每个词的竞争度和价值。这篇文章分享完整方案。
一、长尾词扩展的方法
1.1 搜索建议扩展
python
def expand_keywords_from_suggestions(seed: str, api_key: str, depth: int = 2) -> List[str]:
"""从搜索建议扩展关键词"""
all_keywords = set([seed])
current = [seed]
for _ in range(depth):
next_level = set()
for keyword in current:
headers = {
"X-API-Key": api_key,
"Content-Type": "application/json"
}
body = {
"q": keyword,
"hl": "en",
"gl": "us",
"page": 1
}
r = requests.post("https://api.serpbase.dev/google/search",
headers=headers, json=body, timeout=30)
data = r.json()
# 从相关搜索扩展
related = data.get("related_searches", [])
for q in related:
if q not in all_keywords:
next_level.add(q)
all_keywords.add(q)
# 从PAA扩展
paa = data.get("people_also_ask", [])
for item in paa:
q = item.get("question", "")
if q and q not in all_keywords:
next_level.add(q)
all_keywords.add(q)
current = list(next_level)
return list(all_keywords)
1.2 修饰词扩展
python
MODIFIERS = {
"question": ["how to", "what is", "why does", "how does", "can you"],
"comparison": ["vs", "versus", "or", "alternative", "compared to"],
"location": ["near me", "in [city]", "local", "best in"],
"price": ["cheap", "affordable", "expensive", "price", "cost"],
"time": ["2026", "this year", "now", "today", "recent"],
"quality": ["best", "top", "good", "bad", "review"],
"action": ["buy", "get", "find", "download", "use"]
}
def expand_with_modifiers(seed: str) -> List[str]:
"""用修饰词扩展关键词"""
expanded = []
for category, modifiers in MODIFIERS.items():
for mod in modifiers:
if category == "location" and "[city]" in mod:
# 跳过需要替换的
continue
expanded.append(f"{mod} {seed}")
expanded.append(f"{seed} {mod}")
return expanded
1.3 组合扩展
python
def combine_keywords(keywords: List[str]) -> List[str]:
"""组合关键词生成长尾词"""
combined = []
for i, kw1 in enumerate(keywords):
for kw2 in keywords[i+1:]:
combined.append(f"{kw1} {kw2}")
combined.append(f"{kw1} for {kw2}")
combined.append(f"{kw1} vs {kw2}")
return combined
二、长尾词评估
2.1 竞争度评估
python
def evaluate_long_tail_competition(keyword: str, api_key: str) -> Dict:
"""评估长尾词竞争度"""
headers = {
"X-API-Key": api_key,
"Content-Type": "application/json"
}
body = {
"q": keyword,
"hl": "en",
"gl": "us",
"page": 1
}
r = requests.post("https://api.serpbase.dev/google/search",
headers=headers, json=body, timeout=30)
data = r.json()
organic = data.get("organic", [])
# 计算竞争指标
indicators = {
"result_count": len(organic),
"has_ads": False, # SerpBase可能不返回广告
"has_snippet": len(data.get("people_also_ask", [])) > 0,
"has_knowledge": data.get("knowledge_graph") is not None,
"big_sites_in_top5": sum(1 for item in organic[:5]
if any(d in item.get("display_link", "")
for d in ["amazon.com", "wikipedia.org", "youtube.com"])),
"avg_title_length": sum(len(item.get("title", "")) for item in organic[:5]) / 5 if organic else 0
}
# 竞争分数
score = 0
score += indicators["big_sites_in_top5"] * 10
score += 20 if indicators["has_knowledge"] else 0
score += 15 if indicators["has_snippet"] else 0
score += max(0, 10 - indicators["result_count"] / 10)
return {
"keyword": keyword,
"competition_score": min(score, 100),
"difficulty": (
"high" if score > 60 else
"medium" if score > 30 else
"low"
),
"indicators": indicators
}
2.2 价值评估
python
def evaluate_keyword_value(keyword: str) -> Dict:
"""评估关键词商业价值"""
value_signals = {
"buying_intent": 0,
"informational_intent": 0,
"local_intent": 0
}
keyword_lower = keyword.lower()
# 购买意图
buying_words = ["buy", "purchase", "price", "discount", "deal", "coupon", "best"]
value_signals["buying_intent"] = sum(1 for w in buying_words if w in keyword_lower)
# 信息意图
info_words = ["how to", "what is", "guide", "tutorial", "learn"]
value_signals["informational_intent"] = sum(1 for w in info_words if w in keyword_lower)
# 本地意图
local_words = ["near me", "local", "in ", "nearby"]
value_signals["local_intent"] = sum(1 for w in local_words if w in keyword_lower)
# 商业价值分数
commercial_score = value_signals["buying_intent"] * 10 + value_signals["local_intent"] * 5
return {
"keyword": keyword,
"commercial_score": commercial_score,
"intent_type": (
"transactional" if value_signals["buying_intent"] > 0 else
"local" if value_signals["local_intent"] > 0 else
"informational"
),
"value_signals": value_signals
}
三、完整扩展流水线
python
def full_long_tail_pipeline(seed: str, api_key: str, max_keywords: int = 1000) -> List[Dict]:
"""完整的长尾词扩展流水线"""
print(f"Starting expansion from seed: {seed}")
# 1. 扩展
expanded = expand_keywords_from_suggestions(seed, api_key, depth=2)
expanded.extend(expand_with_modifiers(seed))
if len(expanded) > max_keywords:
expanded = expanded[:max_keywords]
print(f"Expanded to {len(expanded)} keywords")
# 2. 去重和过滤
expanded = list(set(expanded))
expanded = [k for k in expanded if 3 <= len(k.split()) <= 8] # 3-8个词
print(f"After filtering: {len(expanded)} keywords")
# 3. 评估
results = []
for keyword in expanded:
comp = evaluate_long_tail_competition(keyword, api_key)
value = evaluate_keyword_value(keyword)
# 综合评分
overall_score = (100 - comp["competition_score"]) * 0.6 + value["commercial_score"] * 0.4
results.append({
"keyword": keyword,
"competition": comp["difficulty"],
"competition_score": comp["competition_score"],
"commercial_score": value["commercial_score"],
"intent": value["intent_type"],
"overall_score": overall_score,
"recommendation": (
"prioritize" if overall_score > 60 else
"consider" if overall_score > 40 else
"deprioritize"
)
})
# 4. 排序
results.sort(key=lambda x: x["overall_score"], reverse=True)
return results
四、实战数据
从"project management software"扩展到1000个长尾词:
| 类别 | 数量 | 平均竞争度 | 平均商业价值 |
|---|---|---|---|
| How-to | 234 | 低 | 中 |
| Best/Top | 189 | 中 | 高 |
| Comparison | 156 | 中 | 高 |
| Price/Cost | 123 | 低 | 高 |
| For [industry] | 198 | 低 | 中 |
| Alternative | 100 | 中 | 中 |
五、总结
长尾词扩展的核心:
- 多维度扩展:搜索建议+修饰词+组合
- 竞争评估:SERP特征判断难度
- 价值评估:意图判断商业潜力
- 优先级排序:低竞争+高价值优先
- 持续扩展:每月扩展新词
长尾词扩展是SEO中最有技术含量的工作之一。它不需要创意,但需要系统性的方法。这套流水线可以从1个种子词扩展到1000个长尾词,并且自动评估每个词的价值。SerpBase的成本大约3/千次,扩展1000个词评估成本3,产出是一份优先级明确的关键词清单。