Crate botagent

Source
Expand description

This library provides functionality to detect bot user agents using regular expressions.

It reads patterns from a JSON File, compiles them into a regex, and checks user agents against these patterns.

Modules§

errors
Error Handling Module
pattern
Pattern Generation Module

Functions§

create_is_bot
Creates a closure that checks if a user agent string matches a custom regex pattern
create_is_bot_from_list
Creates a function to check if a user agent matches any bot pattern from a list.
init_pattern
Initialize the global regex pattern, only done once.
is_bot
Check if the given user agent includes a bot pattern.
is_bot_match
Find the first non-empty capture group match of a bot pattern in the user agent string.
is_bot_matches
Check if the given user agent matches any patterns in the provided JSON file.
is_bot_pattern
Check if the given user agent matches any bot pattern and return the matching pattern.
is_bot_patterns
Check which bot patterns from the given JSON file match the user agent.