├── .gitignore
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | samples/
2 |
3 | # Byte-compiled / optimized / DLL files
4 | __pycache__/
5 | *.py[cod]
6 |
7 | # C extensions
8 | *.so
9 |
10 | # Distribution / packaging
11 | .Python
12 | env/
13 | build/
14 | develop-eggs/
15 | dist/
16 | downloads/
17 | eggs/
18 | .eggs/
19 | lib/
20 | lib64/
21 | parts/
22 | sdist/
23 | var/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 | *.spec
33 |
34 | # Installer logs
35 | pip-log.txt
36 | pip-delete-this-directory.txt
37 |
38 | # Unit test / coverage reports
39 | htmlcov/
40 | .tox/
41 | .coverage
42 | .coverage.*
43 | .cache
44 | nosetests.xml
45 | coverage.xml
46 | *,cover
47 |
48 | # Translations
49 | *.mo
50 | *.pot
51 |
52 | # Django stuff:
53 | *.log
54 |
55 | # Sphinx documentation
56 | docs/_build/
57 |
58 | # PyBuilder
59 | target/
60 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Nick Lane-Smith
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # linkedin-unofficial-api
2 | Documentation and libraries for the unofficial LinkedIn API.
3 |
4 | As of May 19th, 2015, [LinkedIn](https://www.linkedin.com/), gutted their Developer Program. Leaving only a small number of rather uninteresting API Calls. Details here [Developer Program Transition](https://developer.linkedin.com/support/developer-program-transition)
5 |
6 | This project documents the API used by the [LinkedIn Mobile App](https://itunes.apple.com/us/app/linkedin/id288429040). It offers access to most of the original API and a variety of endpoints that were never available.
7 |
8 | ## API Reference
9 |
10 | **Domains**
11 | - `www.linkedin.com` -- Authentication Only
12 | - `touch.www.linkedin.com` -- Everything else
13 |
14 |
15 | **Endpoints**
16 | - **[GET
/authenticate](#user-auth)**
17 | - **[POST
/authenticate](#user-auth)**
18 | - **[GET
/li/v1/people/person](#current-user-profile)**
19 | - **[GET
/li/v1/pages/you](#current-user-page)**
20 | - **[GET
/li/v2/profile/:id](#user-page)**
21 | - **[GET
/li/v1/people/:id/connections](#connections)**
22 | - **[GET
/li/v2/profile/:id/detail/background](#background)**
23 | - **[GET
/li/v2/people/:id/endorsements](#endorsements)**
24 | - **[GET
/li/v1/pages/mailbox](#messages)**
25 |
26 |
27 | **TODO Endpoints**
28 | - **[GET
/li/v2/profile/:id/detail/recommendations](#recommendations)**
29 | - **[GET
/li/v2/notifications](#notifications)**
30 | - **[GET
/li/v2/wvmp](#visitors)**
31 |
32 |
33 | **Headers**
34 |
35 | | Name | Value |
36 | | ---- | ----------------- |
37 | | X-Li-User-Agent | 'LIAuthLibrary:3.2.4 com.linkedin.LinkedIn:8.8.1 iPhone:8.3'|
38 | | User-Agent | 'LinkedIn/8.8.1 CFNetwork/711.3.18 Darwin/14.0.0'|
39 | | X-User-Language | en |
40 | | X-User-Locale | en_US |
41 | | Accept-Language | en-us |
42 |
43 | The top two headers are nessesary for user authentication, the other three make sure the results come back in English not Norwegian.
44 |
45 |
46 | #### User Auth
47 |
48 | Part One: get some cookies
49 |
50 | GET /uas/authenticate
51 |
52 | **Request**
53 | ```sh
54 | $ curl https://www.linkedin.com/uas/authenticate -c cookie.jr -H 'X-Li-User-Agent: LIAuthLibrary:3.2.4 com.linkedin.LinkedIn:8.8.1 iPhone:8.3' -A 'LinkedIn/8.8.1 CFNetwork/711.3.18 Darwin/14.0.0'
55 | ```
56 |
57 | **Response**
58 | ```json
59 | {"status":"success"}
60 | ```
61 |
62 | Part Two: pass in username, password, and a previously obtained session cookie.
63 |
64 | POST /uas/authenticate
65 |
66 | **Parameters**
67 | - session_key -- LinkedIn Username
68 | - session_password -- LinkedIn Password
69 | - JSESSIONID -- session token, found in cookies from first call.
70 |
71 | Currently not sure why require you to pass in a cookie as a query paramerter. seems unnecessary.
72 |
73 | **Request**
74 | ```sh
75 | $ curl https://www.linkedin.com/uas/authenticate -d 'session_key=username%40gmail.com&session_password=sekrett&JSESSIONID=%22ajax%3A4847487595299993333%22' -H 'X-Li-User-Agent: LIAuthLibrary:3.2.4 com.linkedin.LinkedIn:8.8.1 iPhone:8.3' -A 'LinkedIn/8.8.1 CFNetwork/711.3.18 Darwin/14.0.0' -b cookie.jr -c cookie.jr
76 | ```
77 |
78 | **Response**
79 | ```json
80 | {"login_result":"PASS","challenge_url":""}
81 | ```
82 |
83 | login_result:
84 | - PASS -- success, you can now call the API.
85 | - BAD_PASSWORD -- failure, self explanatory.
86 | - CHALLENGE -- the challenge_url will then be set, call it. solve the recaptcha, party on!
87 |
88 | > Some thoughts on how to solve or avoid the captcha. [Issue #1](https://github.com/nickls/linkedin-unofficial-api/issues/1#issuecomment-396908023)
89 |
90 |
91 | #### Current User Profile
92 |
93 | GET /li/v1/people/person
94 |
95 | Get summary data from the logged in user's profile.
96 |
97 | **Request**
98 | ```sh
99 | $ curl https://touch.www.linkedin.com/li/v1/people/person -b cookie.jr -c cookie.jr
100 | ```
101 |
102 | **Response**
103 | ```json
104 | {
105 | "response": {
106 | "authToken": "name:xxyz",
107 | "distance": 0,
108 | "email": "username@gmail.com",
109 | "firstName": "Nick",
110 | "formattedName": "Nick Smith",
111 | "hasPicture": true,
112 | "headline": "Code Monkey",
113 | "id": "293949",
114 | "lastName": "Smith",
115 | "picture": "https://media.licdn.com/mpr/mpr/shrinknp_100_100/p/1/000/202/111/123937.jpg"
116 | }
117 | }
118 | ```
119 | - authToken -- current not sure the use of this token.
120 |
121 | #### Current User Page
122 |
123 | GET /li/v1/pages/you
124 |
125 | Get linkedin page from the logged in user's profile.
126 |
127 | **Request**
128 | ```sh
129 | $ curl https://touch.www.linkedin.com/li/v1/pages/you -b cookie.jr -c cookie.jr
130 | ```
131 |
132 | **Response**
133 | ```json
134 | {
135 | "profile": {
136 | "person": {
137 | "lastName": "Lane-Smith",
138 | "originalPicture": "https://media.licdn.com/mpr/mpr/p/3/000/267/3dd/3c37294.jpg",
139 | "tType": "pt1",
140 | "distance": 0,
141 | "formattedName": "Nick Lane-Smith",
142 | "authToken": "name:xzzf",
143 | "industry": "Computer Networking",
144 | "picture": "https://media.licdn.com/mpr/mpr/shrinknp_100_100/p/3/000/267/3dd/3c37294.jpg",
145 | "phoneNumbers": [],
146 | "hasPicture": true,
147 | "firstName": "Nick",
148 | "location": "San Francisco Bay Area",
149 | "id": "7881116",
150 | "headline": "Founder at BloomAPI"
151 | },
152 | "detail": [...]
153 | }
154 | }
155 | ```
156 |
157 | This JSON blob is huge and not very well structured. It is tied very strongly to the UI of the linkedin app, I wonder why they made this design choice. It could be that the mobile app will adjust the UI to match how the data is layed out. It might also be tightly coupled to the code of the app -- which would suck.
158 |
159 | - person -- profile details for the logged in user.
160 | - detail -- has some useful data similar to the background page.
161 |
162 |
163 | #### User Page
164 |
165 | GET /li/v2/profile/:id
166 |
167 | Get linkedin page/profile for the user's id.
168 |
169 | **Request**
170 | ```sh
171 | $ curl https://touch.www.linkedin.com/li/v2/profile/7881116 -b cookie.jr -c cookie.jr
172 | ```
173 |
174 | **Response**
175 | ```json
176 | {
177 | "personTopCard": {
178 | "summary2": {
179 | "text3": "March 2011 - Present (4 years 7 months)",
180 | "tType": "sum4",
181 | "text1": "BloomAPI",
182 | "pictureUrl": "https://media.licdn.com/media/p/2/000/1a7/291/d8d8d8s.png",
183 | "text2": "Founder",
184 | "pictureLogo": "company_tc",
185 | "link": {
186 | "targetContextType": "experience1",
187 | "partialData": {
188 | "title": "Nick Lane-Smith"
189 | },
190 | "resourcePath": "/li/v2/profile/7881116/detail/background",
191 | "id": "7881116",
192 | }
193 | },
194 | "tType": "personTopCard",
195 | "summary1": {
196 | "tType": "sum1",
197 | "values": [
198 | {
199 | "tType": "sum2",
200 | "text1": "139",
201 | "text2": "connections",
202 | ...
203 | },
204 | ]
205 | },
206 | "text3": "San Francisco, California | Computer Networking",
207 | "text1": "Nick Lane-Smith",
208 | "text2": "Founder at BloomAPI",
209 | "isSelf": true
210 | }
211 | }
212 | ```
213 |
214 | This JSON blob is also huge and not very well structured. How rude!
215 |
216 | - personTopCard -- this section has some useful summary data about the profile: name, id, picture, connections, etc.
217 |
218 |
219 | ### Connections
220 |
221 | GET /li/v1/people/:id/connections
222 |
223 | Get all of the connections for a specific user id.
224 |
225 | **Parameters**
226 | - count -- maximum number of connections to return
227 |
228 | **Request**
229 | ```sh
230 | $ curl "https://touch.www.linkedin.com/li/v1/people/7881116/connections?count=5000" -b cookie.jr -c cookie.jr
231 | ```
232 |
233 | **Response**
234 | ```json
235 | {
236 | "total": 1055,
237 | "count": 1055,
238 | "values": [{
239 | "authToken": "name:xxyz",
240 | "distance": 2,
241 | "firstName": "Mike",
242 | "formattedName": "Mike Smith",
243 | "headline": "Director of Product",
244 | "id": "10420023",
245 | "lastName": "Smith",
246 | "hasPicture": true,
247 | "picture": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/AAEEAQAAAkmAAAAJDcdZzAFJRIDAKAAA84MFKFKKME.jpg",
248 | "tType": "pt3"
249 | },
250 | ...]
251 | }
252 | ```
253 |
254 | ### Background
255 |
256 | GET /li/v2/profile/:id/detail/background
257 |
258 | Get a user's background (eduction, work experience, patents, projects, etc.)
259 |
260 |
261 | **Request**
262 | ```sh
263 | $ curl https://touch.www.linkedin.com/li/v2/profile/39654029/detail/background -b cookie.jr -c cookie.jr
264 | ```
265 |
266 | **Response**
267 | ```json
268 | {
269 | "values": [
270 | {
271 | "tType": "sect4",
272 | "values": [
273 | {
274 | "tType": "prt2",
275 | "text1": "B.A., English and History",
276 | "pictureUrl": "https://media.licdn.com/mpr/mpr/shrinknp_100_100/p/1/005/011/0ec/4deadbeef.png",
277 | "pictureLogo": "education_grey",
278 | "header": "Lewis and Clark College"
279 | }
280 | ],
281 | "contextType": "education1"
282 | },
283 | ...]
284 | }
285 | ```
286 | - contextType -- can filter response by contextType to select desired background details: experience1, education1, education2, etc.
287 |
288 |
289 |
290 | ### Endorsements
291 |
292 | GET /li/v2/people/:id/endorsements
293 |
294 | One of the worst LinkedIn features. Get the endorsements made for user with id.
295 |
296 | **Request**
297 | ```sh
298 | $ curl https://touch.www.linkedin.com/li/v2/people/39654029/endorsements -b cookie.jr -c cookie.jr
299 | ```
300 |
301 | **Response**
302 | ```json
303 | {
304 | "values": [
305 | {
306 | "resourcePath": "/li/v2/people/endorsements?skill=Internal%20Communications",
307 | "values": [
308 | {
309 | "tType": "rt20",
310 | "text1": "Internal Communications",
311 | "count": 2,
312 | "id": "7881116",
313 | "type": "skill"
314 | },
315 | {
316 | "tType": "rt24",
317 | "representsCurrentUser": false,
318 | "text1": "Joshua Reynolds",
319 | "text2": "Head of Marketing at Quantifind, Strategic Advisor to Blanc & Otus and H+K, Holmes Report Top 25 Innovator",
320 | "pictureUrl": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/p/5/005/08b/098/34424324.jpg",
321 | "link": {
322 | "resourcePath": "/li/v1/people/24631444/profile",
323 | "id": "24631444",
324 | "type": "person",
325 | }
326 | },
327 | ...
328 | ]
329 | },
330 | ```
331 | - values[0] -- this is going to be the skill name and count of endorsers.
332 | - values -- the next N array values are profile summaries (icon, name, blurb) for each of the endorsers.
333 |
334 |
335 | ### Messages
336 |
337 | GET /li/v1/pages/mailbox
338 |
339 | Messages and invitations for the current logged in user.
340 |
341 | **Request**
342 | ```sh
343 | $ curl https://touch.www.linkedin.com/li/v1/pages/mailbox -b cookie.jr -c cookie.jr
344 | ```
345 |
346 | **Response**
347 | ```json
348 | {
349 | "invitations": {
350 | "total": 1,
351 | "values": [{
352 | "isCustomMessage": false,
353 | "read": false,
354 | "folder": "inbox",
355 | "tType": "invitation",
356 | "subject": "Invitation to connect on LinkedIn",
357 | "from": {
358 | "hasPicture": true,
359 | "firstName": "Stephan",
360 | "lastName": "Jenkins",
361 | "authToken": "name:xxzy",
362 | "formattedName": "Stephan Jenkins",
363 | "id": "38373",
364 | "headline": "Singer at Third Eye Blind",
365 | "picture": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/XXaSADADAJAKDJHHJJSJSJSJSJSJJSSJJS.jpg"
366 | },
367 | "id": "I60118598766633_500",
368 | "body": "Nick,\n\nI'd like to add you to my professional network on LinkedIn.\n\n- Stephan",
369 | "seen": true,
370 | "timestamp": 1433339090205
371 | }],
372 | "start": 0,
373 | "count": 20,
374 | "droppedCount": 0,
375 | "unseen": 0
376 | },
377 | "messages": {
378 | "total": 44,
379 | "unread": 0,
380 | "values": [{
381 | "read": true,
382 | "folder": "inbox",
383 | "tType": "message",
384 | "subject": "great to meet you last week",
385 | "from": {
386 | "hasPicture": true,
387 | "firstName": "Mike",
388 | "lastName": "Smith",
389 | "authToken": "name:aLS9",
390 | "formattedName": "Mike Smith",
391 | "id": "58708",
392 | "headline": "Co-Founder, Erros ",
393 | "picture": "https://media.licdn.com/mpr/mpr/shrinknp_200_200/XXaSADADAJAKDJHHJJSJSJSJSJSJJSSJJS.jpg"
394 | },
395 | "isMsgTypeInmail": false,
396 | "id": "I6043170444767420416_500",
397 | "to": [{
398 | "hasPicture": true,
399 | "firstName": "Nick",
400 | "lastName": "Smith",
401 | "authToken": "name:VCev",
402 | "formattedName": "Nick Smith",
403 | "id": "293949",
404 | "headline": "Code Monkey",
405 | "picture": "https://media.licdn.com/mpr/mpr/shrinknp_100_100/p/1/000/265/113/1b5f6fe.jpg"
406 | }],
407 | "body": "XXXZZZYYY",
408 | "seen": true,
409 | "timestamp": 1440804110685,
410 | "hasReplied": false
411 | }
412 | ...],
413 | "start": 0,
414 | "count": 20,
415 | "droppedCount": 0,
416 | "unseen": 0
417 | }
418 | }
419 | ```
420 |
421 |
422 | ## Installation & Usage
423 |
424 | [Python Client](https://github.com/tomquirk/linkedin-api) - by [@tomquirk](https://github.com/tomquirk)
425 |
426 | ## Disclamer
427 |
428 | **Use at your own risk!** This API is unofficial and unsupported by LinkedIn.
429 |
430 | ## Credits
431 |
432 | Thanks to the authors of:
433 |
434 | - [Charles Proxy](http://www.charlesproxy.com/)
435 | - [mitmproxy](https://mitmproxy.org/)
436 |
437 | ## License
438 |
439 | [MIT License](https://github.com/nickls/linkedin-unofficial-api/blob/master/LICENSE)
440 |
--------------------------------------------------------------------------------