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 info, or specifically requests to use Grok for free without API billing.

3,891 stars

Best use case

grok-scraper is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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 info, or specifically requests to use Grok for free without API billing.

Teams using grok-scraper should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/grok-scraper/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/aquarius-wing/grok-scraper/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/grok-scraper/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How grok-scraper Compares

Feature / Agentgrok-scraperStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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 info, or specifically requests to use Grok for free without API billing.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Grok Scraper

## Preview

[<video src="./assets/grok-2026-03-15T10-01-45.webm" controls width="100%"></video>](https://github.com/user-attachments/assets/d48c7948-11d5-4606-baf8-db0a0b0a095f)

**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:

```bash
cd scripts
npm install
npx playwright install chromium
```

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

```bash
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**
```bash
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-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](dom-selector-fix.md)**

## Examples

**Standard query**
```bash
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](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-<timestamp>.webm` |
| `--record <path>` | `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:
```bash
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.

Related Skills

news-hot-scraper

3891
from openclaw/skills

This skill should be used when users need to scrape hot news topics from Chinese platforms (微博、知乎、B站、抖音、今日头条、腾讯新闻、澎湃新闻), generate summaries, and cite sources. It supports both API-based and direct scraping methods, and offers both extractive and abstractive summarization techniques.

Data & Research

social-media-content-scraper-pro

3891
from openclaw/skills

Social Media Content Bulk Scraper, extract articles/posts from WeChat, Instagram, TikTok, YouTube, export to Markdown/HTML with full metadata. $0.005 USDT per use.

YouTube Channel Scraper

3891
from openclaw/skills

A browser-based YouTube channel discovery and scraping tool.

Twitter/X Profile Scraper

3891
from openclaw/skills

A browser-based Twitter/X profile discovery and scraping tool.

TikTok Profile Scraper

3891
from openclaw/skills

A browser-based TikTok profile discovery and scraping tool.

Instagram Profile Scraper

3891
from openclaw/skills

A browser-based Instagram profile discovery and scraping tool.

Facebook Page & Group Scraper

3891
from openclaw/skills

> Part of **[ScrapeClaw](https://www.scrapeclaw.cc/)** — a suite of production-ready, agentic social media scrapers for Instagram, YouTube, X/Twitter, and Facebook built with Python & Playwright, no API keys required.

grok-research

3891
from openclaw/skills

Crypto research via Grok model's real-time X/Twitter knowledge. Forwards the user's query as-is to Grok API — no prompt injection, no context bloat. Use when: (1) user asks to research a token's narrative/story/sentiment, (2) user says "调研", "research", "grok research", "查一下叙事", "帮我看看这个币", (3) user wants to know what CT is saying about a token/project. NOT for: price analysis, on-chain data, or trading execution.

mrscraper

3891
from openclaw/skills

Run AI-powered, unblockable web scraping, data extraction with natural language via the MrScraper API

scraper

3891
from openclaw/skills

Structured extraction and cleanup for public, user-authorized web pages. Use when the user wants to collect, clean, summarize, or transform content from accessible pages into reusable text or data. Do not use to bypass logins, paywalls, captchas, robots restrictions, or access controls. Local-only output.

grok-imagine

3891
from openclaw/skills

Generate images and videos using xAI Grok Imagine Extended. Text-to-image, image editing, text-to-video, image-to-video. Use when: user asks to generate, create, or draw an image, or create/animate a video. NOT for: image analysis/understanding (use the image tool instead). Triggers: generate image, create image, draw, grok imagine, make a picture, text to image, generate video, animate, text to video.

sg-property-scraper

3891
from openclaw/skills

Search Singapore property rental and sale listings with flexible filters. Use when asked to search Singapore properties, find rental or sale listings, check property prices near MRT stations, or compare commute times. Supports filtering by listing type (rent/sale), property type (HDB/Condo/Landed), bedrooms, bathrooms, price range, size, TOP year, MRT station codes, distance to MRT, room type, availability, and commute time to a destination. Outputs JSON to stdout.