# Linkedin Mutual Connection Analyzer (`dead00/linkedin-mutual-connection-analyzer`) Actor

A LinkedIn Connection Analyzer that analyzes LinkedIn profiles and determines connection degrees between you and target profiles.

- **URL**: https://apify.com/dead00/linkedin-mutual-connection-analyzer.md
- **Developed by:** [Dead](https://apify.com/dead00) (community)
- **Categories:** Lead generation, Social media, Other
- **Features:** Limited permissions
- **Stats:** 96 total users, 0 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: 2.38 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## LinkedIn Connection Analyzer

A LinkedIn Connection Analyzer that analyzes LinkedIn profiles and determines connection degrees between you and target profiles. This tool provides comprehensive profile data extraction along with sophisticated connection degree analysis.

### 🚀 Features

- **Connection Degree Analysis**: Accurately determines 1st, 2nd, 3rd degree connections or if profiles are out of network
- **Comprehensive Profile Scraping**: Extracts detailed profile information including experience, education, skills, and contact details
- **Cookie-Based Authentication**: Uses browser cookies for seamless LinkedIn authentication
- **Robust Error Handling**: Comprehensive logging and error management
- **Apify Integration**: Built as an Apify Actor for easy deployment and scaling

### 📋 What Gets Extracted

#### Profile Information

- **Basic Info**: Name, headline, summary, location, industry
- **Professional Data**: Work experience, education history, skills
- **Contact Information**: Email, phone, social media links (when available)
- **Visual Assets**: Profile picture and background image URLs
- **Accomplishments**: Certifications, publications, projects, etc.

#### Connection Analysis

- **Connection Degree**: 1st, 2nd, 3rd degree, or "Not connected"
- **Connection Confidence**: Multiple validation methods for accuracy

### 🔧 Configuration

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `profile_url` | String | ✅ | LinkedIn profile URL to analyze |
| `cookies` | Array | ✅ | Browser cookies from EditThisCookie extension |

#### Cookie Setup

1. **Install EditThisCookie Extension** (Chrome/Firefox)
2. **Login to LinkedIn** in your browser
3. **Export Cookies**:
   - Navigate to LinkedIn.com
   - Click EditThisCookie extension
   - Click "Export" button
   - Copy the JSON array
4. **Use in Input**: Paste the cookies array as the `cookies` parameter

#### Sample Input

```json
{
  "profile_url": "https://www.linkedin.com/in/john-doe",
  "cookies": [
    {
      "name": "li_at",
      "value": "your-li-at-cookie-value",
      "domain": ".linkedin.com",
      "path": "/",
      "secure": true,
      "httpOnly": true
    },
    {
      "name": "JSESSIONID",
      "value": "your-jsessionid-value",
      "domain": ".linkedin.com",
      "path": "/",
      "secure": true
    }
  ]
}
```

### 🎯 Usage Examples

#### Basic Profile Analysis

```python
## Input
{
  "profile_url": "https://www.linkedin.com/in/jane-smith",
  "cookies": [/* your cookies array */]
}

## Output includes connection degree and full profile data
```

#### Supported URL Formats

- `https://www.linkedin.com/in/username`
- `https://linkedin.com/in/username/`
- `https://www.linkedin.com/profile/view?id=username`
- `https://linkedin.com/pub/name/id/id/username`

### 📊 Output Format

```json
{
  "profile_url": "https://www.linkedin.com/in/john-doe",
  "profile_id": "john-doe",
  "connection_degree": "2nd Degree Connection",
  "basic_info": {
    "firstName": "John",
    "lastName": "Doe",
    "headline": "Software Engineer at Tech Company",
    "summary": "Experienced software engineer...",
    "location": "San Francisco, CA",
    "industry": "Technology",
    "profile_picture": "https://...",
    "background_image": "https://..."
  },
  "experience": [
    {
      "title": "Software Engineer",
      "company": "Tech Company",
      "duration": "2020 - Present",
      "description": "..."
    }
  ],
  "education": [
    {
      "school": "University Name",
      "degree": "Bachelor of Science",
      "field": "Computer Science",
      "years": "2016 - 2020"
    }
  ],
  "skills": ["Python", "JavaScript", "React"],
  "contact_info": {
    "email": "john@example.com",
    "phone": "+1234567890"
  },
  "connection_analysis": {
    "degree": "2nd Degree Connection",
    "connection_related_fields": {}
  }
}
```

### ⚠️ Important Notes

#### Rate Limits

- LinkedIn has strict rate limiting
- Recommended: 1-2 requests per minute
- Use delays between requests for large batches

#### Cookie Management

- Cookies expire periodically (typically 24-48 hours)
- Monitor authentication status
- Refresh cookies when needed

#### LinkedIn Terms of Service

- Respect LinkedIn's Terms of Service
- Use for legitimate networking purposes
- Avoid aggressive scraping patterns

### 🚨 Troubleshooting

#### Common Issues

**Authentication Failed**

```
Error: Authentication failed: li_at cookie not found
```

**Solution**: Ensure your cookies array includes the `li_at` cookie

**Profile Not Found**

```
Error: Could not extract profile ID from URL
```

**Solution**: Verify the LinkedIn URL format is correct

**Rate Limited**

```
Error: Too many requests
```

**Solution**: Add delays between requests and reduce request frequency

#### Debug Mode

Enable debug logging by setting:

```python
logging.basicConfig(level=logging.DEBUG)
```

### 📈 Best Practices

1. **Respect Rate Limits**: Space out requests appropriately
2. **Monitor Cookie Expiration**: Refresh cookies regularly
3. **Handle Errors Gracefully**: Implement retry logic for failed requests
4. **Validate Inputs**: Always verify profile URLs before processing
5. **Log Everything**: Use comprehensive logging for debugging

### 📄 License

This project is for educational and research purposes. Please ensure compliance with LinkedIn's Terms of Service and applicable laws in your jurisdiction.

# Actor input Schema

## `profile_url` (type: `array`):

The LinkedIn profile URL to scrape (e.g., https://www.linkedin.com/in/john-doe/)

## `cookies` (type: `array`):

LinkedIn cookies exported from EditThisCookie browser extension as JSON array. To get cookies: 1) Log into LinkedIn in your browser, 2) Install EditThisCookie extension, 3) Visit LinkedIn.com, 4) Click the EditThisCookie extension icon, 5) Click 'Export' button, 6) Copy the entire JSON array and paste it here. The scraper will automatically extract the required li_at cookie from this array.

