OCaml client for the LinkedIn Voyager API
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: add README.md for 18 packages missing documentation

Add READMEs for: ocaml-fdir, ocaml-initramfs, ocaml-jailhouse,
ocaml-linkedin, ocaml-openamp, ocaml-pid1, ocaml-rpmsg, ocaml-sbom,
ocaml-slack, ocaml-vz, ocaml-zephyr, space, space-block, space-ground,
space-net, space-sim, space-test, space-wire.

+69
+69
README.md
··· 1 + # linkedin 2 + 3 + OCaml client for the LinkedIn Voyager API. 4 + 5 + Typed OCaml bindings for LinkedIn's internal Voyager API, providing access to 6 + profiles and feed posts. Authentication uses browser session cookies (`li_at` 7 + and `JSESSIONID`) rather than OAuth. Includes a command-line tool that can 8 + automatically extract session cookies from Chrome's encrypted cookie store on 9 + macOS. 10 + 11 + The library uses `requests` for HTTP, `jsont` for JSON encoding/decoding, 12 + `cookeio` for cookie management, and Eio for concurrency. 13 + 14 + ## Installation 15 + 16 + ``` 17 + opam install linkedin 18 + ``` 19 + 20 + ## Usage 21 + 22 + ### Library 23 + 24 + ```ocaml 25 + Eio_main.run @@ fun env -> 26 + Eio.Switch.run @@ fun sw -> 27 + let api = Linkedin.Api.v ~sw env ~li_at:"..." ~jsessionid:"..." in 28 + match Linkedin.Api.me api with 29 + | Ok profile -> Fmt.pr "%a@." Linkedin.Profile.pp profile 30 + | Error e -> Fmt.epr "%a@." Linkedin.Api.pp_error e 31 + ``` 32 + 33 + ### Command-line 34 + 35 + ``` 36 + # Extract cookies from Chrome (macOS, prompts for Keychain access) 37 + linkedin cookies 38 + 39 + # Show your own profile 40 + linkedin me 41 + 42 + # Show another user's profile 43 + linkedin profile johndoe 44 + linkedin profile https://www.linkedin.com/in/johndoe 45 + 46 + # Show feed posts 47 + linkedin posts johndoe 48 + linkedin posts -n 5 johndoe 49 + 50 + # Show a single post by URN or URL 51 + linkedin post urn:li:activity:7123456789 52 + linkedin post https://www.linkedin.com/posts/johndoe_title-activity-123-abc 53 + ``` 54 + 55 + ## API 56 + 57 + - **`Api`** -- HTTP client authenticated with `li_at` and `JSESSIONID` cookies. 58 + Provides `me`, `profile`, `posts`, and `post` endpoints. 59 + - **`Profile`** -- LinkedIn profile type with public ID, name, headline, 60 + summary, location, and entity URN. Includes JSON codecs for both 61 + `profileView` and `/me` response formats. 62 + - **`Post`** -- Feed post type with URN, text, author name, timestamps, and 63 + engagement counts. Includes codecs for feed responses and normalized Voyager 64 + responses. 65 + - **`Chrome_cookies`** -- Extracts and decrypts LinkedIn session cookies from 66 + Chrome's SQLite cookie store on macOS using Keychain, PBKDF2, and AES-CBC. 67 + - **`Linkedin_url`** -- Parses LinkedIn profile and post URLs into structured 68 + types. Recognises `/in/{id}`, `/feed/update/urn:...`, and `/posts/{slug}` 69 + formats.