← 返回 Skills 市场
aquarius-wing

Grok Scraper

作者 aquarius-wing · GitHub ↗ · v0.1.1 · MIT-0
cross-platform ✓ 安全检测通过
245
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install grok-scraper
功能描述
Execute queries to Grok AI via Playwright browser automation without requiring an X API KEY. Use when the user wants to "ask Grok", search X for real-time in...
使用说明 (SKILL.md)

Grok Scraper

Preview

\x3Cvideo src="./assets/grok-2026-03-15T10-01-45.webm" controls width="100%">\x3C/video>

Agent Context: This is a zero-cost alternative to official X APIs. It uses a real browser session (Playwright) via an X Premium account. ALWAYS use this skill when the user wants to query Grok but does not have or want to use an X API KEY.

Prerequisites

  • OpenClaw must be installed on the host machine.
  • A display/GUI environment is required. This skill launches a real browser window for login. It cannot run on headless cloud servers (no screen). It must be used on a local machine or a remote desktop with a display.
  • The user must be logged in to x.com via the browser session saved by npm run login. Without a valid session, all queries will fail.

First-Time Setup

Run these commands once after cloning the repo, before doing anything else:

cd scripts
npm install
npx playwright install chromium

Then log in to x.com to create a session:

npm run login
# A browser window will open — log in to x.com manually, then return to the terminal and press Enter

The session/ directory will be created automatically after a successful login.

Workflow

Step 1: Check Login State

  • If session/ directory does not exist: stop and ask the user to run cd scripts && npm run login.
  • If it exists: proceed.

Step 2: Execute Query

scripts/run.sh "The user's detailed prompt"

run.sh handles logging, automatic retry on Grok service errors, and login-expiry detection. It is the canonical entry point for all queries.

Step 3: Read Output

  • Exit Code 0 → read output/latest.md and present the result.
  • Other exit codes → see Error Handling below.

Error Handling

Exit Code Meaning Action
0 Success Read output/latest.md
2 Session expired Ask user to run cd scripts && npm run login
3 Grok service error run.sh already retried once; report failure to user
1 Extraction failed Check if output/debug-dom.json was written → if yes, DOM selectors may have broken — see dom-selector-fix.md

DOM Selectors Breaking

Twitter/X redeploys its front-end regularly, which changes the CSS class names this scraper relies on. If extraction fails with Method: none, follow the fix guide:

dom-selector-fix.md

Examples

Standard query

scripts/run.sh "Search for the latest AI news and format as markdown"
# → read output/latest.md

Session expired

  1. Run scripts/run.sh → Exit Code 2
  2. Tell user: "Session expired, please run cd scripts && npm run login"

DOM selectors broken

  1. Run scripts/run.sh → Exit Code 1, output/debug-dom.json exists
  2. Follow dom-selector-fix.md to identify new classes and update SELECTORS in scripts/scrape.js

Debugging

When diagnosing scraper issues directly, use the bare command — it skips logging and retry logic, making failures easier to inspect.

Flag Example Description
(none) npm run scrape Run with default prompt
"prompt" npm run scrape -- "Your question" Custom prompt
--record npm run scrape -- --record Record video to output/grok-\x3Ctimestamp>.webm
--record \x3Cpath> npm run scrape -- --record out.webm Record video to custom path (relative → output/)
--size WxH npm run scrape -- --record --size 1920x1080 Set recording resolution (default: 1280x800)

All flags can be combined:

cd scripts
npm run scrape -- "Your prompt" --record --size 1920x1080

When --record is active, the browser runs in headed mode (visible window) with slowMo: 50ms; without it, headless mode is used.

安全使用建议
This skill appears to do what it claims (automate Grok queries by controlling a real browser). Before installing: (1) Understand it requires an interactive login to x.com and will store session cookies under the skill's session/ directory — treat that folder as sensitive (do not install on shared or untrusted hosts). (2) The skill recommends and supports cron scheduling; scheduled runs will act as your logged-in account—only enable scheduling if you accept automated activity under your account. (3) Review the scripts (login.js, scrape.js, run.sh) and outputs (output/) so you know what data is written locally. (4) Consider policy/ToS implications of scraping/automation for x.com/Grok and prefer official APIs where appropriate. (5) If you proceed, run it in an isolated environment (dedicated VM or local machine), and revoke/recreate your session if you suspect compromise.
功能分析
Type: OpenClaw Skill Name: grok-scraper Version: 0.1.1 The grok-scraper bundle is a legitimate browser automation tool designed to interface with Grok AI via Playwright. It provides scripts for manual login (login.js), DOM structure analysis (inspect-dom.js), and automated querying (scrape.js). The code follows standard Playwright patterns for session management and content extraction, saving all results and session data locally to the 'output/' and 'session/' directories. There is no evidence of data exfiltration, malicious remote execution, or prompt injection; the documentation is transparent about the tool's reliance on X Premium accounts and the fragility of CSS selectors on X.com.
能力评估
Purpose & Capability
The name/description claim (use Playwright to query Grok without an X API key) matches the included scripts (login.js, scrape.js, inspect-dom.js, run.sh) and README. There are no unrelated env vars, binaries, or surprising dependencies. The design (persisted browser session + Playwright) is a coherent method for the stated goal.
Instruction Scope
SKILL.md and README instruct the agent/operator to run npm install, run playwright, perform an interactive login to x.com that saves a local session directory, and then run scripts/run.sh to execute queries. This stays within the scraper's purpose, but the instructions also encourage cron scheduling and say to 'ALWAYS use this skill' when free Grok access is requested — which could cause automated, repeated use of the user's logged-in account if enabled.
Install Mechanism
No binary download/install spec in the skill registry; install is via npm (package.json) and npx playwright install chromium. Those are standard and traceable (npm/Playwright). The repository does not pull arbitrary archives or use obscure URLs.
Credentials
The skill requests no environment variables, which is proportional. However it requires and will store a browser session (cookies/credentials) in the skill's session/ directory after the manual login — this grants the skill the ability to act as the logged-in user on x.com. That is necessary for the scraper's method but is a sensitive capability the user should understand and protect.
Persistence & Privilege
always:false (normal). The skill can be invoked autonomously (disable-model-invocation:false) which is the platform default. Combined with the saved session and the provided run.sh + cron examples, the skill can be scheduled to run automated queries as the user's account. This is expected for this use case but increases the blast radius if the session or skill is compromised.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install grok-scraper
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /grok-scraper 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.1
- Added a video preview section to SKILL.md for visual demonstration of Grok Scraper in action. - No changes to functionality or code; documentation update only.
v0.1.0
Initial release of grok-scraper — a zero-cost tool for Grok AI queries via browser automation: - Uses Playwright and an X Premium account to execute Grok queries without an X API KEY. - Requires OpenClaw and a local or GUI environment (not headless/cloud). - Simple CLI workflow: check login state, run script, and read output. - Automatically handles retries, session expiry, and DOM selector changes. - Includes error codes and guides for fixing extraction issues due to X.com front-end updates.
元数据
Slug grok-scraper
版本 0.1.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Grok Scraper 是什么?

Execute queries to Grok AI via Playwright browser automation without requiring an X API KEY. Use when the user wants to "ask Grok", search X for real-time in... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 245 次。

如何安装 Grok Scraper?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install grok-scraper」即可一键安装,无需额外配置。

Grok Scraper 是免费的吗?

是的,Grok Scraper 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Grok Scraper 支持哪些平台?

Grok Scraper 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Grok Scraper?

由 aquarius-wing(@aquarius-wing)开发并维护,当前版本 v0.1.1。

💬 留言讨论