Created
October 24, 2016 13:00
-
-
Save Jalalx/887fdce314f5e29b6dc034621820b6c3 to your computer and use it in GitHub Desktop.
Detects most know crowlers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BotUserAgentUtility | |
{ | |
public static bool IsBot(string userAgent) | |
{ | |
var Crawlers = new List<string>() | |
{ | |
"googlebot","bingbot","yandexbot","ahrefsbot","msnbot","linkedinbot","exabot","compspybot", | |
"yesupbot","paperlibot","tweetmemebot","semrushbot","gigabot","voilabot","adsbot-google", | |
"botlink","alkalinebot","araybot","undrip bot","borg-bot","boxseabot","yodaobot","admedia bot", | |
"ezooms.bot","confuzzledbot","coolbot","internet cruiser robot","yolinkbot","diibot","musobot", | |
"dragonbot","elfinbot","wikiobot","twitterbot","contextad bot","hambot","iajabot","news bot", | |
"irobot","socialradarbot","ko_yappo_robot","skimbot","psbot","rixbot","seznambot","careerbot", | |
"simbot","solbot","mail.ru_bot","spiderbot","blekkobot","bitlybot","techbot","void-bot", | |
"vwbot_k","diffbot","friendfeedbot","archive.org_bot","woriobot","crystalsemanticsbot","wepbot", | |
"spbot","tweetedtimes bot","mj12bot","who.is bot","psbot","robot","jbot","bbot","bot" | |
}; | |
// HttpContext.Current.Request.UserAgent.ToLower(); | |
userAgent = userAgent.ToLower(); | |
var iscrawler = Crawlers.Exists(x => userAgent.Contains(x)); | |
return iscrawler; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment