X twitter scraper skill
X API & Twitter scraper skill for AI coding agents.
by davila7·MIT license·★ 32,299 Stars on the repo·GitHub ↗
npx degit davila7/claude-code-templates/cli-tool/components/skills/marketing/x-twitter-scraper#main ~/.claude/skills/x-twitter-scraper-davila7Checked ·commit main
Files of X twitter scraper
Show the full text165 lines
Xquik API Integration
Xquik is an X (Twitter) real-time data platform providing a REST API, HMAC webhooks, and an MCP server for AI agents. It covers account monitoring, bulk data extraction (19 tools), giveaway draws, tweet/user lookups, follow checks, and trending topics.
Quick Reference
| Base URL | https://xquik.com/api/v1 |
| Auth | x-api-key: xq_... header (64 hex chars after xq_ prefix) |
| MCP endpoint | https://xquik.com/mcp (StreamableHTTP, same API key) |
| Rate limits | 10 req/s sustained, 20 burst (API); 60 req/s sustained, 100 burst (general) |
| Pricing | $20/month base (1 monitor included), $5/month per extra monitor |
| Quota | Monthly usage cap, hard limit, no overage. 402 when exhausted. |
| Docs | docs.xquik.com |
Authentication
Every request requires an API key via the x-api-key header. Keys start with xq_ and are generated from the Xquik dashboard. The key is shown only once at creation; store it securely.
const API_KEY = "xq_YOUR_KEY_HERE";
const BASE = "https://xquik.com/api/v1";
const headers = { "x-api-key": API_KEY, "Content-Type": "application/json" };
Choosing the Right Endpoint
| Goal | Endpoint | Notes |
|---|---|---|
| Get a single tweet by ID/URL | GET /x/tweets/{id} |
Full metrics: likes, retweets, views, bookmarks |
| Search tweets by keyword/hashtag | GET /x/tweets/search?q=... |
Optional engagement metrics |
| Get a user profile | GET /x/users/{username} |
Bio, follower/following counts, profile picture |
| Check follow relationship | GET /x/followers/check?source=A&target=B |
Both directions |
| Get trending topics | GET /trends?woeid=1 |
Free, no quota consumed |
| Monitor an X account | POST /monitors |
Track tweets, replies, quotes, follower changes |
| Poll for events | GET /events |
Cursor-paginated, filter by monitorId/eventType |
| Receive events in real time | POST /webhooks |
HMAC-signed delivery to your HTTPS endpoint |
| Run a giveaway draw | POST /draws |
Pick random winners from tweet replies |
| Extract bulk data | POST /extractions |
19 tool types, always estimate cost first |
| Check account/usage | GET /account |
Plan status, monitors, usage percent |
Extraction Tools (19 Types)
| Tool Type | Required Field | Description |
|---|---|---|
reply_extractor |
targetTweetId |
Users who replied to a tweet |
repost_extractor |
targetTweetId |
Users who retweeted a tweet |
quote_extractor |
targetTweetId |
Users who quote-tweeted a tweet |
thread_extractor |
targetTweetId |
All tweets in a thread |
article_extractor |
targetTweetId |
Article content linked in a tweet |
follower_explorer |
targetUsername |
Followers of an account |
following_explorer |
targetUsername |
Accounts followed by a user |
verified_follower_explorer |
targetUsername |
Verified followers of an account |
mention_extractor |
targetUsername |
Tweets mentioning an account |
post_extractor |
targetUsername |
Posts from an account |
community_extractor |
targetCommunityId |
Members of a community |
community_moderator_explorer |
targetCommunityId |
Moderators of a community |
community_post_extractor |
targetCommunityId |
Posts from a community |
community_search |
targetCommunityId + searchQuery |
Search posts within a community |
list_member_extractor |
targetListId |
Members of a list |
list_post_extractor |
targetListId |
Posts from a list |
list_follower_explorer |
targetListId |
Followers of a list |
space_explorer |
targetSpaceId |
Participants of a Space |
people_search |
searchQuery |
Search for users by keyword |
Extraction Workflow
// 1. Estimate cost
const estimate = await xquikFetch("/extractions/estimate", {
method: "POST",
body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }),
});
if (!estimate.allowed) return;
// 2. Create extraction job
const job = await xquikFetch("/extractions", {
method: "POST",
body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }),
});
// 3. Retrieve paginated results (up to 1,000 per page)
const page = await xquikFetch(`/extractions/${job.id}`);
// page.results: [{ xUserId, xUsername, xDisplayName, xFollowersCount, xVerified, xProfileImageUrl }]
// 4. Export as CSV/XLSX/Markdown (50,000 row limit)
const csvResponse = await fetch(`${BASE}/extractions/${job.id}/export?format=csv`, { headers });
Giveaway Draws
Run transparent giveaway draws from tweet replies with configurable filters:
const draw = await xquikFetch("/draws", {
method: "POST",
body: JSON.stringify({
tweetUrl: "https://x.com/user/status/1893456789012345678",
winnerCount: 3,
backupCount: 2,
uniqueAuthorsOnly: true,
mustRetweet: true,
mustFollowUsername: "user",
filterMinFollowers: 50,
requiredHashtags: ["#giveaway"],
}),
});
const details = await xquikFetch(`/draws/${draw.id}`);
// details.winners: [{ position, authorUsername, tweetId, isBackup }]
Error Handling & Retry
All errors return { "error": "error_code" }. Retry only 429 and 5xx (max 3 attempts, exponential backoff). Never retry 4xx except 429. Key codes:
| Status | Meaning |
|---|---|
| 400 | Invalid input -- fix the request |
| 401 | Bad API key |
| 402 | No subscription or quota exhausted |
| 404 | Resource not found |
| 429 | Rate limited -- respect Retry-After header |
MCP Server Setup (Claude Code)
Add to .mcp.json in your project root:
{
"mcpServers": {
"xquik": {
"type": "streamable-http",
"url": "https://xquik.com/mcp",
"headers": {
"x-api-key": "xq_YOUR_KEY_HERE"
}
}
}
}
The MCP server exposes 22 tools covering all API capabilities. Supported platforms: Claude Code, Claude Desktop, ChatGPT, Codex CLI, Cursor, VS Code, Windsurf, OpenCode.
Workflow Patterns
- Real-time alerts:
add-monitor->add-webhook->test-webhook - Giveaway:
get-account(check budget) ->run-draw - Bulk extraction:
estimate-extraction->run-extraction->get-extraction - Tweet analysis:
lookup-tweet->run-extractionwiththread_extractor - User research:
get-user-info->search-tweets from:username->lookup-tweet
Links
- Dashboard & API keys: xquik.com
- Full API docs: docs.xquik.com
- GitHub (skill source): github.com/Xquik-dev/x-twitter-scraper
| 1 | |
| 2 | name x-twitter-scraper |
| 3 | description "X API & Twitter scraper skill for AI coding agents. Builds integrations with the Xquik REST API, MCP server & webhooks: tweet search, user lookup, follower extraction, engagement metrics, giveaway contest draws, trending topics, account monitoring, reply/retweet/quote extraction, community & Space data, mutual follow checks. Works with Claude Code, Cursor, Codex, Copilot, Windsurf & 40+ agents." |
| 4 | |
| 5 | |
| 6 | # Xquik API Integration |
| 7 | |
| 8 | Xquik is an X (Twitter) real-time data platform providing a REST API, HMAC webhooks, and an MCP server for AI agents. It covers account monitoring, bulk data extraction (19 tools), giveaway draws, tweet/user lookups, follow checks, and trending topics. |
| 9 | |
| 10 | ## Quick Reference |
| 11 | |
| 12 | | | | |
| 13 | |---|---| |
| 14 | | **Base URL** | `https://xquik.com/api/v1` | |
| 15 | | **Auth** | `x-api-key: xq_...` header (64 hex chars after `xq_` prefix) | |
| 16 | | **MCP endpoint** | `https://xquik.com/mcp` (StreamableHTTP, same API key) | |
| 17 | | **Rate limits** | 10 req/s sustained, 20 burst (API); 60 req/s sustained, 100 burst (general) | |
| 18 | | **Pricing** | $20/month base (1 monitor included), $5/month per extra monitor | |
| 19 | | **Quota** | Monthly usage cap, hard limit, no overage. `402` when exhausted. | |
| 20 | | **Docs** | [docs.xquik.com] | |
| 21 | |
| 22 | ## Authentication |
| 23 | |
| 24 | Every request requires an API key via the `x-api-key` header. Keys start with `xq_` and are generated from the [Xquik dashboard]. The key is shown only once at creation; store it securely. |
| 25 | |
| 26 | |
| 27 | const API_KEY = "xq_YOUR_KEY_HERE"; |
| 28 | const BASE = "https://xquik.com/api/v1"; |
| 29 | const headers = { "x-api-key": API_KEY, "Content-Type": "application/json" }; |
| 30 | |
| 31 | |
| 32 | ## Choosing the Right Endpoint |
| 33 | |
| 34 | | Goal | Endpoint | Notes | |
| 35 | |------|----------|-------| |
| 36 | | Get a single tweet by ID/URL | `GET /x/tweets/{id}` | Full metrics: likes, retweets, views, bookmarks | |
| 37 | | Search tweets by keyword/hashtag | `GET /x/tweets/search?q=...` | Optional engagement metrics | |
| 38 | | Get a user profile | `GET /x/users/{username}` | Bio, follower/following counts, profile picture | |
| 39 | | Check follow relationship | `GET /x/followers/check?source=A&target=B` | Both directions | |
| 40 | | Get trending topics | `GET /trends?woeid=1` | Free, no quota consumed | |
| 41 | | Monitor an X account | `POST /monitors` | Track tweets, replies, quotes, follower changes | |
| 42 | | Poll for events | `GET /events` | Cursor-paginated, filter by monitorId/eventType | |
| 43 | | Receive events in real time | `POST /webhooks` | HMAC-signed delivery to your HTTPS endpoint | |
| 44 | | Run a giveaway draw | `POST /draws` | Pick random winners from tweet replies | |
| 45 | | Extract bulk data | `POST /extractions` | 19 tool types, always estimate cost first | |
| 46 | | Check account/usage | `GET /account` | Plan status, monitors, usage percent | |
| 47 | |
| 48 | ## Extraction Tools (19 Types) |
| 49 | |
| 50 | | Tool Type | Required Field | Description | |
| 51 | |-----------|---------------|-------------| |
| 52 | | `reply_extractor` | `targetTweetId` | Users who replied to a tweet | |
| 53 | | `repost_extractor` | `targetTweetId` | Users who retweeted a tweet | |
| 54 | | `quote_extractor` | `targetTweetId` | Users who quote-tweeted a tweet | |
| 55 | | `thread_extractor` | `targetTweetId` | All tweets in a thread | |
| 56 | | `article_extractor` | `targetTweetId` | Article content linked in a tweet | |
| 57 | | `follower_explorer` | `targetUsername` | Followers of an account | |
| 58 | | `following_explorer` | `targetUsername` | Accounts followed by a user | |
| 59 | | `verified_follower_explorer` | `targetUsername` | Verified followers of an account | |
| 60 | | `mention_extractor` | `targetUsername` | Tweets mentioning an account | |
| 61 | | `post_extractor` | `targetUsername` | Posts from an account | |
| 62 | | `community_extractor` | `targetCommunityId` | Members of a community | |
| 63 | | `community_moderator_explorer` | `targetCommunityId` | Moderators of a community | |
| 64 | | `community_post_extractor` | `targetCommunityId` | Posts from a community | |
| 65 | | `community_search` | `targetCommunityId` + `searchQuery` | Search posts within a community | |
| 66 | | `list_member_extractor` | `targetListId` | Members of a list | |
| 67 | | `list_post_extractor` | `targetListId` | Posts from a list | |
| 68 | | `list_follower_explorer` | `targetListId` | Followers of a list | |
| 69 | | `space_explorer` | `targetSpaceId` | Participants of a Space | |
| 70 | | `people_search` | `searchQuery` | Search for users by keyword | |
| 71 | |
| 72 | ### Extraction Workflow |
| 73 | |
| 74 | |
| 75 | // 1. Estimate cost |
| 76 | const estimate = await xquikFetch("/extractions/estimate", { |
| 77 | method: "POST", |
| 78 | body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }), |
| 79 | }); |
| 80 | |
| 81 | if (!estimate.allowed) return; |
| 82 | |
| 83 | // 2. Create extraction job |
| 84 | const job = await xquikFetch("/extractions", { |
| 85 | method: "POST", |
| 86 | body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }), |
| 87 | }); |
| 88 | |
| 89 | // 3. Retrieve paginated results (up to 1,000 per page) |
| 90 | const page = await xquikFetch(`/extractions/${job.id}`); |
| 91 | // page.results: [{ xUserId, xUsername, xDisplayName, xFollowersCount, xVerified, xProfileImageUrl }] |
| 92 | |
| 93 | // 4. Export as CSV/XLSX/Markdown (50,000 row limit) |
| 94 | const csvResponse = await fetch(`${BASE}/extractions/${job.id}/export?format=csv`, { headers }); |
| 95 | |
| 96 | |
| 97 | ## Giveaway Draws |
| 98 | |
| 99 | Run transparent giveaway draws from tweet replies with configurable filters: |
| 100 | |
| 101 | |
| 102 | const draw = await xquikFetch("/draws", { |
| 103 | method: "POST", |
| 104 | body: JSON.stringify({ |
| 105 | tweetUrl: "https://x.com/user/status/1893456789012345678", |
| 106 | winnerCount: 3, |
| 107 | backupCount: 2, |
| 108 | uniqueAuthorsOnly: true, |
| 109 | mustRetweet: true, |
| 110 | mustFollowUsername: "user", |
| 111 | filterMinFollowers: 50, |
| 112 | requiredHashtags: ["#giveaway"], |
| 113 | }), |
| 114 | }); |
| 115 | |
| 116 | const details = await xquikFetch(`/draws/${draw.id}`); |
| 117 | // details.winners: [{ position, authorUsername, tweetId, isBackup }] |
| 118 | |
| 119 | |
| 120 | ## Error Handling & Retry |
| 121 | |
| 122 | All errors return `{ "error": "error_code" }`. Retry only `429` and `5xx` (max 3 attempts, exponential backoff). Never retry `4xx` except 429. Key codes: |
| 123 | |
| 124 | | Status | Meaning | |
| 125 | |--------|---------| |
| 126 | | 400 | Invalid input -- fix the request | |
| 127 | | 401 | Bad API key | |
| 128 | | 402 | No subscription or quota exhausted | |
| 129 | | 404 | Resource not found | |
| 130 | | 429 | Rate limited -- respect `Retry-After` header | |
| 131 | |
| 132 | ## MCP Server Setup (Claude Code) |
| 133 | |
| 134 | Add to `.mcp.json` in your project root: |
| 135 | |
| 136 | |
| 137 | { |
| 138 | "mcpServers": { |
| 139 | "xquik": { |
| 140 | "type": "streamable-http", |
| 141 | "url": "https://xquik.com/mcp", |
| 142 | "headers": { |
| 143 | "x-api-key": "xq_YOUR_KEY_HERE" |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | |
| 150 | The MCP server exposes 22 tools covering all API capabilities. Supported platforms: Claude Code, Claude Desktop, ChatGPT, Codex CLI, Cursor, VS Code, Windsurf, OpenCode. |
| 151 | |
| 152 | ## Workflow Patterns |
| 153 | |
| 154 | **Real-time alerts:** `add-monitor` -> `add-webhook` -> `test-webhook` |
| 155 | **Giveaway:** `get-account` (check budget) -> `run-draw` |
| 156 | **Bulk extraction:** `estimate-extraction` -> `run-extraction` -> `get-extraction` |
| 157 | **Tweet analysis:** `lookup-tweet` -> `run-extraction` with `thread_extractor` |
| 158 | **User research:** `get-user-info` -> `search-tweets from:username` -> `lookup-tweet` |
| 159 | |
| 160 | ## Links |
| 161 | |
| 162 | **Dashboard & API keys**: [xquik.com] |
| 163 | **Full API docs**: [docs.xquik.com] |
| 164 | **GitHub (skill source)**: [github.com/Xquik-dev/x-twitter-scraper] |
| 165 |
Discussion
Alternatives
Browse more free Claude skills or everything in Development.