Skip to content
Back to skills

X Scraper

ASecurity

Scrape public posts from X.com (Twitter) users. Extracts text content, timestamps, engagement metrics (views, likes, retweets, replies), and generates direct post links. Use when user asks to scrape/fetch/analyze X.com posts or Twitter data, or mentions "整理@某人的发言" or "看看某人在X上说了什么".

  • 225 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 4, 2026
toolspythonbashapi

Works with

  • api

Security analysis

A100/100

Pro scans all 13 files and shows the line behind each finding

Scanned September 4, 2026

npx -y skills add NeverSight/skills_feed --skill x-scraper --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of X Scraper?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for X Scraper
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/neversight-x-scraper/badge)](https://www.skillsdirectory.com/skills/neversight-x-scraper)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: x-scraper
description: Scrape public posts from X.com (Twitter) users. Extracts text content, timestamps, engagement metrics (views, likes, retweets, replies), and generates direct post links. Use when user asks to scrape/fetch/analyze X.com posts or Twitter data, or mentions "整理@某人的发言" or "看看某人在X上说了什么".
---

# X.com Post Scraper

Extracts recent posts from X.com users with full engagement data using authenticated cookies.

## Quick Start

**Basic command**:
```bash
cd .opencode/skills/x-scraper/scripts
python3 scraper.py <username> [count]
```

**Example**:
```bash
python3 scraper.py example_user 15
```

**Output**: `/tmp/x_{username}_posts.json`

---

## Prerequisites

Before first use, verify environment requirements:

1. **Python 3.11+**: Check with `python3 --version`
2. **Playwright**: Check with `python3 -c "import playwright"`
3. **Cookie file**: Check with `ls /tmp/x_cookies_pw.json`

**If any prerequisite is missing**, see [references/setup.md](references/setup.md) for detailed installation and configuration guide.

---

## Common Workflows

### First-time setup
See [references/setup.md](references/setup.md) for complete environment configuration.

### Daily scraping
```bash
python3 scraper.py <username> [count]
```

### Custom cookie file
```bash
python3 scraper.py <username> [count] --cookie-file /path/to/cookies.json
```

### Troubleshooting
If scraper fails, see [references/troubleshooting.md](references/troubleshooting.md) for common issues and solutions.

---

## Output Format

```json
{
  "index": 1,
  "username": "example_user",
  "postId": "1234567890123456789",
  "publishTime": "2025-12-03T18:28:32.000Z",
  "postLink": "https://x.com/example_user/status/1234567890123456789",
  "textContent": "Post text content...",
  "views": "471K",
  "likes": "1.1K",
  "retweets": "153",
  "replies": "44"
}
```

**Key fields**:
- `postLink` - Direct URL to post
- `publishTime` - ISO 8601 timestamp
- `views/likes/retweets/replies` - Abbreviated metrics (K, M)

---

## When to Use This Skill

Trigger when user requests:
- "整理 @某人 最近的发言"
- "看看某人在X上说了什么"
- "Scrape X.com posts from @username"
- "Get latest tweets from user"
- "Analyze X user's recent posts"

---

## Available Scripts

### `scraper.py` - Main scraper
```bash
python3 scraper.py <username> [count] [--cookie-file <path>]
```
- Scrapes user timeline with replies
- Default count: 10 posts
- Default cookie: `/tmp/x_cookies_pw.json`

### `convert_cookies.py` - Cookie converter
```bash
python3 convert_cookies.py <input-file> [output-file]
```
- Converts Cookie-Editor JSON to Playwright format
- Required before first scraping

---

## Reference Documents

- **[setup.md](references/setup.md)** - Complete environment setup guide (Python, Playwright, cookies)
- **[troubleshooting.md](references/troubleshooting.md)** - Error diagnosis and solutions
- **[usage.md](references/usage.md)** - Detailed usage examples and advanced options

---

## Limitations

- Requires X.com authentication cookies
- Cookies expire (~7 days), need re-export
- Rate limits may apply
- Cannot access private/protected accounts

Files in this skill

  • SKILL.md3.1 KB
  • description_ar.txt545 B
  • description_cn.txt331 B
  • description_de.txt395 B
  • description_en.txt317 B
  • description_es.txt397 B
  • description_fr.txt435 B
  • description_it.txt395 B
  • description_ja.txt507 B
  • description_ko.txt433 B
  • description_ru.txt666 B
  • description_tw.txt334 B
  • stats.json66 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.