DEV Community

Burak Bayır
Burak Bayır

Posted on

How to Scrape X (Twitter) Easily in 2026

How to Scrape X (Twitter) Easily in 2026

Scraping X (Twitter) is painful. Rate limits, auth tokens, browser automation, CAPTCHAs, and endpoints that break every few weeks.

There is a simpler way. One API call, one header, structured JSON back.

This guide shows how to search tweets, look up users, extract followers, and download media using the Xquik API with plain HTTP requests.

Setup

Get an API key from xquik.com. Every request uses one header.

export XQUIK_API_KEY="xq_your_key_here"
Enter fullscreen mode Exit fullscreen mode

Base URL for all endpoints:

https://xquik.com/api/v1
Enter fullscreen mode Exit fullscreen mode

Search Tweets

Find tweets by keyword, hashtag, or advanced query.

const res = await fetch("https://xquik.com/api/v1/x/tweets/search?query=javascript", {
  headers: { "x-api-key": process.env.XQUIK_API_KEY }
});
const { tweets } = await res.json();

for (const tweet of tweets) {
  console.log(`@${tweet.author.username}: ${tweet.text}`);
  console.log(`  Likes: ${tweet.likes} | Retweets: ${tweet.retweets}`);
}
Enter fullscreen mode Exit fullscreen mode

Python:

import requests

headers = {"x-api-key": "xq_your_key_here"}
res = requests.get("https://xquik.com/api/v1/x/tweets/search",
                    params={"query": "javascript"}, headers=headers)
tweets = res.json()["tweets"]

for tweet in tweets:
    print(f"@{tweet['author']['username']}: {tweet['text']}")
Enter fullscreen mode Exit fullscreen mode

Look Up a User Profile

Get follower count, bio, location, and profile data for any account.

const res = await fetch("https://xquik.com/api/v1/x/users/elonmusk", {
  headers: { "x-api-key": process.env.XQUIK_API_KEY }
});
const user = await res.json();

console.log(user.name);           // Elon Musk
console.log(user.followersCount); // 210000000
console.log(user.description);    // ...
Enter fullscreen mode Exit fullscreen mode

Get a Tweet by ID

const tweetId = "1893556789012345678";
const res = await fetch(`https://xquik.com/api/v1/x/tweets/${tweetId}`, {
  headers: { "x-api-key": process.env.XQUIK_API_KEY }
});
const tweet = await res.json();

console.log(tweet.text);
console.log(`Views: ${tweet.views} | Likes: ${tweet.likes}`);
Enter fullscreen mode Exit fullscreen mode

Extract Followers (Bulk)

Single lookups work for small tasks. For bulk data (thousands of followers, all replies to a tweet, full search results), use extractions.

Extractions run asynchronously. Create the job, poll for completion, then fetch results.

const headers = {
  "x-api-key": process.env.XQUIK_API_KEY,
  "Content-Type": "application/json"
};

// 1. Estimate the cost first
const estimate = await fetch("https://xquik.com/api/v1/extractions/estimate", {
  method: "POST",
  headers,
  body: JSON.stringify({ type: "follower_explorer", username: "elonmusk" })
});
console.log(await estimate.json());
// { estimatedCredits: 420000, estimatedResults: 210000 }

// 2. Create the extraction
const job = await fetch("https://xquik.com/api/v1/extractions", {
  method: "POST",
  headers,
  body: JSON.stringify({
    type: "follower_explorer",
    username: "elonmusk",
    maxResults: 1000
  })
});
const { id } = await job.json();

// 3. Poll until done
let status = "processing";
while (status === "processing") {
  await new Promise(r => setTimeout(r, 5000));
  const check = await fetch(
    `https://xquik.com/api/v1/extractions/${id}`,
    { headers }
  );
  const data = await check.json();
  status = data.status;
}

// 4. Get results
const results = await fetch(
  `https://xquik.com/api/v1/extractions/${id}/results`,
  { headers }
);
const { items } = await results.json();
console.log(`Got ${items.length} followers`);
Enter fullscreen mode Exit fullscreen mode

23 extraction types available: followers, following, replies, retweets, quotes, favoriters, mentions, user likes, user media, community members, list members, tweet search, people search, and more.

Download Media

Download images, videos, and GIFs with permanent hosted URLs.

const res = await fetch("https://xquik.com/api/v1/x/media/download", {
  method: "POST",
  headers: {
    "x-api-key": process.env.XQUIK_API_KEY,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ tweetId: "1893556789012345678" })
});
const { media } = await res.json();

