All Projects → tomquirk → Linkedin Api

tomquirk / Linkedin Api

Licence: mit
👨‍💼Linkedin API for Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Linkedin Api

Lib
Autocode CLI and standard library tooling
Stars: ✭ 3,773 (+840.9%)
Mutual labels:  api
Node Vault
Client for HashiCorp's Vault
Stars: ✭ 391 (-2.49%)
Mutual labels:  api
Larapi
An API-friendly fork of Laravel. Authentication, error handling, resource filtering, sorting, pagination and much more included
Stars: ✭ 397 (-1%)
Mutual labels:  api
Blog
一个go、echo、vue 开发的快速、简洁、美观、前后端分离的个人博客系统(blog)、也可方便二次开发为CMS(内容管理系统)和各种企业门户网站
Stars: ✭ 388 (-3.24%)
Mutual labels:  api
Tentacat
Simple Elixir wrapper for the GitHub API
Stars: ✭ 390 (-2.74%)
Mutual labels:  api
Dog Ceo Api
The API hosted at dog.ceo
Stars: ✭ 393 (-2%)
Mutual labels:  api
Figma To Google Slides
Convert Figma frames into a Google Slides presentation 🍭
Stars: ✭ 385 (-3.99%)
Mutual labels:  api
Spruce
A social networking platform made using Node.js and MongoDB
Stars: ✭ 399 (-0.5%)
Mutual labels:  api
Hello tf c api
Neural Network TensorFlow C API
Stars: ✭ 388 (-3.24%)
Mutual labels:  api
Huobi python
Python SDK for Huobi Spot API
Stars: ✭ 391 (-2.49%)
Mutual labels:  api
Rack App
minimalist framework for building rack applications
Stars: ✭ 389 (-2.99%)
Mutual labels:  api
Jekyll
Jekyll-based static site for The Programming Historian
Stars: ✭ 387 (-3.49%)
Mutual labels:  api
Diet
A tiny, fast and modular node.js web framework. Good for making fast & scalable apps and apis.
Stars: ✭ 394 (-1.75%)
Mutual labels:  api
Awesome Ocelot
A curated list of awesome ocelot books, courses, trainings, conference talks, blogs and most inspiring open source contributors
Stars: ✭ 386 (-3.74%)
Mutual labels:  api
Substats
📈📉 Shhhh...we're counting your subscribers!
Stars: ✭ 396 (-1.25%)
Mutual labels:  api
Polr
🚡 A modern, powerful, and robust URL shortener
Stars: ✭ 4,147 (+934.16%)
Mutual labels:  api
Open Apis Korea
🇰🇷 한국어 사용자를 위한 서비스에 사용하기 위한 오픈 API 모음
Stars: ✭ 391 (-2.49%)
Mutual labels:  api
Vk Io
Modern VK API SDK for Node.js
Stars: ✭ 401 (+0%)
Mutual labels:  api
Ceph Dash
Flask based api / dashboard for viewing a ceph clusters overall health status
Stars: ✭ 398 (-0.75%)
Mutual labels:  api
Django Restql
Turn your API made with Django REST Framework(DRF) into a GraphQL like API.
Stars: ✭ 396 (-1.25%)
Mutual labels:  api

linkedin_api

👨‍💼 Linkedin API for Python

Build Status Documentation Status

No "official" API access required - just use a valid Linkedin account!

Programmatically send messages, get jobs, search profiles and more, all with a regular Linkedin user account!

Before using this project, please consult the Terms and Conditions and Legal Notice.

Installation

⚠️ Python >= 3.6 required

pip3 install linkedin-api~=2.0.0a

Why v2.0.0a?

Example usage

from linkedin_api import Linkedin

# Authenticate using any Linkedin account credentials
api = Linkedin('[email protected]', '*******')

# 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')

Documentation

For a complete reference documentation, see the documentation website.

Overview

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

Do you mean the legit Linkedin API?

NO! To retrieve structured data, the Linkedin Website 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.

So specifically, this project aims to provide complete coverage for Voyager.

How do we do it?

How to contribute

Learn how to find endpoints

Development Setup

Dependencies

  • Python 3.7
  • A valid Linkedin user account (don't use your personal account, if possible)
  • pipenv (optional)

Development installation

  1. Create a .env config file. An example is provided in .env.example - you include at least all of the settings set there.

  2. Using pipenv...

    pipenv install --dev
    pipenv shell
    

Running tests

python -m pytest tests

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.

In-depth overview

Voyager endpoints look like this:

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

Or, more clearly

 ___________________________________ _______________________________
|             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.

To find endpoints

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

The most reliable method to find the relevant endpoint is to:

  1. view source

  2. command-f/search the page for some keyword in the data. This will exist inside of a <code> tag.

  3. Scroll down to the next adjacent element which will be another <code> tag, probably with an id that looks something like

    <code style="display: none" id="datalet-bpr-guid-3900675">
      {"request":"/voyager/api/identity/profiles/tom-quirk/profileView","status":200,"body":"bpr-guid-3900675"}
    </code>
    
  4. 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 seems to have developed an internal query language/syntax where Clients (i.e. front-ends like linkedin.com) to specify what data they want (similar to the GraphQL concept). If anyone knows what this is, I'd love to know!.

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

/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

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

So here, we request an organisation name, and a list of groups, where for each group we want largeLogo, groupName, etc.

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

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).

Terms and Conditions

By using this project, you agree to the following Terms and Conditions. We reserve the right to block any user of this repository that does not meet these conditions.

Usage

This project may not be used for any of the following:

  • Commercial use
  • Spam
  • Storage of any Personally Identifiable Information
  • Personal abuse (i.e. verbal abuse)

Legal

This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by Linkedin or any of its affiliates or subsidiaries. This is an independent and unofficial API. Use at your own risk.

This project violates Linkedin's User Agreement Section 8.2, and because of this, Linkedin may (and will) temporarily or permanently ban your account. We are not responsible for your account being banned.

Versioning Note

Tl;dr: Don't use anything < v2.0.0a.

Releases/tags for this package have not been kept up to date with changes and thus versions (like v1.0.0) are misleading and do not represent "stability". Eventually, v2.0.0 will be the "stable" release.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].