What You'll Learn
- • Setting up your development environment
- • Installing the required HTTP client
- • Authenticating with the ScrapeCreators API
- • Making requests to LinkedIn
- • Handling responses and errors
- • Best practices for production use
Extract profile data from LinkedIn
Learn how to scrape LinkedIn profiles using Rust. This comprehensive guide will walk you through the entire process, from setup to implementation.
First, you'll need a ScrapeCreators API key to authenticate your requests.
Sign up at app.scrapecreators.com to get your free API key with 100 requests.
Make sure you have the following installed:
Reqwest is a high-level HTTP client for Rust
cargo add reqwest
Now let's make a request to the LinkedIn API using Rust. Replace YOUR_API_KEY
with your actual API key.
use reqwest;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let result = scrape().await?;
println!("Response: {}", result);
Ok(())
}
async fn scrape() -> Result<String, Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
// Build query parameters
let mut params = HashMap::new();
params.insert("url".to_string(), "https://www.linkedin.com/in/parrsam/".to_string());
let response = client
.get("https://api.scrapecreators.com/v1/linkedin/profile")
.header("x-api-key", "YOUR_API_KEY")
.header("Content-Type", "application/json")
.query(¶ms)
.send()
.await?;
if response.status().is_success() {
let body = response.text().await?;
Ok(body)
} else {
Err(format!("HTTP {}: {}", response.status(), response.text().await?).into())
}
}
This endpoint accepts the following parameters:
url
Required(string)The URL of the LinkedIn profile to get
Example: https://www.linkedin.com/in/parrsam/
Execute your script to test the API connection. You should see a JSON response with LinkedIn profiles data.
✅ Success: You should receive a structured JSON response containing the requested data.
Here's an example of the JSON response you'll receive:
{
"success": true,
"name": "Sam Parr",
"image": "https://media.licdn.com/dms/image/v2/C4E03AQH3Vz1qV_rNVQ/profile-displayphoto-shrink_200_200/profile-displayphoto-shrink_200_200/0/1633389534107?e=2147483647&v=beta&t=8x4PIfTIYFOvpI1QRCDyAhNprZv0NY9kAp4EOdvUxLQ",
"location": "Westport, Connecticut, United States",
"followers": 64803,
"connections": "",
"about": "I founded The Hustle, a business news media company with $12 when I was around 25 years…",
"recentPosts": [
{
"title": "Super excited to watch the success of a company built by a Gauntlet AI grad: One missed contract renewal can cost your company $100k, $250k or more.…",
"activityType": "Posted by Austen Allred",
"link": "https://www.linkedin.com/posts/austenallred_super-excited-to-watch-the-success-of-a-company-activity-7333305862695919617-zTPI",
"image": "https://static.licdn.com/aero-v1/sc/h/53n89ecoxpr1qrki1do3alazb"
},
{
"title": "Imagine if software engineers declared that programming doesn't work if their program didn't compile on the first try. That's basically the level of…",
"activityType": "Posted by Austen Allred",
"link": "https://www.linkedin.com/posts/austenallred_imagine-if-software-engineers-declared-that-activity-7325898973485879296-jTB4",
"image": "https://static.licdn.com/aero-v1/sc/h/53n89ecoxpr1qrki1do3alazb"
}
],
"experience": [
{
"@type": "Organization",
"name": "Hampton",
"url": "https://www.linkedin.com/company/myhampton",
"location": "Austin, Texas Metropolitan Area",
"member": {
"@type": "OrganizationRole",
"description": "******* ** * ****** ****** ********** ********* *** *************, ******** *** ****. <**><**>**'** ** * *** ****, *** ***...* *****.<**><**>*****://***.***********.***/"
}
},
{
"@type": "Organization",
"name": "** ***** *******",
"member": {
"@type": "OrganizationRole",
"description": "** ***** ******* ** * ******* ***** ** *** ******. ***** **** *** * *** *** *****.<**><**>**** ***** **** ** **** *** ****** ** **** ****.<**><**>**'** *** *** ** *** **** ******** ** ******* ******** **** **** ** ******** ** *********."
}
}
],
"articles": [
{
"headline": "RANT: How to PROPERLY analyze risk",
"author": "Sam Parr",
"datePublished": "2017-09-17T13:08:55.000+00:00",
"image": "https://media.licdn.com/dms/image/v2/C5612AQG9YbLJodxr8g/article-cover_image-shrink_720_1280/article-cover_image-shrink_720_1280/0/1520096757452?e=2147483647&v=beta&t=USPma8tkR65yot8_Ye0zDfH2llLpTrZdZGHtbzmPjQ0",
"articleBody": "I've been talking to a few people who want to leave...."
}
],
"activity": [
{
"title": "Othership is this cool suana place in NYC. The founder is hosting a bunch of Hampton members for a special session + a talk on how he built the…",
"activityType": "Shared by Sam Parr",
"link": "https://www.linkedin.com/posts/parrsam_exclusive-othership-session-qa-with-founder-activity-7328134812047704064-4NUL",
"image": "https://media.licdn.com/dms/image/sync/v2/D4D27AQGJaeiyu-gbrA/articleshare-shrink_1280_800/B4DZbLDrHUHsAU-/0/1747163460743?e=2147483647&v=beta&t=rZtGF2kjhFfLy-TZil0d_bakH4UfHnK-dcxEsrZSl5s"
},
{
"title": "If you live in SF, LA ...and want to lead a bunch of startup ceos/founders ...and want to have the best network ever then this is for you: I'm…",
"activityType": "Shared by Sam Parr",
"link": "https://www.linkedin.com/posts/parrsam_careers-activity-7328088180820193281-3j6g",
"image": "https://media.licdn.com/dms/image/sync/v2/D4E27AQFwp04bg9zFpg/articleshare-shrink_800/articleshare-shrink_800/0/1743914613899?e=2147483647&v=beta&t=PWPWBgbYTxLt6u53gLNzEO0laXD2AFd5LBPKId4Fm9Y"
}
],
"education": [
{
"@type": "EducationalOrganization",
"name": "Belmont University",
"url": "https://www.linkedin.com/school/belmont-university/",
"member": {
"@type": "OrganizationRole",
"startDate": 2008,
"endDate": 2012
}
}
],
"publications": [
{
"name": "How my partner and I created a unique company in tough times",
"url": "http://online.wsj.com/article/SB10001424127887324694904578602013087282582.html&urlhash=SvYD"
},
{
"name": "Our infographic and app get a shout out in the Huffington Post",
"url": "http://www.huffingtonpost.com/2013/08/09/roommates-app-la_n_3733587.html&urlhash=u66P"
},
{
"name": "Shout from the LA Times",
"url": "http://www.latimes.com/business/technology/la-fi-tn-roommate-finding-apps-20130816,0,595590.story&urlhash=yblh"
}
],
"projects": [
{
"name": "Hustle Con 2015",
"url": "https://www.linkedin.com/in/elizabethyin",
"dateRange": "2015",
"description": "",
"contributors": [
{
"name": "Elizabeth Yin",
"link": "https://www.linkedin.com/in/elizabethyin",
"image": "https://media.licdn.com/dms/image/v2/C5603AQFFdhmfyyiZig/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1581292451105?e=2147483647&v=beta&t=IwghMTQZZjJzIGbN6e1IYfWVBDAkgLP_kSJJPOkzQDg"
}
]
},
{
"name": "The Roommates App",
"url": "http://roommate.apartmentlist.com/",
"dateRange": "Mar 2013 - Present",
"description": "Roommates is an easy and fun way to meet new potential roommates. It functions much like Tinder, in that you browse profiles one at a time and are only able to chat once you have mutual interest in each other.",
"contributors": [
{
"name": "Jake Moffatt",
"link": "https://www.linkedin.com/in/jakeonrails",
"image": "https://media.licdn.com/dms/image/v2/D5603AQFi9y-GqH832w/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1719008688472?e=2147483647&v=beta&t=lelf--Z_vVdOKUfXM_LTKRgUgUTkpmdKS4fyOFJeYLc"
},
{
"name": "John Havel",
"link": "https://www.linkedin.com/in/jhavel",
"image": "https://media.licdn.com/dms/image/v2/C5603AQEKBX3RdWYlSw/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1588215318616?e=2147483647&v=beta&t=WiHWmfUczafX3mAYnS8ZBLGKFXISlV_FZkHW5oqyUJM"
}
]
}
],
"recommendations": [
{
"name": "Jackie M.",
"link": "https://www.linkedin.com/in/jackiemooney",
"image": "https://static.licdn.com/aero-v1/sc/h/9c8pery4andzj6ohjkjp54ma2",
"text": "“I got to know Sam over 2 years of working at The Hustle. We grew from a company of 4 to 15 in that time and there was never a dull moment- anyone who knows Sam knows that he adds tons of energy to the workplace. This guy figures out what he wants to accomplish and makes it happen. He remains wildly driven and goal-oriented while constantly focused on both his personal and professional growth.”"
},
{
"name": "Michael Cheung",
"link": "https://www.linkedin.com/in/themichaelcheung",
"image": "https://media.licdn.com/dms/image/v2/C5603AQGBj0wY-4ePhg/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1586460717915?e=2147483647&v=beta&t=uGi9GocopqdNH3aUPCv5hEvmnq24YR8VBbzBAz_Pmbw",
"text": "“Sam is a hustler that and serial entrepreneur. He just figures out how to get things done and \"win\". Mark my words, this kid is going places!”"
}
],
"similarProfiles": [
{
"link": "https://ca.linkedin.com/in/stevemcody",
"name": "Steve Cody",
"image": "https://media.licdn.com/dms/image/v2/D5603AQEl17hna0u1ew/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1673387873184?e=2147483647&v=beta&t=pN-Y2CS1AQ8AOKbTo_2_B0AXjof4nGLKBdhNZTfFYJA"
}
]
}
Check that your response includes the expected fields:
success
(boolean)name
(string)image
(string)location
(string)followers
(number)Implement comprehensive error handling and retry logic for failed requests. Log errors properly for debugging.
Cache responses when possible to reduce API calls and improve performance. Consider data freshness requirements.
Never expose your API key in client-side code. Use environment variables and secure key management practices.
When scraping multiple profiles, consider batching requests to maximize throughput while staying within rate limits.
Use asynchronous processing in Rust to handle multiple requests concurrently and improve overall performance.
Analyze LinkedIn profiles to understand market trends, competitor analysis, and audience insights.
Track performance metrics, engagement rates, and content trends across LinkedIn profiles.
Identify potential customers and business opportunities throughLinkedIn data analysis.
Check your API key is correct and properly formatted in the x-api-key header.
You ran out of credits and need to buy more.
The resource might not exist or be private.
Temporary server issue. Implement retry logic with exponential backoff.
ScrapeCreators offers 100 free API calls to get started. After that, pricing starts at $10 for 5k requests with volume discounts available.
Scraping publicly available data is fair game, and we only collect public data. So anything that you can see in an incognito browser is what we collect.
There is no rate limit! So you can scrape as fast as you want!
All API responses are returned in JSON format, making it easy to integrate with any programming language or application.
Yes! This tutorial focuses on core Rust HTTP concepts that work with any framework. The API calls remain the same regardless of your specific Rust setup.
For large datasets, implement pagination, use streaming responses where available, and consider storing data in a database for efficient querying.
Get started with 100 free API calls. No credit card required.