linkedin-agent
v1.0.1
Published
LinkedIn automation — scrape posts, publish, edit, delete via REST API
Maintainers
Readme
linkedin-agent
LinkedIn CLI tool for scraping posts, publishing, editing, and deleting — all from your terminal.
Install
npm install -g linkedin-agentOr run directly:
npx linkedin-agentCommands
get — Scrape posts
Collects posts and engagement metrics (likes, comments, shares) via browser automation.
# Scrape your own posts
linkedin-agent get
# Scrape a specific profile
linkedin-agent get -p https://www.linkedin.com/in/someone
# Limit to recent 10 posts
linkedin-agent get -l 10
# Specify output directory
linkedin-agent get -o ./dataOn first run, a browser window opens for LinkedIn login. The session persists across runs.
Repeated runs on the same day merge with existing data (no duplicates).
Options:
| Flag | Description | Default |
|------|-------------|---------|
| -p, --profile <url> | Target profile URL | Your profile |
| -l, --limit <n> | Max posts to collect | All |
| -o, --output <dir> | Output directory | Current directory |
| -m, --max-scrolls <n> | Max scroll iterations | 100 |
auth — Set up OAuth
Required for post, edit, and delete commands.
# Auto: creates a Developer App + OAuth in one step
linkedin-agent auth
# Manual: use existing app credentials
linkedin-agent auth --client-id YOUR_ID --client-secret YOUR_SECRETpost — Publish a post
# Post inline text
linkedin-agent post -t "Hello LinkedIn!"
# Post from a file
linkedin-agent post -f ./post.md
# Post with a link attachment
linkedin-agent post -t "Check this out" --link https://example.comedit — Edit a post
linkedin-agent edit --id "urn:li:share:123456" -t "Updated content"
linkedin-agent edit --id "urn:li:share:123456" -f ./updated.mddelete — Delete a post
linkedin-agent delete --id "urn:li:share:123456"Output Format
get saves posts as JSON:
[
{
"id": "urn:li:activity:123456",
"text": "Post content...",
"publishedAt": "2w",
"numLikes": 42,
"numComments": 5,
"numShares": 3,
"url": "https://www.linkedin.com/feed/update/urn:li:activity:123456/"
}
]File naming: posts_{username}_{date}.json
How It Works
get: Uses Playwright to open a real browser, intercepts LinkedIn's internal Voyager API responses as you scroll, and extracts post data.post/edit/delete: Uses LinkedIn's official REST API with OAuth 2.0 authentication.
Requirements
- Node.js 18+
- Chromium (auto-installed via Playwright on first run)
License
ISC
