OCaml client for the LinkedIn Voyager API
OCaml 96.7%
Dune 1.1%
Other 2.2%
21 1 0

Clone this repository

https://tangled.org/gazagnaire.org/ocaml-linkedin https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-linkedin
git@git.recoil.org:gazagnaire.org/ocaml-linkedin git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-linkedin

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

linkedin#

OCaml client for the LinkedIn Voyager API.

Typed OCaml bindings for LinkedIn's internal Voyager API, providing access to profiles and feed posts. Authentication uses browser session cookies (li_at and JSESSIONID) rather than OAuth. Includes a command-line tool that can automatically extract session cookies from Chrome's encrypted cookie store on macOS.

The library uses requests for HTTP, jsont for JSON encoding/decoding, cookeio for cookie management, and Eio for concurrency.

Installation#

opam install linkedin

Usage#

Library#

Eio_main.run @@ fun env ->
Eio.Switch.run @@ fun sw ->
let api = Linkedin.Api.v ~sw env ~li_at:"..." ~jsessionid:"..." in
match Linkedin.Api.me api with
| Ok profile -> Fmt.pr "%a@." Linkedin.Profile.pp profile
| Error e -> Fmt.epr "%a@." Linkedin.Api.pp_error e

Command-line#

# Extract cookies from Chrome (macOS, prompts for Keychain access)
linkedin cookies

# Show your own profile
linkedin me

# Show another user's profile
linkedin profile johndoe
linkedin profile https://www.linkedin.com/in/johndoe

# Show feed posts
linkedin posts johndoe
linkedin posts -n 5 johndoe

# Show a single post by URN or URL
linkedin post urn:li:activity:7123456789
linkedin post https://www.linkedin.com/posts/johndoe_title-activity-123-abc

API#

  • Api -- HTTP client authenticated with li_at and JSESSIONID cookies. Provides me, profile, posts, and post endpoints.
  • Profile -- LinkedIn profile type with public ID, name, headline, summary, location, and entity URN. Includes JSON codecs for both profileView and /me response formats.
  • Post -- Feed post type with URN, text, author name, timestamps, and engagement counts. Includes codecs for feed responses and normalized Voyager responses.
  • Chrome_cookies -- Extracts and decrypts LinkedIn session cookies from Chrome's SQLite cookie store on macOS using Keychain, PBKDF2, and AES-CBC.
  • Linkedin_url -- Parses LinkedIn profile and post URLs into structured types. Recognises /in/{id}, /feed/update/urn:..., and /posts/{slug} formats.