xurl

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

xurl

xurl

Official CLI for the X API.
X API的官方CLI工具。

Install

安装

Homebrew:
bash
brew install --cask xdevplatform/tap/xurl
npm:
bash
npm install -g @xdevplatform/xurl
Shell script:
bash
curl -fsSL https://raw.githubusercontent.com/xdevplatform/xurl/main/install.sh | bash
Go:
bash
go install github.com/xdevplatform/xurl@latest
Homebrew安装方式:
bash
brew install --cask xdevplatform/tap/xurl
npm安装方式:
bash
npm install -g @xdevplatform/xurl
Shell脚本安装方式:
bash
curl -fsSL https://raw.githubusercontent.com/xdevplatform/xurl/main/install.sh | bash
Go安装方式:
bash
go install github.com/xdevplatform/xurl@latest

Safety

安全注意事项

  • Never read, print, summarize, upload, or paste
    ~/.xurl
    into LLM context.
  • Never ask the user to paste client secrets, bearer tokens, or OAuth tokens into chat.
  • Never use
    --verbose
    in agent runs; it can expose auth headers.
  • Do not run auth commands with inline secret flags in an agent session.
  • The user must register app credentials manually on their machine outside the agent session.
  • 切勿读取、打印、总结、上传或粘贴
    ~/.xurl
    文件内容到大语言模型(LLM)上下文环境中。
  • 切勿要求用户将客户端密钥、Bearer令牌或OAuth令牌粘贴到聊天窗口中。
  • 在Agent运行时切勿使用
    --verbose
    参数;该参数可能会暴露认证头信息。
  • 在Agent会话中不要使用包含内联密钥参数的认证命令。
  • 用户必须在Agent会话之外,手动在本地机器上注册应用凭证。

Auth

认证

Check current state:
bash
xurl auth status
If an app is already registered, complete OAuth 2.0:
bash
xurl auth oauth2
Multi-app:
bash
xurl auth apps list
xurl auth default my-app
xurl auth default my-app alice
xurl --app dev-app /2/users/me
Notes:
  • xurl
    stores app config and tokens in
    ~/.xurl
    .
  • OAuth 2.0 redirect URI in the X developer portal should be
    http://localhost:8080/callback
    .
  • App registration examples with inline secrets are intentionally omitted here. Do that outside the agent session.
查看当前认证状态:
bash
xurl auth status
如果已注册应用,完成OAuth 2.0认证:
bash
xurl auth oauth2
多应用管理:
bash
xurl auth apps list
xurl auth default my-app
xurl auth default my-app alice
xurl --app dev-app /2/users/me
注意事项:
  • xurl
    会将应用配置和令牌存储在
    ~/.xurl
    文件中。
  • 在X开发者门户中设置的OAuth 2.0重定向URI应为
    http://localhost:8080/callback
  • 此处特意省略了包含内联密钥的应用注册示例。请在Agent会话之外完成该操作。

Common shortcuts

常用快捷命令

bash
xurl post "Hello world!"
xurl reply 1234567890 "Nice post"
xurl quote 1234567890 "My take"
xurl delete 1234567890

xurl read 1234567890
xurl search "from:elonmusk" -n 10
xurl whoami
xurl user @XDevelopers
xurl timeline -n 20
xurl mentions -n 10

xurl like 1234567890
xurl unlike 1234567890
xurl repost 1234567890
xurl unrepost 1234567890

xurl bookmark 1234567890
xurl unbookmark 1234567890
xurl bookmarks -n 10
xurl likes -n 10

xurl follow @handle
xurl unfollow @handle
xurl following -n 20
xurl followers -n 20

xurl dm @handle "message"
xurl dms -n 10

xurl media upload path/to/file.mp4
xurl media status MEDIA_ID
POST_ID
can also be a full X status URL.
bash
xurl post "Hello world!"
xurl reply 1234567890 "Nice post"
xurl quote 1234567890 "My take"
xurl delete 1234567890

xurl read 1234567890
xurl search "from:elonmusk" -n 10
xurl whoami
xurl user @XDevelopers
xurl timeline -n 20
xurl mentions -n 10

xurl like 1234567890
xurl unlike 1234567890
xurl repost 1234567890
xurl unrepost 1234567890

xurl bookmark 1234567890
xurl unbookmark 1234567890
xurl bookmarks -n 10
xurl likes -n 10

xurl follow @handle
xurl unfollow @handle
xurl following -n 20
xurl followers -n 20

xurl dm @handle "message"
xurl dms -n 10

xurl media upload path/to/file.mp4
xurl media status MEDIA_ID
POST_ID
也可以是完整的X状态URL。

Raw endpoint mode

原始端点模式

GET:
bash
xurl /2/users/me
POST JSON:
bash
xurl -X POST /2/tweets -d '{"text":"Hello world!"}'
Headers:
bash
xurl -H "Content-Type: application/json" /2/tweets
Choose auth type:
bash
xurl --auth oauth2 /2/users/me
xurl --auth oauth1 /2/tweets
xurl --auth app /2/users/me
Choose OAuth2 account:
bash
xurl --username alice /2/users/me
Streaming:
bash
xurl /2/tweets/search/stream
xurl -s /2/users/me
GET请求:
bash
xurl /2/users/me
POST JSON请求:
bash
xurl -X POST /2/tweets -d '{"text":"Hello world!"}'
自定义请求头:
bash
xurl -H "Content-Type: application/json" /2/tweets
选择认证类型:
bash
xurl --auth oauth2 /2/users/me
xurl --auth oauth1 /2/tweets
xurl --auth app /2/users/me
选择OAuth2账户:
bash
xurl --username alice /2/users/me
流请求:
bash
xurl /2/tweets/search/stream
xurl -s /2/users/me

Quick checks

快速检查

Install:
bash
xurl version
Auth:
bash
xurl auth status
Live request after auth:
bash
xurl whoami
检查安装版本:
bash
xurl version
检查认证状态:
bash
xurl auth status
认证后发送测试请求:
bash
xurl whoami