Skip to content

Latest commit

 

History

History
116 lines (82 loc) · 3.75 KB

File metadata and controls

116 lines (82 loc) · 3.75 KB
name x-api-scraper-cli
description Use this skill when the task should be done through the x-api-scraper command-line client, including installing the CLI, configuring an API key, previewing requests, and fetching Twitter/X data through convenience commands or raw paths.

x-api-scraper-cli

Use this skill when the task should be completed by running x-api-scraper commands instead of re-implementing request logic by hand.

Public docs for this skill focus on API-key read workflows: fetch, search, profile, and timeline.

Use this skill when

  • the user wants to install or run the x-api-scraper CLI
  • the user wants to configure an API key / app config
  • the user wants to test or inspect requests with --dry-run
  • the user wants to call supported Twitter/X read commands for users, tweets, articles lookup, profile, timeline, global trending tweets, search, followers, following, or lists
  • the user knows an endpoint path and wants to call it through the generic x-api-scraper <path> form

Do not treat this skill as the main interface when the task is to edit the CLI source code itself.

Default approach

  1. Confirm the CLI is available.
  2. Make sure an app config or API key is available.
  3. Prefer convenience read commands first.
  4. Fall back to x-api-scraper <path> only when no convenience command fits.
  5. Use --dry-run to preview request construction when helpful.

Install and run

For normal users, prefer the published npm package:

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

When working from this repository:

node ./bin/x-api-scraper.js --help

If a local executable is needed while developing:

npm link
x-api-scraper --help

Requires Node.js 18 or newer.

Auth rules

  • API keys come from https://twexapi.io/dashboard.
  • For one-off commands, X_API_SCRAPER_KEY or --api-key is acceptable.
  • The CLI also respects X_API_SCRAPER_BASE_URL and X_API_SCRAPER_CONFIG_DIR.
  • For repeated usage, prefer saved app configs with auth apps add.
  • By default the CLI reads and writes persistent config in ~/.x-api-scraper/config.json.
  • Saved app configs may include API keys in plain JSON.
  • On shared machines or CI, prefer --config-dir or X_API_SCRAPER_CONFIG_DIR to isolate credentials.

App setup:

x-api-scraper auth apps add --name prod --api-key "twitterx_..."
x-api-scraper auth apps use prod

Inspect config:

x-api-scraper config show
x-api-scraper config path

Command selection

Prefer convenience read commands such as:

x-api-scraper --app prod about elonmusk
x-api-scraper --app prod users elonmusk sama
x-api-scraper --app prod search users "openai" --count 20
x-api-scraper --app prod trending tweets --country "United States" --topic "Sports" --count 50
x-api-scraper --app prod timeline user elonmusk
x-api-scraper --app prod tweet lookup 1900000000000000000 --summary

Use the generic path form when the endpoint is known but not wrapped:

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

Safety and execution rules

  • Put global options such as --app, --api-key, and --dry-run before the command.
  • Prefer read workflows documented here; do not treat account-session write flows as the default path.
  • The CLI masks secrets in config output and dry-run previews, but still avoid echoing raw credentials back to the user.

Recommended test flow

Use an isolated config directory for local testing:

x-api-scraper --config-dir ./.x-api-scraper-local config show

Recommended order:

  1. Verify the CLI starts with x-api-scraper --help or node ./bin/x-api-scraper.js --help.
  2. Verify a read command such as about or users.
  3. Verify a raw-path request if needed.