Skip to main content

LinkedIn CLI tool using Safari session cookies

Project description

LinkedIn CLI

A command-line interface for LinkedIn, powered by Safari session cookies and LinkedIn's internal Voyager API.

Browse your feed, view notifications, create posts, react to content, search people, and view profiles — all from the terminal.

Installation

cd li-cli
pip install -e .

Requirements

  • macOS with Safari
  • Python 3.10+
  • Active LinkedIn session in Safari (you must be logged in)

Commands

Authentication

# Test connection and see your profile
li auth

Profile

# View your own profile
li me

# View someone else's profile
li profile johndoe

Feed

# Show your LinkedIn feed
li feed

# Limit number of posts
li feed -n 5

Notifications

# View recent notifications
li notif

# Limit to 5 notifications
li notif -n 5

Shows notification headlines, timestamps, read/unread status, and content previews. Activity-linked notifications include a copyable li view command.

View Post Detail

# By activity URN
li view urn:li:activity:7426564508296400897

# By numeric ID only
li view 7426564508296400897

# From a feed URL path
li view /feed/update/urn:li:activity:7426564508296400897

Displays full post text, author, reaction breakdown (like, celebrate, love, etc.), comment/share counts, and inline comments.

Create a Post

# Simple post
li post "Hello LinkedIn!"

# With visibility setting
li post "Hello connections!" --visibility CONNECTIONS

# With mention (by URN)
li post "Great work @John!" --mention "John:urn:li:fsd_profile:ACoAAabc123"

# With mention (by profile ID — auto-resolves URN)
li post "Great work @John!" --mention "John:johndoe"

React to a Post

# Like a post (default)
li react urn:li:activity:7426564508296400897

# Choose reaction type
li react 7426564508296400897 --type celebrate
li react 7426564508296400897 --type love
li react 7426564508296400897 --type insightful
li react 7426564508296400897 --type funny
li react 7426564508296400897 --type curious

# Remove your reaction
li react 7426564508296400897 --undo

Comment on a Post

# Top-level comment on a post
li comment urn:li:activity:7426564508296400897 "Great post!"

# By numeric ID
li comment 7426564508296400897 "Nice one!"

# Reply to a specific comment (URN from `li view` output)
li comment "urn:li:comment:(activity:7426564508296400897,7426673256407007233)" "Thanks!"

Search People

li search "software engineer"
li search "John Doe" -n 5

How It Works

This CLI extracts session cookies from Safari's cookie store (~/Library/Cookies/Cookies.binarycookies) to authenticate with LinkedIn's internal APIs:

  • Voyager REST API — used for read operations (feed, profile, search, notifications, post detail) and comments
  • GraphQL API — used for creating posts and fetching comment threads
  • RSC (React Server Components) API — used for reactions (like/unlike)

No OAuth flow or API keys required — just log into LinkedIn in Safari and you're ready to go.

Cookies Used

Cookie Purpose
li_at LinkedIn authentication token
JSESSIONID CSRF token

Project Structure

linkedin_cli/
  __init__.py        # Package metadata
  auth.py            # Safari cookie extraction
  client.py          # LinkedIn API client (Voyager + RSC)
  cli.py             # Click CLI commands
  utils.py           # Formatting helpers
  rsc_template.json  # RSC payload template for reactions

Disclaimer

This tool uses LinkedIn's unofficial internal API. Use responsibly:

  • LinkedIn may rate limit or restrict your account
  • The API may change without notice
  • This is for personal use only

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linkedin_cli_tool-0.1.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linkedin_cli_tool-0.1.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file linkedin_cli_tool-0.1.0.tar.gz.

File metadata

  • Download URL: linkedin_cli_tool-0.1.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for linkedin_cli_tool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 918f230f85f9807443ea5bfdfc2cbc0901596ab6b7ae6a765d940ffebfaed37f
MD5 82dd9c5f684223d91fcdedec5cb8fd20
BLAKE2b-256 681e5c621153f7e8f146176c57821d95e3b46dfb425697a8db0a712fae986016

See more details on using hashes here.

File details

Details for the file linkedin_cli_tool-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for linkedin_cli_tool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 850bff62c27a1d2aa0ccc74e74976541e8ee9cf622b2d857c5d56031b3b6c0c7
MD5 daa37dfc1b6145b50bca6aacec80befb
BLAKE2b-256 e4843f64614153e607956c06911de5adf21f410bd725c2452e11c9d0b767a413

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page