| Crates.io | rand_user_agent |
| lib.rs | rand_user_agent |
| version | 0.2.1 |
| created_at | 2023-04-28 06:33:04.901814+00 |
| updated_at | 2024-09-10 07:18:27.123247+00 |
| description | Randomly generate common userAgents,used by spider |
| homepage | |
| repository | https://github.com/xyanyue/rand_user_agent.git |
| max_upload_size | |
| id | 851184 |
| size | 36,304 |
This is a program that randomly generates UserAgents.
这是一个随机生成UserAgent的程序
println!("{}", UserAgent::random().to_string());
// Random mobile agent. [随机手机端agent]
println!("Mobile:{}", UserAgent::mobile().to_string());
// Random Desktop agent.随机PC端
println!("Pc:{}", UserAgent::pc().to_string());
Browser、Devices、DesktopDevice、MobileDeviceimpl rand::distributions::Standard
println!(
"custom Mobile Iphone Chrome:{}",
UserAgent::custom(Devices::Mobile(MobileDevice::Iphone), Browser::Chrome)
);
//first
println!(
"custom Desktop Windows random browser :{}",
UserAgent::custom(Devices::Desktop(DesktopDevice::Windows), rand::random())
);
//two
let mut rng = rand::thread_rng();
println!(
"custom random Mobile & random browser :{}",
UserAgent::custom(Devices::Mobile(rand::random()), Browser::random(&mut rng))
);