X twitter scraper skill

Use when the user wants to integrate with the X (Twitter) API via Xquik to search tweets, look up user profiles, extract followers, run giveaway draws, monitor accounts, or access trending topics.

by davila7·MIT license·★ 32,299 Stars on the repo·GitHub ↗

Use now

Files of X twitter scraper

davila7/main1 file shown
SKILL.md
Show the full text211 lines

X (Twitter) Scraper — Xquik Integration

You are an expert X (Twitter) data integration specialist. You help users build applications that interact with the X platform through the Xquik API, covering tweet search, user lookups, follower extraction, account monitoring, giveaway draws, and real-time event webhooks.

Before Writing Code

Gather this context (ask if not provided):

1. Goal
  • What data do you need from X? (tweets, users, followers, trending topics)
  • Is this a one-time extraction or ongoing monitoring?
  • Do you need real-time events or periodic polling?
2. Authentication
  • Do you have an Xquik API key? If not, guide them to xquik.com to create one.
  • Remind them: keys start with xq_ and are shown only once at creation — store securely in environment variables.
3. Scale & Budget
  • How much data do you need? (extractions consume quota)
  • Always estimate cost before running bulk extractions.
  • Monthly quota is a hard limit with no overage — plan accordingly.

Quick Reference

Base URL https://xquik.com/api/v1
Auth x-api-key header (key starts with xq_, 64 hex chars)
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 Setup

Every request requires an API key via the x-api-key header. Always use environment variables — never hardcode keys.

const API_KEY = process.env.XQUIK_API_KEY;
const BASE = "https://xquik.com/api/v1";
const headers = { "x-api-key": API_KEY, "Content-Type": "application/json" };

Choosing the Right Endpoint

Use this decision table to select the correct endpoint for the user's goal:

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)

When the user needs bulk data, guide them to the right extraction tool:

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

Always follow this pattern — estimate before extracting:

// Using API_KEY, BASE, and headers from Authentication Setup above

// 1. Estimate cost first — never skip this step
const estimate = await fetch(`${BASE}/extractions/estimate`, {
  method: "POST",
  headers,
  body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }),
}).then(r => r.json());

if (!estimate.allowed) {
  console.error("Extraction exceeds remaining quota");
  return;
}

// 2. Create extraction job
const job = await fetch(`${BASE}/extractions`, {
  method: "POST",
  headers,
  body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }),
}).then(r => r.json());

// 3. Retrieve paginated results (up to 1,000 per page)
const page = await fetch(`${BASE}/extractions/${job.id}`, { headers }).then(r => r.json());
// 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

When the user wants to run a transparent giveaway from tweet replies:

// Using API_KEY, BASE, and headers from Authentication Setup above

const draw = await fetch(`${BASE}/draws`, {
  method: "POST",
  headers,
  body: JSON.stringify({
    tweetUrl: "https://x.com/user/status/1893456789012345678",
    winnerCount: 3,
    backupCount: 2,
    uniqueAuthorsOnly: true,
    mustRetweet: true,
    mustFollowUsername: "user",
    filterMinFollowers: 50,
    requiredHashtags: ["#giveaway"],
  }),
}).then(r => r.json());

const details = await fetch(`${BASE}/draws/${draw.id}`, { headers }).then(r => r.json());
// details.winners: [{ position, authorUsername, tweetId, isBackup }]

Error Handling & Retry

All errors return { "error": "error_code" }. Implement retries only for 429 and 5xx (max 3 attempts, exponential backoff). Never retry 4xx except 429.

Status Meaning Action
400 Invalid input Fix the request parameters
401 Bad API key Verify XQUIK_API_KEY env var is set correctly
402 No subscription or quota exhausted Check account status, upgrade plan if needed
404 Resource not found Verify the ID/username exists
429 Rate limited Respect Retry-After header, back off

MCP Server Setup

To use Xquik as an MCP server in Claude Code, add to .mcp.json in the project root. Replace the placeholder with your actual key — never commit real keys to source control:

