| Crates.io | linkedin-profile-validator |
| lib.rs | linkedin-profile-validator |
| version | 0.1.0 |
| created_at | 2025-07-30 12:06:13.458028+00 |
| updated_at | 2025-07-30 12:06:13.458028+00 |
| description | A Rust library to validate LinkedIn profile URLs by checking format and profile existence |
| homepage | https://github.com/RustSandbox/linkedin_profile_validator |
| repository | https://github.com/RustSandbox/linkedin_profile_validator |
| max_upload_size | |
| id | 1773412 |
| size | 100,875 |
A robust Rust library to validate LinkedIn profile URLs, checking both format and profile existence.
Add this to your Cargo.toml:
[dependencies]
linkedin-profile-validator = "0.1.0"
Or use cargo add:
cargo add linkedin-profile-validator
use linkedin_profile_validator::is_valid_linkedin_profile_format;
fn main() {
let url = "https://www.linkedin.com/in/johndoe";
if is_valid_linkedin_profile_format(url) {
println!("Valid LinkedIn profile URL format!");
}
}
use linkedin_profile_validator::LinkedInValidator;
fn main() {
let validator = LinkedInValidator::new();
let url = "https://www.linkedin.com/in/johndoe";
match validator.is_valid_linkedin_profile_url(url) {
Ok(_) => println!("Profile exists!"),
Err(e) => println!("Invalid: {}", e),
}
}
use linkedin_profile_validator::validate_linkedin_url_async;
#[tokio::main]
async fn main() {
let url = "https://www.linkedin.com/in/johndoe";
match validate_linkedin_url_async(url).await {
Ok(_) => println!("Profile exists!"),
Err(e) => println!("Invalid: {}", e),
}
}
The library provides detailed error information:
InvalidUrl - The URL format is invalidNotLinkedInUrl - The URL is not from linkedin.com domainNotProfileUrl - The URL is not a profile URL (e.g., it's a company page)ProfileNotFound - The profile doesn't exist (redirects to 404)NetworkError - Network request failedAuthenticationRequired - LinkedIn requires authentication to verify the profileLinkedIn actively prevents automated profile checking and may:
When the library encounters these protections, it returns an AuthenticationRequired error. This doesn't necessarily mean the profile doesn't exist, just that LinkedIn is preventing automated verification.
To avoid being blocked by LinkedIn:
is_valid_linkedin_profile_format) when you don't need to verify existenceValid LinkedIn profile URLs follow this pattern:
https://www.linkedin.com/in/usernamehttps://linkedin.com/in/usernamehttps://www.linkedin.com/in/user-name-123/# Run tests
cargo test
# Check formatting and linting
cargo fmt -- --check
cargo clippy -- -D warnings
# Run the example
cargo run --example basic
# Build documentation
cargo doc --open
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate. See CONTRIBUTING.md for more details.
This project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.