Files
jiang13-forum/service/crawler.go
freefire 4ca5c17e2e fix: 拆除爬虫专用 HTML,并补齐 /favicon.ico 与 head 图标注入
人机统一走 SPA/首页 SSR;约定路径与 link rel=icon 便于爬虫识别站点图标。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-01 07:15:06 +08:00

56 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package service
import "strings"
// 常见搜索引擎 / 社交预览 / SEO 工具的 User-Agent 片段(小写匹配)
var seoCrawlerTokens = []string{
"googlebot",
"google-inspectiontool",
"bingbot",
"baiduspider",
"yandexbot",
"duckduckbot",
"slurp", // Yahoo
"sogou",
"bytespider",
"petalbot",
"applebot",
"facebookexternalhit",
"facebot",
"twitterbot",
"linkedinbot",
"discordbot",
"telegrambot",
"slackbot",
"whatsapp",
"preview", // 部分通用预览 UA
"embedly",
"quora link preview",
"pinterest",
"vkshare",
"w3c_validator",
"ahrefsbot",
"semrushbot",
"dotbot",
"mj12bot",
"gptbot",
"claudebot",
"anthropic-ai",
"chatgpt-user",
"oai-searchbot",
}
// IsSEOCrawler 是否为搜索引擎 / 社交预览类爬虫(供访问监控打 is_bot公开页不再按 UA 分叉 HTML
func IsSEOCrawler(userAgent string) bool {
ua := strings.ToLower(strings.TrimSpace(userAgent))
if ua == "" {
return false
}
for _, token := range seoCrawlerTokens {
if strings.Contains(ua, token) {
return true
}
}
return false
}