@peggyrayzis/li 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +181 -0
- package/dist/cli.js +3694 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Scale Advisors LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# li — The LinkedIn CLI for agents
|
|
2
|
+
|
|
3
|
+
Stop opening LinkedIn. Let your agents do it.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g @peggyrayzis/li
|
|
7
|
+
li whoami
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
> Built by [@peggyrayzis](https://linkedin.com/in/peggyrayzis) of [scale.dev](https://scale.dev) — marketing & GTM for devtools and AI founders.
|
|
11
|
+
> Working on something cool? Reach out at **li@scale.dev**.
|
|
12
|
+
|
|
13
|
+
## Why
|
|
14
|
+
|
|
15
|
+
I was tired of building growth workflows that depended on Clay — which doesn't have an API. Then I saw [Bird](https://github.com/steipete/bird) (a CLI for Twitter) and thought: LinkedIn needs this.
|
|
16
|
+
|
|
17
|
+
So I built `li`. Cookie auth, LinkedIn's internal Voyager API, structured JSON output. Now my agents handle prospecting, connection monitoring, and message triage without me ever opening a browser tab.
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### Option A: Auto-extract cookies from Chrome or Safari
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
li check
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
On macOS, `li` can read your LinkedIn cookies directly from Chrome or Safari. If it works, you're done. Fair warning — cookie extraction can be flaky depending on your OS and browser version. If it doesn't work, Option B is reliable.
|
|
28
|
+
|
|
29
|
+
### Option B: Set cookies manually
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Open Chrome DevTools → Application → Cookies → linkedin.com
|
|
33
|
+
# Copy li_at and JSESSIONID values
|
|
34
|
+
|
|
35
|
+
export LINKEDIN_LI_AT="your-li-at-value"
|
|
36
|
+
export LINKEDIN_JSESSIONID="your-jsessionid-value"
|
|
37
|
+
li check
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Verify
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
li whoami # See your profile
|
|
44
|
+
li connections # List your connections
|
|
45
|
+
li messages # Check recent conversations
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Commands
|
|
49
|
+
|
|
50
|
+
v0.1 is read-only. Write commands (`connect`, `send`, `invites accept`) ship in v0.2.
|
|
51
|
+
|
|
52
|
+
### Identity
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
li whoami # Your profile + network counts
|
|
56
|
+
li check # Validate session, show credential source
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Profiles
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
li profile peggyrayzis # View by username
|
|
63
|
+
li profile linkedin.com/in/user # View by URL
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Connections
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
li connections # List connections (default: 20)
|
|
70
|
+
li connections -n 50 # Show 50
|
|
71
|
+
li connections --all # Fetch all (paginated)
|
|
72
|
+
li connections --of peggyrayzis # View someone else's connections
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Invitations
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
li invites # List pending invitations
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Messages
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
li messages # List recent conversations
|
|
85
|
+
li messages read CONV_ID # Read a thread
|
|
86
|
+
li messages read CONV_ID -n 50 # Last 50 messages
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Every command supports `--json` for piping to `jq` or feeding to agents.
|
|
90
|
+
|
|
91
|
+
## Agent Workflows
|
|
92
|
+
|
|
93
|
+
`li` is built for agents. Pipe `--json` output into whatever you want.
|
|
94
|
+
|
|
95
|
+
### Find CTOs in your network
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
li connections --all --json | \
|
|
99
|
+
jq -r '.connections[] | select(.headline | test("CTO"; "i")) | .username'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Check unread messages
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
li messages --json | jq '.conversations[] | select(.unreadCount > 0)'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Find CTOs in a connection's network
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
li connections --of peggyrayzis --all --json | \
|
|
112
|
+
jq -r '.connections[] | select(.headline | test("CTO"; "i")) | .username'
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Export connections to CSV
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
li connections --all --json | \
|
|
119
|
+
jq -r '.connections[] | [.firstName, .lastName, .headline, .username] | @csv'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Global Options
|
|
123
|
+
|
|
124
|
+
| Option | Description |
|
|
125
|
+
|--------|-------------|
|
|
126
|
+
| `--json` | Structured JSON output |
|
|
127
|
+
| `--li-at <token>` | Override li_at cookie |
|
|
128
|
+
| `--jsessionid <token>` | Override JSESSIONID |
|
|
129
|
+
| `--cookie-source <src>` | `chrome`, `safari`, `none`, or `auto` (default) |
|
|
130
|
+
| `--no-progress` | Suppress progress output |
|
|
131
|
+
| `-h, --help` | Help |
|
|
132
|
+
| `-V, --version` | Version |
|
|
133
|
+
|
|
134
|
+
## Environment Variables
|
|
135
|
+
|
|
136
|
+
| Variable | Description |
|
|
137
|
+
|----------|-------------|
|
|
138
|
+
| `LINKEDIN_LI_AT` | Your li_at session cookie |
|
|
139
|
+
| `LINKEDIN_JSESSIONID` | Your JSESSIONID cookie (CSRF token) |
|
|
140
|
+
|
|
141
|
+
## Requirements
|
|
142
|
+
|
|
143
|
+
- Node.js >= 22
|
|
144
|
+
- A valid LinkedIn session (logged in via Chrome)
|
|
145
|
+
|
|
146
|
+
## Rate Limiting
|
|
147
|
+
|
|
148
|
+
LinkedIn is aggressive about bot detection. `li` enforces minimum 500ms between requests with exponential backoff on 429s. For bulk operations, add your own delays between commands.
|
|
149
|
+
|
|
150
|
+
## Programmatic API
|
|
151
|
+
|
|
152
|
+
A library API for using `li` in Node.js applications is planned for v0.2.
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
|
|
156
|
+
PRs welcome. Here's the setup:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
git clone https://github.com/peggyrayzis/li.git
|
|
160
|
+
cd li
|
|
161
|
+
pnpm install
|
|
162
|
+
pnpm test # Run tests
|
|
163
|
+
pnpm lint # Check with Biome
|
|
164
|
+
pnpm run build # Build with tsup
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
This project uses TDD — write tests first, then implement. Tests live in `tests/unit/` and fixtures in `tests/fixtures/`. Run `pnpm test` to confirm everything passes before opening a PR.
|
|
168
|
+
|
|
169
|
+
A few ground rules:
|
|
170
|
+
- **No secrets in code.** Real cookie values, API keys, or PII will be rejected.
|
|
171
|
+
- **No external LinkedIn API libraries.** We own the Voyager calls directly.
|
|
172
|
+
- **v0.1 is read-only.** Write commands (`send`, `connect`, `invites accept`) are deferred to v0.2.
|
|
173
|
+
- **Open an issue first** for large changes so we can discuss the approach.
|
|
174
|
+
|
|
175
|
+
## Disclaimer
|
|
176
|
+
|
|
177
|
+
This tool uses LinkedIn's internal Voyager API with cookie authentication for personal use and agent-powered workflows on your own account. LinkedIn can change their API at any time. Aggressive automation may result in account restrictions. Not affiliated with or endorsed by LinkedIn.
|
|
178
|
+
|
|
179
|
+
## License
|
|
180
|
+
|
|
181
|
+
MIT
|