Posts and lookups
Read public posts when you can, classify any LinkedIn input, and build canonical URLs.
The best-effort and local-only side of linkedin: reading public posts, turning any input into a (kind, id) pair without fetching, and building a canonical URL from a kind and an id.
Posts
linkedin post https://www.linkedin.com/posts/example-activity-123456789
post reads a single public post or article, JSON-LD first (the page's
DiscussionForumPosting or Article node) with an Open Graph backstop. It is
best effort, but single public posts and articles generally return data. When one
is walled, linkedin exits with code 4 ("auth required"). Lending a session with
--cookies gets more of them through:
linkedin post https://www.linkedin.com/posts/example-activity-123456789 --cookies ~/cookies.txt
See troubleshooting for the cookie file format.
Classify an input
id turns a slug, path, or URL into a (kind, id) pair without fetching anything.
It is pure local work, never blocked, and made for scripts:
linkedin id https://www.linkedin.com/in/williamhgates
profile williamhgates
The kinds are profile, company, school, job, post, and unknown. It
takes several at once:
linkedin id williamhgates https://www.linkedin.com/company/microsoft 3801234567
Use it to route inputs to the right command, or to validate input before you
spend a request on it. (Note that school is a recognized kind, but school
pages are walled, so there is no school fetch command.)
Build a URL
url is the inverse of id: give it a kind and an id, and it builds the
canonical LinkedIn URL:
linkedin url profile williamhgates
linkedin url company microsoft
linkedin url job 3801234567
Together, id and url let a script normalize input and re-emit clean links
without touching the network.