## Actor input object example

```json
{
  "profile_url": [
    "https://www.linkedin.com/in/williamhgates/"
  ],
  "cookies": [
    {
      "domain": ".linkedin.com",
      "expirationDate": 1752949169,
      "hostOnly": false,
      "httpOnly": false,
      "name": "_gcl_au",
      "path": "/",
      "sameSite": "unspecified",
      "secure": false,
      "session": false,
      "storeId": "0",
      "value": "1.1.2083393420.1745173169",
      "id": 1
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1752949168.844608,
      "hostOnly": false,
      "httpOnly": false,
      "name": "_guid",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "acd255b5-f6b3-42ba-a29b-43e7149d1fbe",
      "id": 2
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1760725168,
      "hostOnly": false,
      "httpOnly": false,
      "name": "AMCV_14215E3D5995C57C0A495C55%40AdobeOrg",
      "path": "/",
      "sameSite": "unspecified",
      "secure": false,
      "session": false,
      "storeId": "0",
      "value": "-637568504%7CMCIDTS%7C20199%7CMCMID%7C84751414213763863511536924695015326532%7CMCAAMLH-1745777968%7C12%7CMCAAMB-1745777968%7CRKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y%7CMCOPTOUT-1745180368s%7CNONE%7CvVersion%7C5.1.1%7CMCCIDH%7C285643625",
      "id": 3
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1753683051.048478,
      "hostOnly": false,
      "httpOnly": false,
      "name": "AnalyticsSyncHistory",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "AQJEq-DjkgWizgAAAZe1KQWlYpnEdhzukDogHWW5NVPdnwK8rP3yv_JqTyKVrmBbHUViSovk-NcphWq8YLmYlQ",
      "id": 4
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1782627051.970244,
      "hostOnly": false,
      "httpOnly": false,
      "name": "bcookie",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "\"v=2&254cc95a-1e59-4b28-8987-c5a21ed2d1d9\"",
      "id": 5
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1776709170.162967,
      "hostOnly": false,
      "httpOnly": true,
      "name": "dfpfpt",
      "path": "/",
      "sameSite": "unspecified",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "291e6513523f4067a627329c51427448",
      "id": 6
    },
    {
      "domain": ".linkedin.com",
      "hostOnly": false,
      "httpOnly": true,
      "name": "fptctx2",
      "path": "/",
      "sameSite": "unspecified",
      "secure": true,
      "session": true,
      "storeId": "0",
      "value": "taBcrIH61PuCVH7eNCyH0MJojnuUODHcZ6x9WoxhgCnB8RZKUr5P8yael0dg2s3RITFZbHMaUzoc1OGQI5UHLnMDeTzF3br16usuQIiyBIXpem0QeyWczUuIImkirsbFQWHqrX4Z2l%252f7IRIk4hSVfH3cz8G7PieNrV86xeMnXvfCpj3t6Puz4lJILBiTpfScTd0rg6BzSqjQsLFyY%252fdU6nLjhR998W2%252f7uXP3MmHxpgDkTl4HFj8Rud52N4zmeqSCyCxJawQq%252fUQZFRkur1kR8DPWmM8rRyKrTcS8orlNIRHqpwcDzfld8I6PAVoQHr5",
      "id": 7
    },
    {
      "domain": ".linkedin.com",
      "hostOnly": false,
      "httpOnly": false,
      "name": "lang",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": true,
      "storeId": "0",
      "value": "v=2&lang=en-us",
      "id": 8
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1758867051.970164,
      "hostOnly": false,
      "httpOnly": false,
      "name": "li_sugr",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "f8abae6c-7af2-45cd-b897-dd2afdbb6712",
      "id": 9
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1782627047.961785,
      "hostOnly": false,
      "httpOnly": false,
      "name": "liap",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "true",
      "id": 10
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1751103229.166612,
      "hostOnly": false,
      "httpOnly": false,
      "name": "lidc",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "\"b=OB35:s=O:r=O:a=O:p=O:g=3886:u=3:x=1:i=1751091054:t=1751103231:v=2:sig=AQFEvQk0ZCX6Svesr4GOwko9pE8yPQek\"",
      "id": 11
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1753683051.355416,
      "hostOnly": false,
      "httpOnly": false,
      "name": "lms_ads",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "AQEtS-u2WcEnXAAAAZe1KQbbEmJYji_gS9wvGtjenXubmIqttKVCrhn6xN5UKuhZjrbPch-XblOclI6dlOgPrZn6WEzxopcd",
      "id": 12
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1753683051.355509,
      "hostOnly": false,
      "httpOnly": false,
      "name": "lms_analytics",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "AQEtS-u2WcEnXAAAAZe1KQbbEmJYji_gS9wvGtjenXubmIqttKVCrhn6xN5UKuhZjrbPch-XblOclI6dlOgPrZn6WEzxopcd",
      "id": 13
    },
    {
      "domain": ".linkedin.com",
      "expirationDate": 1753683051.048454,
      "hostOnly": false,
      "httpOnly": false,
      "name": "UserMatchHistory",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "AQLBvz2H5H5_vgAAAZe1KQWlZ37J3zzBOjCJLSKoIoLAbs8jsma5rvGUSiPw4F9t9iDMr0Qhmep91GpXdF_lK3RWfmmBeuh-X1tVH7ggHA7f9KcKo_vK2JlK9DAXGRVEGS5J0Yuo5pehye5LspMJNJXn3TrA95elNtYVQDypvg14FFNu322vRoOo-hz99ACuURYktl7Qm1GxWLsCotC9i5YKVHIS2gGf4V1G6pFxZSE1HTvUhqo1pyRpPB5qy8VbS9wSeMfhuj9zqrpLaXPgpxwZHxDWwT98n2LbjTpbD3H-9FOq99qmNeQkCMXD7hQ9ilA3i9ZXBkeU_A7eSNFlqy1tKxagG2D7wMuOS5nKAYPY7j0-Kg",
      "id": 14
    },
    {
      "domain": ".www.linkedin.com",
      "expirationDate": 1782627051.355584,
      "hostOnly": false,
      "httpOnly": true,
      "name": "bscookie",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "\"v=1&20241208151840c08fae33-bd62-4fbb-8c47-233b6f281551AQHf-5pt38OA0yBK9GyVLcAY7TdE6J6-\"",
      "id": 15
    },
    {
      "domain": ".www.linkedin.com",
      "expirationDate": 1782627047.961822,
      "hostOnly": false,
      "httpOnly": false,
      "name": "JSESSIONID",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "\"ajax:-2052419112489373461\"",
      "id": 16
    },
    {
      "domain": ".www.linkedin.com",
      "expirationDate": 1782627047.96175,
      "hostOnly": false,
      "httpOnly": true,
      "name": "li_at",
      "path": "/",
      "sameSite": "no_restriction",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "AQEDAVnyITMFKdF0AAABllRtOg4AAAGX2TV8qFYAEpgx-9lUnwXzhOeXdV8-hlrbmQWLEvnkA0ITX7Iob9lZSg7LuApEmyfhyBI9G6tdsBexuVIVEBT5VSQg0-h2n9Ngf1cx7EE78dzF5x7PK6rn4qSX",
      "id": 17
    },
    {
      "domain": ".www.linkedin.com",
      "expirationDate": 1766643049,
      "hostOnly": false,
      "httpOnly": false,
      "name": "li_theme",
      "path": "/",
      "sameSite": "unspecified",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "light",
      "id": 18
    },
    {
      "domain": ".www.linkedin.com",
      "expirationDate": 1766643049,
      "hostOnly": false,
      "httpOnly": false,
      "name": "li_theme_set",
      "path": "/",
      "sameSite": "unspecified",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "app",
      "id": 19
    },
    {
      "domain": ".www.linkedin.com",
      "expirationDate": 1752300649,
      "hostOnly": false,
      "httpOnly": false,
      "name": "timezone",
      "path": "/",
      "sameSite": "unspecified",
      "secure": true,
      "session": false,
      "storeId": "0",
      "value": "Asia/Calcutta",
      "id": 20
    }
  ]
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("dead00/linkedin-mutual-connection-analyzer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("dead00/linkedin-mutual-connection-analyzer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call dead00/linkedin-mutual-connection-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,dead00/linkedin-mutual-connection-analyzer"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/CnltEz3U9uDtbOzuf/builds/M3qGPaQ78WK9kKEUa/openapi.json
