# ua_generator
Generate random real User-Agents to use as spoofs.
## How to use
Example of generating a randomized user agent. The list is updated every day at 8am for the latest agents.
```rust
use ua_generator::ua::spoof_ua;
fn main() {
let ua = spoof_ua();
println!("{}", ua); // Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36
};
```
If you plan on using this building locally you need a valid API key from the [API Layer User Agent API](https://apilayer.com/marketplace/user_agent-api) and set the value to the env var `APILAYER_KEY`. You can run `BUILD_ENABLED=1 APILAYER_KEY=$APILAYER_KEY cargo build` to generate the static files.
The static files are checked in instead of set to a `build.rs` file to prevent extra need for API calls. The API used to get the agents are limited and require authentication. The limits all for generating daily user agents for everyone to use without needing an API key.
## TODO
1. ~~Update user-agent list via CRON github actions~~.