54 lines
1.2 KiB
Markdown
54 lines
1.2 KiB
Markdown
# X No-API Bot (Starter)
|
|
|
|
Safe starter for using X without official API.
|
|
|
|
## What this does
|
|
- `login`: saves browser session cookie/state
|
|
- `fetch`: read-only fetch from X search timeline
|
|
- `post`: optional posting (disabled by default)
|
|
|
|
## Setup
|
|
```bash
|
|
cd /home/openclaw/.openclaw/workspace/automations/x-no-api-bot
|
|
cp .env.example .env
|
|
npm install
|
|
npx playwright install chromium
|
|
```
|
|
|
|
## 1) Login once
|
|
```bash
|
|
npm run login
|
|
```
|
|
A browser opens. Log in to X manually, then press Enter in terminal.
|
|
|
|
## 2) Read-only fetch
|
|
```bash
|
|
npm run fetch
|
|
```
|
|
Outputs JSON and saves a log under `logs/`.
|
|
|
|
## 3) Optional posting (off by default)
|
|
Edit `.env`:
|
|
```ini
|
|
ENABLE_POSTING=true
|
|
```
|
|
Then draft a post:
|
|
```bash
|
|
npm run post -- "Hello from no-API automation"
|
|
```
|
|
Publish only with explicit confirm:
|
|
```bash
|
|
npm run post -- "Hello from no-API automation" --confirm
|
|
```
|
|
|
|
## Cron (read-only)
|
|
Example every 30 min:
|
|
```cron
|
|
*/30 * * * * cd /home/openclaw/.openclaw/workspace/automations/x-no-api-bot && /usr/bin/npm run fetch >> logs/cron.log 2>&1
|
|
```
|
|
|
|
## Notes
|
|
- UI can change and break selectors.
|
|
- Keep activity low-volume to reduce account risk.
|
|
- Prefer read-only monitoring unless you explicitly need posting.
|