for (const item of media) {
  console.log(`${item.type}: ${item.url}`);
}
Enter fullscreen mode Exit fullscreen mode

Monitor Accounts in Real Time

Track any account for new tweets, replies, retweets, or follower changes. Get notified via webhooks.

const headers = {
  "x-api-key": process.env.XQUIK_API_KEY,
  "Content-Type": "application/json"
};

// Create a monitor
await fetch("https://xquik.com/api/v1/monitors", {
  method: "POST",
  headers,
  body: JSON.stringify({
    username: "elonmusk",
    eventTypes: ["tweet.new", "follower.gained", "follower.lost"]
  })
});

// Register a webhook to receive events
await fetch("https://xquik.com/api/v1/webhooks", {
  method: "POST",
  headers,
  body: JSON.stringify({
    url: "https://your-server.com/webhook",
    eventTypes: ["tweet.new", "follower.gained", "follower.lost"]
  })
});
Enter fullscreen mode Exit fullscreen mode

Events are signed with HMAC-SHA256. Verify them server-side:

import { createHmac } from "crypto";

function verifyWebhook(payload, signature, secret) {
  const expected = createHmac("sha256", secret)
    .update(payload)
    .digest("hex");
  return signature === expected;
}
Enter fullscreen mode Exit fullscreen mode

Trending Topics

Get trending hashtags and topics by region.

const res = await fetch("https://xquik.com/api/v1/trends?country=US", {
  headers: { "x-api-key": process.env.XQUIK_API_KEY }
});
const { trends } = await res.json();
trends.forEach(t => console.log(`${t.name} (${t.tweetCount} tweets)`));
Enter fullscreen mode Exit fullscreen mode

Or use the free Radar endpoint for trending news from 7 sources (Google Trends, Hacker News, Reddit, Polymarket, GitHub, Wikipedia, TrustMRR):

const res = await fetch("https://xquik.com/api/v1/radar", {
  headers: { "x-api-key": process.env.XQUIK_API_KEY }
});
Enter fullscreen mode Exit fullscreen mode

Pricing

Reads start at $0.00015 per call. 33x cheaper than the official X API.

Xquik X API Basic X API Pro
Monthly cost $20 $100 $5,000
Cost per tweet read $0.00015 ~$0.01 ~$0.005
Bulk extraction From $0.00015/result Not available Not available
Monitoring + webhooks Free Not available Not available

Pay-per-use also available (no subscription required). Top up credits via Stripe or pay anonymously with USDC via Machine Payments Protocol.

MCP Server (for AI Agents)

If you use Claude Code, Cursor, Copilot, or other AI coding agents, Xquik has an MCP server with 2 tools covering all 120 endpoints.

Install the skill:

npx skills add Xquik-dev/x-twitter-scraper
Enter fullscreen mode Exit fullscreen mode

Or connect the MCP server directly:

{
  "mcpServers": {
    "xquik": {
      "type": "streamable-http",
      "url": "https://xquik.com/mcp",
      "headers": { "x-api-key": "xq_your_key_here" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Your AI agent can then search tweets, look up users, run extractions, and post tweets through natural language.

Error Handling

All errors return structured JSON. Retry only 429 and 5xx (max 3 retries, exponential backoff).

async function xquikFetch(url, options = {}) {
  const headers = {
    "x-api-key": process.env.XQUIK_API_KEY,
    ...options.headers
  };

  for (let attempt = 0; attempt < 3; attempt++) {
    const res = await fetch(url, { ...options, headers });

    if (res.ok) return res.json();
    if (res.status === 429 || res.status >= 500) {
      await new Promise(r => setTimeout(r, 1000 * 2 ** attempt));
      continue;
    }

    const { error } = await res.json();
    throw new Error(`Xquik API error: ${error} (${res.status})`);
  }

  throw new Error("Max retries exceeded");
}
Enter fullscreen mode Exit fullscreen mode

Quick Reference

What you need How
Search tweets GET /x/tweets/search?query=...
User profile GET /x/users/{username}
Tweet by ID GET /x/tweets/{id}
Bulk followers POST /extractions with follower_explorer
Download media POST /x/media/download
Monitor accounts POST /monitors + POST /webhooks
Trending topics GET /trends or GET /radar (free)
Write actions POST /x/tweets, POST /x/tweets/{id}/like, etc.

Full API reference at docs.xquik.com. Open source skill at github.com/Xquik-dev/x-twitter-scraper.

Top comments (0)