linkedin-api


Namelinkedin-api JSON
Version 2.3.0 PyPI version JSON
download
home_pagehttps://github.com/tomquirk/linkedin-api
SummaryLinkedIn API for Python
upload_time2024-09-06 20:56:11
maintainerTom Quirk
docs_urlNone
authorTom Quirk
requires_python<4.0,>=3.10
licenseMIT
keywords linkedin api automation scraper bot data sdk ai integration profiles network company
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">

# LinkedIn API for Python

![Build](https://img.shields.io/github/actions/workflow/status/tomquirk/linkedin-api/ci.yml?label=Build&logo=github) [![Documentation](https://img.shields.io/readthedocs/linkedin-api?label=Docs)](https://linkedin-api.readthedocs.io) [![GitHub Release](https://img.shields.io/github/v/release/tomquirk/linkedin-api?label=PyPI&logo=python)](https://pypi.org/project/linkedin-api/) [![Discord](https://img.shields.io/badge/Discord-5865F2?logo=discord&logoColor=ffffff)](https://discord.gg/9w5c6xzm)

Search profiles, send messages, find jobs and more in Python. No official API access required.

<p align="center">
    <a href="https://linkedin-api.readthedocs.io">Documentation</a>
    ·
    <a href="#quick-start">Quick Start</a>
    ·
    <a href="#how-it-works">How it works</a>
</p>

</div>

<br>

<h3 align="center">Sponsors</h3>

<p align="center" dir="auto" >
  <a href="https://bit.ly/3AFPGZd" target="_blank">
    <img height="45px" src="https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/proapis.png" alt="iScraper by ProAPIs">
  </a>
  <a href="https://bit.ly/3SWnB63" target="_blank">
    <img height="45px" src="https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/prospeo.png" alt="Prospeo">
  </a>
  <a href="https://bit.ly/3SRximo" target="_blank">
    <img height="45px" src="https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/proxycurl.png" alt="proxycurl">
  </a>
  <a href="https://bit.ly/3Mbksvd" target="_blank">
    <img height="45px" src="https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/lix.png" alt="Lix">
  </a>
  <a href="https://bit.ly/3WOIMrX" target="_blank">
    <img  height="70px" src="https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/unipile.png" alt="Unipile">
  </a>
  <a href="https://bit.ly/4fUyE9J" target="_blank">
    <img  height="45px" src="https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/scrapin.png" alt="Scrapin">
  </a>
</p>

<p align="center"><a href="https://bit.ly/4cCjbIq" target="_blank">Become a sponsor</a></p>

<br>

## Features

- ✅ No official API access required. Just use a valid LinkedIn user account.
- ✅ Direct HTTP API interface. No Selenium, Pupeteer, or other browser-based scraping methods.
- ✅ Get and search people, companies, jobs, posts
- ✅ Send and retrieve messages
- ✅ Send and accept connection requests
- ✅ Get and react to posts

And more! [Read the docs](https://linkedin-api.readthedocs.io/en/latest/api.html) for all API methods.

> [!IMPORTANT]
> This library is not officially supported by LinkedIn. Using this library might violate LinkedIn's Terms of Service. Use it at your own risk.

## Installation

> [!NOTE]
> Python >= 3.10 required

###

```bash
pip install linkedin-api
```

Or, for bleading edge:

```bash
pip install git+https://github.com/tomquirk/linkedin-api.git
```

### Quick Start

> [!TIP]
> See all API methods on the [docs](https://linkedin-api.readthedocs.io/en/latest/api.html).

The following snippet demonstrates a few basic linkedin_api use cases:

```python
from linkedin_api import Linkedin

# Authenticate using any Linkedin user account credentials
api = Linkedin('reedhoffman@linkedin.com', '*******')

# GET a profile
profile = api.get_profile('billy-g')

# GET a profiles contact info
contact_info = api.get_profile_contact_info('billy-g')

# GET 1st degree connections of a given profile
connections = api.get_profile_connections('1234asc12304')
```

## Commercial alternatives

> This is a sponsored section

<h3>
<a href="https://prospeo.io/api/linkedin-email-finder">
Prospeo
</a>
</h3>

Extract data and find verified emails in real-time with [Prospeo LinkedIn Email Finder API](https://prospeo.io/api/linkedin-email-finder).

<details>
  <summary>Learn more</summary>
Submit a LinkedIn profile URL to our API and get:

- Profile data extracted in real-time
- Company data of the profile
- Verified work email of the profile
- Exclusive data points (gender, cleaned country code, time zone...)
- One do-it-all request
- Stable API, tested under high load

Try it with 75 profiles. [Get your FREE API key now](https://prospeo.io/api/linkedin-email-finder).

</details>

<h3>
<a href="https://nubela.co/proxycurl/?utm_campaign=influencer%20marketing&utm_source=github&utm_medium=social&utm_term=-&utm_content=tom%20quirk">
Proxycurl
</a>
</h3>

Scrape public LinkedIn profile data at scale with [Proxycurl APIs](https://nubela.co/proxycurl/?utm_campaign=influencer%20marketing&utm_source=github&utm_medium=social&utm_term=-&utm_content=tom%20quirk).

<details>
  <summary>Learn more</summary>
  
- Scraping Public profiles are battle tested in court in HiQ VS LinkedIn case.
- GDPR, CCPA, SOC2 compliant
- High rate limit - 300 requests/minute
- Fast - APIs respond in ~2s
- Fresh data - 88% of data is scraped real-time, other 12% are not older than 29 days
- High accuracy
- Tons of data points returned per profile

Built for developers, by developers.

</details>

<h3>
<a href="https://www.unipile.com/communication-api/messaging-api/linkedin-api/?utm_campaign=git%20tom%20quirk">
Unipile
</a>
</h3>

Full [LinkedIn API](https://www.unipile.com/communication-api/messaging-api/linkedin-api/?utm_campaign=git%20tom%20quirk): Connect Classic/Sales Navigator/Recruiter, synchronize real-time messaging, enrich data and build outreach sequences…

<details>
  <summary>Learn more</summary>
  
- Easily connect your users in the cloud with our white-label authentication (captcha solving, in-app validation, OTP, 2FA).
- Real-time webhook for each message received, read status, invitation accepted, and more.
- Data extraction: get profile, get company, get post, extract search results from Classic + Sales Navigator + Recruiter
- Outreach sequences: send invitations, InMail, messages, and comment on posts…

Test [all the features](https://www.unipile.com/communication-api/messaging-api/linkedin-api/?utm_campaign=git%20tom%20quirk) with our 7-day free trial.

</details>

<h3>
<a href="https://bit.ly/4fUyE9J">
ScrapIn
</a>
</h3>

Scrape Any Data from LinkedIn, without limit with [ScrapIn API](https://bit.ly/4fUyE9J).

<details>
  <summary>Learn more</summary>
  
- Real time data (no-cache)
- Built for SaaS developers
- GDPR, CCPA, SOC2 compliant
- Interactive API documentation
- A highly stable API, backed by over 4 years of experience in data provisioning, with the added reliability of two additional data provider brands owned by the company behind ScrapIn.

Try it for free. [Get your API key now](https://bit.ly/4fUyE9J)

</details>

<h3>
<a href="https://bit.ly/3AFPGZd">
iScraper by ProAPIs, Inc.
</a>
</h3>

Access high-quality, real-time LinkedIn data at scale with [iScraper API](https://bit.ly/3AFPGZd), offering unlimited scalability and unmatched accuracy.

<details>

<summary>Learn more</summary>

- Real-time LinkedIn data scraping with unmatched accuracy
- Hosted datasets with powerful Lucene search access
- Designed for enterprise and corporate-level applications
- Handles millions of scrapes per day, ensuring unlimited scalability
- Trusted by top enterprises for mission-critical data needs
- Interactive API documentation built on OpenAPI 3 specs for seamless integration
- Backed by over 10 years of experience in real-time data provisioning
- Lowest price guarantee for high volume use

Get started [here](https://bit.ly/3AFPGZd).

</details>

> End sponsored section

## Development

### Dependencies

- [`poetry`](https://python-poetry.org/docs/)
- A valid Linkedin user account (don't use your personal account, if possible)

### Development installation

1. Create a `.env` config file (use `.env.example` as a reference)
2. Install dependencies using `poetry`:

   ```bash
   poetry install
   poetry self add poetry-plugin-dotenv
   ```

### Run tests

Run all tests:

```bash
poetry run pytest
```

Run unit tests:

```bash
poetry run pytest tests/unit
```

Run E2E tests:

```bash
poetry run pytest tests/e2e
```

### Lint

```bash
poetry run black --check .
```

Or to fix:

```bash
poetry run black .
```

### Troubleshooting

#### I keep getting a `CHALLENGE`

Linkedin will throw you a curve ball in the form of a Challenge URL. We currently don't handle this, and so you're kinda screwed. We think it could be only IP-based (i.e. logging in from different location). Your best chance at resolution is to log out and log back in on your browser.

**Known reasons for Challenge** include:

- 2FA
- Rate-limit - "It looks like you’re visiting a very high number of pages on LinkedIn.". Note - n=1 experiment where this page was hit after ~900 contiguous requests in a single session (within the hour) (these included random delays between each request), as well as a bunch of testing, so who knows the actual limit.

Please add more as you come across them.

#### Search problems

- Mileage may vary when searching general keywords like "software" using the standard `search` method. They've recently added some smarts around search whereby they group results by people, company, jobs etc. if the query is general enough. Try to use an entity-specific search method (i.e. search_people) where possible.

## How it works

This project attempts to provide a simple Python interface for the LinkedIn API.

> Do you mean the [legit LinkedIn API](https://developer.linkedin.com/)?

NO! To retrieve structured data, the [LinkedIn Website](https://linkedin.com) uses a service they call **Voyager**. Voyager endpoints give us access to pretty much everything we could want from LinkedIn: profiles, companies, connections, messages, etc. - anything that you can see on linkedin.com, we can get from Voyager.

This project aims to provide complete coverage for Voyager.

[How does it work?](#deep-dive)

### Deep dive

Voyager endpoints look like this:

```text
https://www.linkedin.com/voyager/api/identity/profileView/tom-quirk
```

Or, more clearly

```text
 ___________________________________ _______________________________
|             base path             |            resource           |
https://www.linkedin.com/voyager/api /identity/profileView/tom-quirk
```

They are authenticated with a simple cookie, which we send with every request, along with a bunch of headers.

To get a cookie, we POST a given username and password (of a valid LinkedIn user account) to `https://www.linkedin.com/uas/authenticate`.

### Find new endpoints

We're looking at the LinkedIn website and we spot some data we want. What now?

The following describes the most reliable method to find relevant endpoints:

1. `view source`
1. `command-f`/search the page for some keyword in the data. This will exist inside of a `<code>` tag.
1. Scroll down to the **next adjacent element** which will be another `<code>` tag, probably with an `id` that looks something like

   ```html
   <code style="display: none" id="datalet-bpr-guid-3900675">
     {"request":"/voyager/api/identity/profiles/tom-quirk/profileView","status":200,"body":"bpr-guid-3900675"}
   </code>
   ```

The value of `request` is the url! 🤘

You can also use the `network` tab in you browsers developer tools, but you will encounter mixed results.

### How Clients query Voyager

linkedin.com uses the [Rest-li Protocol](https://linkedin.github.io/rest.li/spec/protocol) for querying data. Rest-li is an internal query language/syntax where clients (like linkedin.com) specify what data they want. It's conceptually similar to the GraphQL.

Here's an example of making a request for an organisation's `name` and `groups` (the Linkedin groups it manages):

```text
/voyager/api/organization/companies?decoration=(name,groups*~(entityUrn,largeLogo,groupName,memberCount,websiteUrl,url))&q=universalName&universalName=linkedin
```

The "querying" happens in the `decoration` parameter, which looks like the following:

```text
(
    name,
    groups*~(entityUrn,largeLogo,groupName,memberCount,websiteUrl,url)
)
```

Here, we request an organisation name and a list of groups, where for each group we want `largeLogo`, `groupName`, and so on.

Different endpoints use different parameters (and perhaps even different syntaxes) to specify these queries. Notice that the above query had a parameter `q` whose value was `universalName`; the query was then specified with the `decoration` parameter.

In contrast, the `/search/cluster` endpoint uses `q=guided`, and specifies its query with the `guided` parameter, whose value is something like

```text
List(v->PEOPLE)
```

It could be possible to document (and implement a nice interface for) this query language - as we add more endpoints to this project, I'm sure it will become more clear if such a thing would be possible (and if it's worth it).

### Release a new version

1. Bump `version` in `pyproject.toml`
1. `poetry build`
1. `poetry publish`
1. Draft release notes in GitHub.

## Disclaimer

This library is not endorsed or supported by LinkedIn. It is an unofficial library intended for educational purposes and personal use only. By using this library, you agree to not hold the author or contributors responsible for any consequences resulting from its usage.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tomquirk/linkedin-api",
    "name": "linkedin-api",
    "maintainer": "Tom Quirk",
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": "tom@codalabs.au",
    "keywords": "linkedin, api, automation, scraper, bot, data, sdk, ai, integration, profiles, network, company",
    "author": "Tom Quirk",
    "author_email": "tom@codalabs.au",
    "download_url": "https://files.pythonhosted.org/packages/13/e3/738b0cf190fcaf3ba5dbf2ebef9f750689d90cd82da7b3e03a6733163e8f/linkedin_api-2.3.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n# LinkedIn API for Python\n\n![Build](https://img.shields.io/github/actions/workflow/status/tomquirk/linkedin-api/ci.yml?label=Build&logo=github) [![Documentation](https://img.shields.io/readthedocs/linkedin-api?label=Docs)](https://linkedin-api.readthedocs.io) [![GitHub Release](https://img.shields.io/github/v/release/tomquirk/linkedin-api?label=PyPI&logo=python)](https://pypi.org/project/linkedin-api/) [![Discord](https://img.shields.io/badge/Discord-5865F2?logo=discord&logoColor=ffffff)](https://discord.gg/9w5c6xzm)\n\nSearch profiles, send messages, find jobs and more in Python. No official API access required.\n\n<p align=\"center\">\n    <a href=\"https://linkedin-api.readthedocs.io\">Documentation</a>\n    \u00b7\n    <a href=\"#quick-start\">Quick Start</a>\n    \u00b7\n    <a href=\"#how-it-works\">How it works</a>\n</p>\n\n</div>\n\n<br>\n\n<h3 align=\"center\">Sponsors</h3>\n\n<p align=\"center\" dir=\"auto\" >\n  <a href=\"https://bit.ly/3AFPGZd\" target=\"_blank\">\n    <img height=\"45px\" src=\"https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/proapis.png\" alt=\"iScraper by ProAPIs\">\n  </a>\n  <a href=\"https://bit.ly/3SWnB63\" target=\"_blank\">\n    <img height=\"45px\" src=\"https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/prospeo.png\" alt=\"Prospeo\">\n  </a>\n  <a href=\"https://bit.ly/3SRximo\" target=\"_blank\">\n    <img height=\"45px\" src=\"https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/proxycurl.png\" alt=\"proxycurl\">\n  </a>\n  <a href=\"https://bit.ly/3Mbksvd\" target=\"_blank\">\n    <img height=\"45px\" src=\"https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/lix.png\" alt=\"Lix\">\n  </a>\n  <a href=\"https://bit.ly/3WOIMrX\" target=\"_blank\">\n    <img  height=\"70px\" src=\"https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/unipile.png\" alt=\"Unipile\">\n  </a>\n  <a href=\"https://bit.ly/4fUyE9J\" target=\"_blank\">\n    <img  height=\"45px\" src=\"https://raw.githubusercontent.com/tomquirk/linkedin-api/main/docs/assets/logos/scrapin.png\" alt=\"Scrapin\">\n  </a>\n</p>\n\n<p align=\"center\"><a href=\"https://bit.ly/4cCjbIq\" target=\"_blank\">Become a sponsor</a></p>\n\n<br>\n\n## Features\n\n- \u2705 No official API access required. Just use a valid LinkedIn user account.\n- \u2705 Direct HTTP API interface. No Selenium, Pupeteer, or other browser-based scraping methods.\n- \u2705 Get and search people, companies, jobs, posts\n- \u2705 Send and retrieve messages\n- \u2705 Send and accept connection requests\n- \u2705 Get and react to posts\n\nAnd more! [Read the docs](https://linkedin-api.readthedocs.io/en/latest/api.html) for all API methods.\n\n> [!IMPORTANT]\n> This library is not officially supported by LinkedIn. Using this library might violate LinkedIn's Terms of Service. Use it at your own risk.\n\n## Installation\n\n> [!NOTE]\n> Python >= 3.10 required\n\n###\n\n```bash\npip install linkedin-api\n```\n\nOr, for bleading edge:\n\n```bash\npip install git+https://github.com/tomquirk/linkedin-api.git\n```\n\n### Quick Start\n\n> [!TIP]\n> See all API methods on the [docs](https://linkedin-api.readthedocs.io/en/latest/api.html).\n\nThe following snippet demonstrates a few basic linkedin_api use cases:\n\n```python\nfrom linkedin_api import Linkedin\n\n# Authenticate using any Linkedin user account credentials\napi = Linkedin('reedhoffman@linkedin.com', '*******')\n\n# GET a profile\nprofile = api.get_profile('billy-g')\n\n# GET a profiles contact info\ncontact_info = api.get_profile_contact_info('billy-g')\n\n# GET 1st degree connections of a given profile\nconnections = api.get_profile_connections('1234asc12304')\n```\n\n## Commercial alternatives\n\n> This is a sponsored section\n\n<h3>\n<a href=\"https://prospeo.io/api/linkedin-email-finder\">\nProspeo\n</a>\n</h3>\n\nExtract data and find verified emails in real-time with [Prospeo LinkedIn Email Finder API](https://prospeo.io/api/linkedin-email-finder).\n\n<details>\n  <summary>Learn more</summary>\nSubmit a LinkedIn profile URL to our API and get:\n\n- Profile data extracted in real-time\n- Company data of the profile\n- Verified work email of the profile\n- Exclusive data points (gender, cleaned country code, time zone...)\n- One do-it-all request\n- Stable API, tested under high load\n\nTry it with 75 profiles. [Get your FREE API key now](https://prospeo.io/api/linkedin-email-finder).\n\n</details>\n\n<h3>\n<a href=\"https://nubela.co/proxycurl/?utm_campaign=influencer%20marketing&utm_source=github&utm_medium=social&utm_term=-&utm_content=tom%20quirk\">\nProxycurl\n</a>\n</h3>\n\nScrape public LinkedIn profile data at scale with [Proxycurl APIs](https://nubela.co/proxycurl/?utm_campaign=influencer%20marketing&utm_source=github&utm_medium=social&utm_term=-&utm_content=tom%20quirk).\n\n<details>\n  <summary>Learn more</summary>\n  \n- Scraping Public profiles are battle tested in court in HiQ VS LinkedIn case.\n- GDPR, CCPA, SOC2 compliant\n- High rate limit - 300 requests/minute\n- Fast - APIs respond in ~2s\n- Fresh data - 88% of data is scraped real-time, other 12% are not older than 29 days\n- High accuracy\n- Tons of data points returned per profile\n\nBuilt for developers, by developers.\n\n</details>\n\n<h3>\n<a href=\"https://www.unipile.com/communication-api/messaging-api/linkedin-api/?utm_campaign=git%20tom%20quirk\">\nUnipile\n</a>\n</h3>\n\nFull [LinkedIn API](https://www.unipile.com/communication-api/messaging-api/linkedin-api/?utm_campaign=git%20tom%20quirk): Connect Classic/Sales Navigator/Recruiter, synchronize real-time messaging, enrich data and build outreach sequences\u2026\n\n<details>\n  <summary>Learn more</summary>\n  \n- Easily connect your users in the cloud with our white-label authentication (captcha solving, in-app validation, OTP, 2FA).\n- Real-time webhook for each message received, read status, invitation accepted, and more.\n- Data extraction: get profile, get company, get post, extract search results from Classic + Sales Navigator + Recruiter\n- Outreach sequences: send invitations, InMail, messages, and comment on posts\u2026\n\nTest [all the features](https://www.unipile.com/communication-api/messaging-api/linkedin-api/?utm_campaign=git%20tom%20quirk) with our 7-day free trial.\n\n</details>\n\n<h3>\n<a href=\"https://bit.ly/4fUyE9J\">\nScrapIn\n</a>\n</h3>\n\nScrape Any Data from LinkedIn, without limit with [ScrapIn API](https://bit.ly/4fUyE9J).\n\n<details>\n  <summary>Learn more</summary>\n  \n- Real time data (no-cache)\n- Built for SaaS developers\n- GDPR, CCPA, SOC2 compliant\n- Interactive API documentation\n- A highly stable API, backed by over 4 years of experience in data provisioning, with the added reliability of two additional data provider brands owned by the company behind ScrapIn.\n\nTry it for free. [Get your API key now](https://bit.ly/4fUyE9J)\n\n</details>\n\n<h3>\n<a href=\"https://bit.ly/3AFPGZd\">\niScraper by ProAPIs, Inc.\n</a>\n</h3>\n\nAccess high-quality, real-time LinkedIn data at scale with [iScraper API](https://bit.ly/3AFPGZd), offering unlimited scalability and unmatched accuracy.\n\n<details>\n\n<summary>Learn more</summary>\n\n- Real-time LinkedIn data scraping with unmatched accuracy\n- Hosted datasets with powerful Lucene search access\n- Designed for enterprise and corporate-level applications\n- Handles millions of scrapes per day, ensuring unlimited scalability\n- Trusted by top enterprises for mission-critical data needs\n- Interactive API documentation built on OpenAPI 3 specs for seamless integration\n- Backed by over 10 years of experience in real-time data provisioning\n- Lowest price guarantee for high volume use\n\nGet started [here](https://bit.ly/3AFPGZd).\n\n</details>\n\n> End sponsored section\n\n## Development\n\n### Dependencies\n\n- [`poetry`](https://python-poetry.org/docs/)\n- A valid Linkedin user account (don't use your personal account, if possible)\n\n### Development installation\n\n1. Create a `.env` config file (use `.env.example` as a reference)\n2. Install dependencies using `poetry`:\n\n   ```bash\n   poetry install\n   poetry self add poetry-plugin-dotenv\n   ```\n\n### Run tests\n\nRun all tests:\n\n```bash\npoetry run pytest\n```\n\nRun unit tests:\n\n```bash\npoetry run pytest tests/unit\n```\n\nRun E2E tests:\n\n```bash\npoetry run pytest tests/e2e\n```\n\n### Lint\n\n```bash\npoetry run black --check .\n```\n\nOr to fix:\n\n```bash\npoetry run black .\n```\n\n### Troubleshooting\n\n#### I keep getting a `CHALLENGE`\n\nLinkedin will throw you a curve ball in the form of a Challenge URL. We currently don't handle this, and so you're kinda screwed. We think it could be only IP-based (i.e. logging in from different location). Your best chance at resolution is to log out and log back in on your browser.\n\n**Known reasons for Challenge** include:\n\n- 2FA\n- Rate-limit - \"It looks like you\u2019re visiting a very high number of pages on LinkedIn.\". Note - n=1 experiment where this page was hit after ~900 contiguous requests in a single session (within the hour) (these included random delays between each request), as well as a bunch of testing, so who knows the actual limit.\n\nPlease add more as you come across them.\n\n#### Search problems\n\n- Mileage may vary when searching general keywords like \"software\" using the standard `search` method. They've recently added some smarts around search whereby they group results by people, company, jobs etc. if the query is general enough. Try to use an entity-specific search method (i.e. search_people) where possible.\n\n## How it works\n\nThis project attempts to provide a simple Python interface for the LinkedIn API.\n\n> Do you mean the [legit LinkedIn API](https://developer.linkedin.com/)?\n\nNO! To retrieve structured data, the [LinkedIn Website](https://linkedin.com) uses a service they call **Voyager**. Voyager endpoints give us access to pretty much everything we could want from LinkedIn: profiles, companies, connections, messages, etc. - anything that you can see on linkedin.com, we can get from Voyager.\n\nThis project aims to provide complete coverage for Voyager.\n\n[How does it work?](#deep-dive)\n\n### Deep dive\n\nVoyager endpoints look like this:\n\n```text\nhttps://www.linkedin.com/voyager/api/identity/profileView/tom-quirk\n```\n\nOr, more clearly\n\n```text\n ___________________________________ _______________________________\n|             base path             |            resource           |\nhttps://www.linkedin.com/voyager/api /identity/profileView/tom-quirk\n```\n\nThey are authenticated with a simple cookie, which we send with every request, along with a bunch of headers.\n\nTo get a cookie, we POST a given username and password (of a valid LinkedIn user account) to `https://www.linkedin.com/uas/authenticate`.\n\n### Find new endpoints\n\nWe're looking at the LinkedIn website and we spot some data we want. What now?\n\nThe following describes the most reliable method to find relevant endpoints:\n\n1. `view source`\n1. `command-f`/search the page for some keyword in the data. This will exist inside of a `<code>` tag.\n1. Scroll down to the **next adjacent element** which will be another `<code>` tag, probably with an `id` that looks something like\n\n   ```html\n   <code style=\"display: none\" id=\"datalet-bpr-guid-3900675\">\n     {\"request\":\"/voyager/api/identity/profiles/tom-quirk/profileView\",\"status\":200,\"body\":\"bpr-guid-3900675\"}\n   </code>\n   ```\n\nThe value of `request` is the url! \ud83e\udd18\n\nYou can also use the `network` tab in you browsers developer tools, but you will encounter mixed results.\n\n### How Clients query Voyager\n\nlinkedin.com uses the [Rest-li Protocol](https://linkedin.github.io/rest.li/spec/protocol) for querying data. Rest-li is an internal query language/syntax where clients (like linkedin.com) specify what data they want. It's conceptually similar to the GraphQL.\n\nHere's an example of making a request for an organisation's `name` and `groups` (the Linkedin groups it manages):\n\n```text\n/voyager/api/organization/companies?decoration=(name,groups*~(entityUrn,largeLogo,groupName,memberCount,websiteUrl,url))&q=universalName&universalName=linkedin\n```\n\nThe \"querying\" happens in the `decoration` parameter, which looks like the following:\n\n```text\n(\n    name,\n    groups*~(entityUrn,largeLogo,groupName,memberCount,websiteUrl,url)\n)\n```\n\nHere, we request an organisation name and a list of groups, where for each group we want `largeLogo`, `groupName`, and so on.\n\nDifferent endpoints use different parameters (and perhaps even different syntaxes) to specify these queries. Notice that the above query had a parameter `q` whose value was `universalName`; the query was then specified with the `decoration` parameter.\n\nIn contrast, the `/search/cluster` endpoint uses `q=guided`, and specifies its query with the `guided` parameter, whose value is something like\n\n```text\nList(v->PEOPLE)\n```\n\nIt could be possible to document (and implement a nice interface for) this query language - as we add more endpoints to this project, I'm sure it will become more clear if such a thing would be possible (and if it's worth it).\n\n### Release a new version\n\n1. Bump `version` in `pyproject.toml`\n1. `poetry build`\n1. `poetry publish`\n1. Draft release notes in GitHub.\n\n## Disclaimer\n\nThis library is not endorsed or supported by LinkedIn. It is an unofficial library intended for educational purposes and personal use only. By using this library, you agree to not hold the author or contributors responsible for any consequences resulting from its usage.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "LinkedIn API for Python",
    "version": "2.3.0",
    "project_urls": {
        "Documentation": "https://linkedin-api.readthedocs.io",
        "Homepage": "https://github.com/tomquirk/linkedin-api",
        "Repository": "https://github.com/tomquirk/linkedin-api"
    },
    "split_keywords": [
        "linkedin",
        " api",
        " automation",
        " scraper",
        " bot",
        " data",
        " sdk",
        " ai",
        " integration",
        " profiles",
        " network",
        " company"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ac93ca2d04be55ea6126a4957e60a7c5681194c85d3918b84b3f5e1dda274762",
                "md5": "b12bbbf25bc02e9281d384fa84bfe84d",
                "sha256": "853c76f221b7895af22f8da0ce6b6aaab4fd9721e0701de0064559133d631e9c"
            },
            "downloads": -1,
            "filename": "linkedin_api-2.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b12bbbf25bc02e9281d384fa84bfe84d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 26234,
            "upload_time": "2024-09-06T20:56:09",
            "upload_time_iso_8601": "2024-09-06T20:56:09.438207Z",
            "url": "https://files.pythonhosted.org/packages/ac/93/ca2d04be55ea6126a4957e60a7c5681194c85d3918b84b3f5e1dda274762/linkedin_api-2.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "13e3738b0cf190fcaf3ba5dbf2ebef9f750689d90cd82da7b3e03a6733163e8f",
                "md5": "7c168e1a11dde917f35a4325765c3fea",
                "sha256": "acc863e82b447fc103fb055a11cb5fd756c1a698b21f7bdefad6953a69a57288"
            },
            "downloads": -1,
            "filename": "linkedin_api-2.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7c168e1a11dde917f35a4325765c3fea",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 29208,
            "upload_time": "2024-09-06T20:56:11",
            "upload_time_iso_8601": "2024-09-06T20:56:11.080309Z",
            "url": "https://files.pythonhosted.org/packages/13/e3/738b0cf190fcaf3ba5dbf2ebef9f750689d90cd82da7b3e03a6733163e8f/linkedin_api-2.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-06 20:56:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tomquirk",
    "github_project": "linkedin-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "linkedin-api"
}
        
Elapsed time: 9.31502s