fix(share): add more social media bot user agents

Add facebookcatalog, meta-externalagent, pinterestbot and organize
bot list with comments by platform.
pull/3227/head
WittF 8 months ago
parent 4ef97bf244
commit d9f0612819
No known key found for this signature in database

@ -5,14 +5,25 @@ import "strings"
// IsSocialMediaBot checks if the User-Agent belongs to a social media crawler. // IsSocialMediaBot checks if the User-Agent belongs to a social media crawler.
func IsSocialMediaBot(ua string) bool { func IsSocialMediaBot(ua string) bool {
bots := []string{ bots := []string{
// Meta (Facebook, Instagram, WhatsApp)
"facebookexternalhit", "facebookexternalhit",
"facebookcatalog",
"facebot",
"meta-externalagent",
// Twitter/X
"twitterbot", "twitterbot",
// LinkedIn
"linkedinbot", "linkedinbot",
"whatsapp", // Discord
"slackbot",
"discordbot", "discordbot",
// Telegram
"telegrambot", "telegrambot",
"facebot", // Slack
"slackbot",
// WhatsApp
"whatsapp",
// Pinterest
"pinterestbot",
} }
ua = strings.ToLower(ua) ua = strings.ToLower(ua)
for _, bot := range bots { for _, bot := range bots {

Loading…
Cancel
Save