riku-browser
v0.4.1
Published
Multi-platform browser CLI — x.com, WeChat Official Account (微信公众号) and more, all from terminal. Uses your real Chrome login, zero API keys.
Maintainers
Readme
riku-browser
Multi-platform browser CLI. Browse, search, post — all from terminal. Uses your real Chrome login, zero API keys.
npm install -g riku-browserPrerequisites
- Node.js 22+ (uses built-in WebSocket)
- Chrome (or Chromium, Edge, Brave)
Quick Start
# 1. Start dedicated debug Chrome (one-time setup)
riku chrome start
# 2. Log in to x.com / mp.weixin.qq.com in the new Chrome window
# 3. Use it
riku x tl # Home timeline
riku x post "Hello world!" # Post a tweet
riku weixin drafts # 查看草稿箱
riku weixin post --file a.html --title "标题" # 发布文章Usage
riku <platform> <command> [args] [flags]
riku <platform> help # Show platform commands
riku help # Show all platformsPlatforms
| Platform | Description |
|----------|-------------|
| x | x.com (Twitter) — browse, search, post, DM |
| weixin | mp.weixin.qq.com (微信公众号) — publish articles, manage content |
x.com Commands
Reading
| Command | Description |
|---------|-------------|
| riku x tl | Home timeline |
| riku x tl --following | Following-only timeline |
| riku x search <query> | Search tweets |
| riku x search <query> --type latest | Search latest tweets |
| riku x tweet <url\|id> | View single tweet + replies |
| riku x user <handle> | User profile + recent tweets |
| riku x followers <handle> | User's followers list |
| riku x following <handle> | User's following list |
| riku x trending | Trending topics |
| riku x bookmarks | Your bookmarks |
| riku x notif | Notifications |
| riku x lists | Your lists |
| riku x replies <url\|id> | Replies to a tweet |
| riku x spaces | Live Spaces |
| riku x communities [query] | Browse communities |
| riku x analytics | Your tweet analytics |
| riku x drafts | Your drafts |
| riku x me | Your own profile |
Writing
| Command | Description |
|---------|-------------|
| riku x post <text> | Post a tweet |
| riku x post <text> --media file.jpg | Post with media |
| riku x post <text> --reply-to <url> | Reply to a tweet |
| riku x thread "t1" "t2" "t3" | Post a thread |
| riku x delete <url\|id> | Delete a tweet |
| riku x quote <url\|id> "text" | Quote tweet |
| riku x schedule <text> --at "2026-03-17 10:00" | Schedule a tweet |
| riku x poll "q" "o1" "o2" | Post a poll |
Interactions
| Command | Description |
|---------|-------------|
| riku x like <url\|id> | Like |
| riku x unlike <url\|id> | Unlike |
| riku x rt <url\|id> | Retweet |
| riku x unrt <url\|id> | Undo retweet |
| riku x bookmark <url\|id> | Bookmark |
| riku x unbookmark <url\|id> | Remove bookmark |
| riku x follow <handle> | Follow |
| riku x unfollow <handle> | Unfollow |
| riku x block <handle> | Block |
| riku x unblock <handle> | Unblock |
| riku x mute <handle> | Mute |
| riku x unmute <handle> | Unmute |
DMs
| Command | Description |
|---------|-------------|
| riku x dm list | List conversations |
| riku x dm read <user> | Read conversation |
| riku x dm send <user> <text> | Send DM |
微信公众号 Commands
Supports two modes: API mode (faster, more reliable) and CDP mode (browser automation, no API key needed).
API Configuration (Optional)
riku weixin config set --appid YOUR_APP_ID --secret YOUR_APP_SECRET
riku weixin config showWithout API config, all commands fall back to CDP browser automation.
Writing
| Command | Description |
|---------|-------------|
| riku weixin post --file a.html --title "标题" | 发布图文 (HTML) |
| riku weixin post ... --draft | 保存为草稿 |
| riku weixin post ... --publish | 直接发布 |
| riku weixin post ... --preview | 发送预览到手机 |
| riku weixin post ... --cover img.jpg | 指定封面图 |
| riku weixin post ... --author "作者" | 设置作者 |
| riku weixin post ... --original | 声明原创 |
| riku weixin post ... --stock-images [keywords] | 自动搜索配图插入文章 |
| riku weixin image-post --file img.jpg | 发布图片帖 |
| riku weixin video-post --file vid.mp4 | 发布视频 |
| riku weixin audio-post --file audio.mp3 | 发布音频 |
| riku weixin repost --url <url> | 转载文章 |
| riku weixin publish <media_id> | 发布草稿 (API) |
Reading
| Command | Description |
|---------|-------------|
| riku weixin drafts | 草稿箱列表 |
| riku weixin drafts search <keyword> | 搜索草稿 |
| riku weixin drafts delete <media_id> | 删除草稿 |
| riku weixin articles | 已发表文章 |
| riku weixin media [--type image\|audio\|video] | 素材库 |
| riku weixin original | 原创管理 |
| riku weixin collections | 合集管理 |
| riku weixin stats | 数据统计 |
| riku weixin account | 账号信息 |
Stock Images (配图)
Search free stock images and auto-insert into articles. Default uses Unsplash (no API key needed).
# Search stock images
riku weixin stock search "artificial intelligence"
riku weixin stock search "科技" -n 5 --json
# Auto-insert into article during post
riku weixin post --file article.html --title "AI" --stock-images "technology" --draft
# Configure alternative provider (optional)
riku weixin stock config set --provider pexels --key YOUR_KEY
riku weixin stock config show| Provider | API Key | Notes | |----------|---------|-------| | Unsplash | Not needed | Default, 1080px images | | Pexels | Free registration | 940px images | | Pixabay | Free registration | 1280px images |
Utility
| Command | Description |
|---------|-------------|
| riku chrome start | Start debug Chrome |
| riku chrome stop | Stop debug Chrome |
| riku chrome status | Check Chrome status |
| riku x open <url\|id> | Open in browser |
| riku x selftest | Run x.com diagnostics |
| riku weixin selftest | Run weixin diagnostics |
Global Flags
| Flag | Description |
|------|-------------|
| --json | Output raw JSON |
| -n <number> | Limit results |
| --debug | Show debug info |
Adding a New Platform
Create lib/platforms/<name>/index.mjs that exports a platform definition:
export default {
name: 'myplatform',
description: 'My Platform — description here',
urlPatterns: ['myplatform.com'],
defaultUrl: 'https://myplatform.com',
commands: { /* ... */ },
help() { /* ... */ },
};That's it — riku auto-discovers platforms, no core code changes needed.
How It Works
riku-browser connects to Chrome via the DevTools Protocol (CDP). It supports two transport modes:
- Pipe mode (default): Uses Unix socket (
~/.x-cli/cdp.sock) via--remote-debugging-pipe— no macOS firewall popup - WebSocket mode (fallback): Connects via
--remote-debugging-port
It reads the accessibility tree of web pages to extract structured data, and interacts with pages using CDP Input events.
No API keys required, no scraping, no headless browser — it uses your real Chrome with your real login session.
Terminal (riku CLI)
| Unix Socket / WebSocket (CDP)
v
Your Chrome -> x.com / mp.weixin.qq.com / ... (your login session)For WeChat, an optional API mode provides faster, more reliable article publishing via the official WeChat API.
Zero Dependencies
riku-browser has zero npm dependencies. It uses only Node.js built-in modules:
WebSocket(Node 22+)https,http,child_process,fs,os,path,crypto
License
MIT
