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 withli_atandJSESSIONIDcookies. Providesme,profile,posts, andpostendpoints.Profile-- LinkedIn profile type with public ID, name, headline, summary, location, and entity URN. Includes JSON codecs for bothprofileViewand/meresponse 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.