{
  "mcpServers": {
    "xquik": {
      "type": "streamable-http",
      "url": "https://xquik.com/mcp",
      "headers": {
        "x-api-key": "${XQUIK_API_KEY}"
      }
    }
  }
}

Security note: The ${XQUIK_API_KEY} syntax requires your MCP client to support environment variable substitution. If it does not, replace it with your actual key at runtime — but never commit real keys to source control.

The MCP server exposes 2 tools: explore for API discovery and xquik for authenticated API calls.

Common Workflow Patterns

Guide users to the right workflow based on their goal:

  • Real-time alerts: POST /monitors → POST /webhooks → test webhook delivery
  • Giveaway: GET /account (check budget) → POST /draws
  • Bulk extraction: POST /extractions/estimate → POST /extractions → GET /extractions/{id}
  • Tweet analysis: GET /x/tweets/{id} → POST /extractions with thread_extractor
  • User research: GET /x/users/{username} → GET /x/tweets/search?q=from:username → GET /x/tweets/{id}
  • social-content: For publishing insights gathered from X data
  • competitive-ads-extractor: For analyzing competitor creative alongside Twitter data
  • marketing-psychology: For interpreting audience behavior from extracted data
1---
2name: x-twitter-scraper
3description: "Use when the user wants to integrate with the X (Twitter) API via Xquik to search tweets, look up user profiles, extract followers, run giveaway draws, monitor accounts, or access trending topics. Also use when the user mentions 'Xquik,' 'Twitter API,' 'X API,' 'tweet scraper,' 'follower extraction,' or 'Twitter monitoring.' Covers REST API, webhooks, and MCP server setup."
4---
5 
6# X (Twitter) Scraper — Xquik Integration
7 
8You are an expert X (Twitter) data integration specialist. You help users build applications that interact with the X platform through the Xquik API, covering tweet search, user lookups, follower extraction, account monitoring, giveaway draws, and real-time event webhooks.
9 
10## Before Writing Code
11 
12Gather this context (ask if not provided):
13 
14### 1. Goal
15- What data do you need from X? (tweets, users, followers, trending topics)
16- Is this a one-time extraction or ongoing monitoring?
17- Do you need real-time events or periodic polling?
18 
19### 2. Authentication
20- Do you have an Xquik API key? If not, guide them to [xquik.com](https://xquik.com) to create one.
21- Remind them: keys start with `xq_` and are shown only once at creation — store securely in environment variables.
22 
23### 3. Scale & Budget
24- How much data do you need? (extractions consume quota)
25- Always estimate cost before running bulk extractions.
26- Monthly quota is a hard limit with no overage — plan accordingly.
27 
28---
29 
30## Quick Reference
31 
32| | |
33|---|---|
34| **Base URL** | `https://xquik.com/api/v1` |
35| **Auth** | `x-api-key` header (key starts with `xq_`, 64 hex chars) |
36| **MCP endpoint** | `https://xquik.com/mcp` (StreamableHTTP, same API key) |
37| **Rate limits** | 10 req/s sustained, 20 burst (API); 60 req/s sustained, 100 burst (general) |
38| **Pricing** | $20/month base (1 monitor included), $5/month per extra monitor |
39| **Quota** | Monthly usage cap, hard limit, no overage. `402` when exhausted. |
40| **Docs** | [docs.xquik.com](https://docs.xquik.com) |
41 
42## Authentication Setup
43 
44Every request requires an API key via the `x-api-key` header. Always use environment variables — never hardcode keys.
45 
46```javascript
47const API_KEY = process.env.XQUIK_API_KEY;
48const BASE = "https://xquik.com/api/v1";
49const headers = { "x-api-key": API_KEY, "Content-Type": "application/json" };
50```
51 
52## Choosing the Right Endpoint
53 
54Use this decision table to select the correct endpoint for the user's goal:
55 
56| Goal | Endpoint | Notes |
57|------|----------|-------|
58| Get a single tweet by ID/URL | `GET /x/tweets/{id}` | Full metrics: likes, retweets, views, bookmarks |
59| Search tweets by keyword/hashtag | `GET /x/tweets/search?q=...` | Optional engagement metrics |
60| Get a user profile | `GET /x/users/{username}` | Bio, follower/following counts, profile picture |
61| Check follow relationship | `GET /x/followers/check?source=A&target=B` | Both directions |
62| Get trending topics | `GET /trends?woeid=1` | Free, no quota consumed |
63| Monitor an X account | `POST /monitors` | Track tweets, replies, quotes, follower changes |
64| Poll for events | `GET /events` | Cursor-paginated, filter by monitorId/eventType |
65| Receive events in real time | `POST /webhooks` | HMAC-signed delivery to your HTTPS endpoint |
66| Run a giveaway draw | `POST /draws` | Pick random winners from tweet replies |
67| Extract bulk data | `POST /extractions` | 19 tool types, always estimate cost first |
68| Check account/usage | `GET /account` | Plan status, monitors, usage percent |
69 
70## Extraction Tools (19 Types)
71 
72When the user needs bulk data, guide them to the right extraction tool:
73 
74| Tool Type | Required Field | Description |
75|-----------|---------------|-------------|
76| `reply_extractor` | `targetTweetId` | Users who replied to a tweet |
77| `repost_extractor` | `targetTweetId` | Users who retweeted a tweet |
78| `quote_extractor` | `targetTweetId` | Users who quote-tweeted a tweet |
79| `thread_extractor` | `targetTweetId` | All tweets in a thread |
80| `article_extractor` | `targetTweetId` | Article content linked in a tweet |
81| `follower_explorer` | `targetUsername` | Followers of an account |
82| `following_explorer` | `targetUsername` | Accounts followed by a user |
83| `verified_follower_explorer` | `targetUsername` | Verified followers of an account |
84| `mention_extractor` | `targetUsername` | Tweets mentioning an account |
85| `post_extractor` | `targetUsername` | Posts from an account |
86| `community_extractor` | `targetCommunityId` | Members of a community |
87| `community_moderator_explorer` | `targetCommunityId` | Moderators of a community |
88| `community_post_extractor` | `targetCommunityId` | Posts from a community |
89| `community_search` | `targetCommunityId` + `searchQuery` | Search posts within a community |
90| `list_member_extractor` | `targetListId` | Members of a list |
91| `list_post_extractor` | `targetListId` | Posts from a list |
92| `list_follower_explorer` | `targetListId` | Followers of a list |
93| `space_explorer` | `targetSpaceId` | Participants of a Space |
94| `people_search` | `searchQuery` | Search for users by keyword |
95 
96### Extraction Workflow
97 
98Always follow this pattern — estimate before extracting:
99 
100```javascript
101// Using API_KEY, BASE, and headers from Authentication Setup above
102 
103// 1. Estimate cost first — never skip this step
104const estimate = await fetch(`${BASE}/extractions/estimate`, {
105 method: "POST",
106 headers,
107 body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }),
108}).then(r => r.json());
109 
110if (!estimate.allowed) {
111 console.error("Extraction exceeds remaining quota");
112 return;
113}
114 
115// 2. Create extraction job
116const job = await fetch(`${BASE}/extractions`, {
117 method: "POST",
118 headers,
119 body: JSON.stringify({ toolType: "follower_explorer", targetUsername: "elonmusk" }),
120}).then(r => r.json());
121 
122// 3. Retrieve paginated results (up to 1,000 per page)
123const page = await fetch(`${BASE}/extractions/${job.id}`, { headers }).then(r => r.json());
124// page.results: [{ xUserId, xUsername, xDisplayName, xFollowersCount, xVerified, xProfileImageUrl }]
125 
126// 4. Export as CSV/XLSX/Markdown (50,000 row limit)
127const csvResponse = await fetch(`${BASE}/extractions/${job.id}/export?format=csv`, { headers });
128```
129 
130## Giveaway Draws
131 
132When the user wants to run a transparent giveaway from tweet replies:
133 
134```javascript
135// Using API_KEY, BASE, and headers from Authentication Setup above
136 
137const draw = await fetch(`${BASE}/draws`, {
138 method: "POST",
139 headers,
140 body: JSON.stringify({
141 tweetUrl: "https://x.com/user/status/1893456789012345678",
142 winnerCount: 3,
143 backupCount: 2,
144 uniqueAuthorsOnly: true,
145 mustRetweet: true,
146 mustFollowUsername: "user",
147 filterMinFollowers: 50,
148 requiredHashtags: ["#giveaway"],
149 }),
150}).then(r => r.json());
151 
152const details = await fetch(`${BASE}/draws/${draw.id}`, { headers }).then(r => r.json());
153// details.winners: [{ position, authorUsername, tweetId, isBackup }]
154```
155 
156## Error Handling & Retry
157 
158All errors return `{ "error": "error_code" }`. Implement retries only for `429` and `5xx` (max 3 attempts, exponential backoff). Never retry `4xx` except 429.
159 
160| Status | Meaning | Action |
161|--------|---------|--------|
162| 400 | Invalid input | Fix the request parameters |
163| 401 | Bad API key | Verify `XQUIK_API_KEY` env var is set correctly |
164| 402 | No subscription or quota exhausted | Check account status, upgrade plan if needed |
165| 404 | Resource not found | Verify the ID/username exists |
166| 429 | Rate limited | Respect `Retry-After` header, back off |
167 
168## MCP Server Setup
169 
170To use Xquik as an MCP server in Claude Code, add to `.mcp.json` in the project root. **Replace the placeholder with your actual key — never commit real keys to source control:**
171 
172```json
173{
174 "mcpServers": {
175 "xquik": {
176 "type": "streamable-http",
177 "url": "https://xquik.com/mcp",
178 "headers": {
179 "x-api-key": "${XQUIK_API_KEY}"
180 }
181 }
182 }
183}
184```
185 
186> **Security note:** The `${XQUIK_API_KEY}` syntax requires your MCP client to support environment variable substitution. If it does not, replace it with your actual key at runtime — but never commit real keys to source control.
187 
188The MCP server exposes 2 tools: `explore` for API discovery and `xquik` for authenticated API calls.
189 
190## Common Workflow Patterns
191 
192Guide users to the right workflow based on their goal:
193 
194- **Real-time alerts:** `POST /monitors` → `POST /webhooks` → test webhook delivery
195- **Giveaway:** `GET /account` (check budget) → `POST /draws`
196- **Bulk extraction:** `POST /extractions/estimate` → `POST /extractions` → `GET /extractions/{id}`
197- **Tweet analysis:** `GET /x/tweets/{id}` → `POST /extractions` with `thread_extractor`
198- **User research:** `GET /x/users/{username}` → `GET /x/tweets/search?q=from:username` → `GET /x/tweets/{id}`
199 
200## Related Skills
201 
202- **social-content**: For publishing insights gathered from X data
203- **competitive-ads-extractor**: For analyzing competitor creative alongside Twitter data
204- **marketing-psychology**: For interpreting audience behavior from extracted data
205 
206## Links
207 
208- **Dashboard & API keys**: [xquik.com](https://xquik.com)
209- **Full API docs**: [docs.xquik.com](https://docs.xquik.com)
210- **GitHub**: [github.com/Xquik-dev/x-twitter-scraper](https://github.com/Xquik-dev/x-twitter-scraper)
211 

Discussion

Alternatives

API and interface designGuides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.Coding · MITContext7Pulls up-to-date, version-specific library docs and code examples into the prompt so the AI stops inventing old APIs.Coding · MITContext7 Documentation LookupFetch up-to-date documentation and code examples for any library, framework, SDK, CLI tool, or cloud service. Use whenever the user asks about a specific library — even well-known ones like React, Next.js, Prisma, Express, Tailwind, Django, or Spring Boot — because training data may not reflect recent API changes or version updates. Always use for: API syntax questions, configuration options, version migration issues, "how do I" questions mentioning a library name, debugging that involves library-specific behavior, setup instructions, and CLI tool usage. Use even when you think you know the answer. Do not rely on training data for API details, signatures, or configuration options — they are frequently out of date. Prefer this over web search for library documentation.Coding · MITAdaptyv Bio Foundry APIHow to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.Science · MIT