Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using UADetector To detect Robots

I am testing Java user-agent detector API http://uadetector.sourceforge.net. According to the project home page the API can detect robots. But looking at the docs and playing around with the API I can't find reference to Robots.

Can anyone direct me to the right direction?

like image 303
eboraks Avatar asked Oct 03 '22 11:10

eboraks


1 Answers

You can do it like this:

UserAgentStringParser parser = UADetectorServiceFactory.getOnlineUpdatingParser();
ReadableUserAgent agent = parser.parse(request.getHeader("User-Agent"));
UserAgentType type = agent.getUserAgentType();  // this can be ROBOT, BROWSER, etc.

For more information, check this site and this example.

like image 127
Erik Pragt Avatar answered Oct 07 '22 23:10

Erik Pragt