---
title: "CLI"
description: "TwexAPI CLI でツイート検索、フォロワーエクスポート、DM、X Articles、ターミナル X API 自動化。"
---

アプリケーションコードなしで、決定的なターミナルコマンド、JSON 出力、dry-run プレビュー、保存済み認証プロファイルが欲しいときに CLI を使いましょう。

| CLI タスク | 実行コマンド | 保存先 |
| -------- | ------------------------ | ------------ |
| Search tweets | `x-api-scraper search tweets` | cursor |
| Read profile | `x-api-scraper about` | `screen_name` |
| List followers | `x-api-scraper followers` | cursor |

## インストール

```bash
npm install -g @twexapi-dev/x-api-scraper-cli
x-api-scraper --help
```

Node.js 18 以上が必要です。

Source: [twexapi-dev/x-api-scraper-cli](https://github.com/twexapi-dev/x-api-scraper-cli)

## 認証

[TwexAPI dashboard](https://twexapi.io/dashboard) から API キーを取得。

```bash
export X_API_SCRAPER_KEY="YOUR_API_KEY"

x-api-scraper auth apps add --name prod --api-key "YOUR_API_KEY"
x-api-scraper auth apps use prod
x-api-scraper --app prod about elonmusk
```

## 基本例

```bash
# Lookup users
x-api-scraper --app prod users elonmusk sama

# Search tweets
x-api-scraper --app prod search tweets "founder" "ai" --sort Latest

# List followers (v3)
x-api-scraper --app prod followers elonmusk

# Global trending tweets
x-api-scraper --app prod trending tweets --country "United States" --topic "Sports" --count 50
```

## 生 API リクエスト

任意の TwexAPI パスを直接呼び出し:

```bash
x-api-scraper --app prod /twitter/elonmusk/about
x-api-scraper --app prod -X POST -d '["elonmusk","sama"]' /twitter/users
```

## スキルとして利用

GitHub スキルインストーラーから:

```bash
npx skills add twexapi-dev/x-api-scraper-cli
```

ClawHub から:

```bash
npx clawhub@latest install x-api-scraper-cli
```

## セキュリティ注意

- CLI は環境変数 `X_API_SCRAPER_KEY`、`X_API_SCRAPER_BASE_URL`、`X_API_SCRAPER_CONFIG_DIR` を読み取ります。
- 保存アプリ設定とプロファイルはデフォルトで `~/.x-api-scraper/config.json` の平文 JSON。
- エージェントワークフローでは書き込み前に必ず `--dry-run`。

## 参考

* [SDKs overview](/sdks)
* [Authentication](/authentication)
* [MCP Server](/mcp/overview)
* [Agent MCP Handoff](/mcp/agent-handoff)
* [Advanced Twitter Search](/api-reference/search-endpoints/get-data-page-twitter-advanced-search-page-post)
* [Source Repository](https://github.com/twexapi-dev/x-api-scraper-cli)
