You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
431 B
25 lines
431 B
package util
|
|
|
|
import "strings"
|
|
|
|
// IsSocialMediaBot checks if the User-Agent belongs to a social media crawler.
|
|
func IsSocialMediaBot(ua string) bool {
|
|
bots := []string{
|
|
"facebookexternalhit",
|
|
"twitterbot",
|
|
"linkedinbot",
|
|
"whatsapp",
|
|
"slackbot",
|
|
"discordbot",
|
|
"telegrambot",
|
|
"facebot",
|
|
}
|
|
ua = strings.ToLower(ua)
|
|
for _, bot := range bots {
|
|
if strings.Contains(ua, bot) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|