Go library to detect bots based on the HTTP request. A “bot” is defined as any request that isn’t a regular browser request initiated by the user. This includes things like web crawlers, but also stuff like “preview” renderers and the like.
Bot() accepts a
http.Request since it looks at all information, not just
User-Agent. You can use
UserAgent() if you just have a
it’s highly recommended to use
zgo.at/isbot; API docs: https://pkg.go.dev/zgo.at/isbot
It’s not 100% reliable, and there are some known cases where it gets things
isbot_test.go for a list of test cases.
The performance is pretty good; turns out that running a few
is loads faster than a