<dependency>
<groupId>ch.javacamp.bot-detector</groupId>
<artifactId>bot-detector</artifactId>
<version>1.0.1</version>
</dependency>
package ch.javacamp.botdetector.examples;
import ch.javacamp.botdetector.Assessment;
import ch.javacamp.botdetector.Bots;
import ch.javacamp.botdetector.RequestDescriptor;
public class DetectionExample {
public static void main(String[] args) {
RequestDescriptor descriptor = RequestDescriptor.create("66.249.79.195", "... Googlebot/2.1; ...");
Assessment actual = Bots.detector().detect(descriptor);
if(actual.isBot()){
System.out.println("a bot...");
}
}
}
package ch.javacamp.botdetector.examples;
import ch.javacamp.botdetector.BotDescription;
import ch.javacamp.botdetector.Bots;
import ch.javacamp.botdetector.RequestDescriptor;
import java.util.Optional;
public class DetectionIdentificationExample {
public static void main(String[] args) {
RequestDescriptor descriptor = RequestDescriptor.create("66.249.79.195", "... Googlebot/2.1; ...");
Optional<BotDescription> actual = Bots.detector().detect(descriptor).identifyVerified();
actual.ifPresent(a -> System.out.println(a.name()));
actual.ifPresent(a -> System.out.println(a.verification()));
}
}
The available verification rules can be seen here: Link