👥 Scrape Followers

Scrapers

👥 Scrape Followers

Export a complete followers list to JSON/CSV. Includes name, bio, follower count, and verification status.


📋 What It Does

This script provides the following capabilities:

  1. Automated operation — Runs directly in your browser console on x.com
  2. Configurable settings — Customize behavior via the CONFIG object
  3. Real-time progress — Shows live status updates with emoji-coded logs
  4. Rate limiting — Built-in delays to respect X/Twitter's rate limits
  5. Data export — Results exported as JSON/CSV for further analysis

Use cases:

  • Export a complete followers list to JSON/CSV. Includes name, bio, follower count, and verification status.
  • Automate repetitive scrapers tasks on X/Twitter
  • Save time with one-click automation — no API keys needed
  • Works in any modern browser (Chrome, Firefox, Edge, Safari)

⚠️ Important Notes

Use responsibly! All automation should respect X/Twitter's Terms of Service. Use conservative settings and include breaks between sessions.

  • This script runs in the browser DevTools console — not Node.js
  • You must be logged in to x.com for the script to work
  • Start with low limits and increase gradually
  • Include random delays between actions to appear human
  • Don't run multiple automation scripts simultaneously

🌐 Browser Console Usage

Steps:

  1. Go to x.com/USERNAME/followers
  2. Open browser console (F12 → Console tab)
  3. Copy and paste the script from scripts/scrapeFollowers.js
  4. Press Enter to run
/**
 * Followers Scraper
 * Export your followers list to JSON/CSV
 * 
 * HOW TO USE:
 * 1. Go to x.com/USERNAME/followers
 * 2. Open Developer Console (Ctrl+Shift+J or Cmd+Option+J)
 * 3. Paste this script and press Enter
 * 
 * by nichxbt - https://github.com/nirholas/XActions
 */

(() => {
  const CONFIG = {
    MAX_FOLLOWERS: 5000,
    SCROLL_DELAY: 1500,
    FORMAT: 'both', // 'json', 'csv', 'both'
  };

  const sleep = (ms) => new Promise(r => setTimeout(r, ms));

  const download = (content, filename, type) => {
    const blob = new Blob([content], { type });
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = filename;
    a.click();
    URL.revokeObjectURL(url);
  };

  const extractBio = (cell) => {
    const testId = cell.querySelector('[data-testid="UserDescription"]');
    if (testId?.textContent?.trim()) return testId.textContent.trim();
    const autoDir = cell.querySelector('[dir="auto"]:not([data-testid])');
    const text = autoDir?.textContent?.trim();
    if (text && text.length >= 10 && !text.startsWith('@')) return text;
    return '';
  };

  const extractUser = (cell) => {
    try {
      const nameEl = cell.querySelector('[dir="ltr"] > span');
      const handleEl = cell.querySelector('a[href^="/"]');
      const followsYou = !!cell.querySelector('[data-testid="userFollowIndicator"]');
      
      const href = handleEl?.getAttribute('href') || '';
      const handle = href.replace('/', '').split('/')[0];
      
      return {
        handle,
        displayName: nameEl?.textContent || '',
        bio: extractBio(cell),
        followsYou,
        profileUrl: `https://x.com/${handle}`,
      };
    } catch (e) {
      return null;
    }
  };

  const run = async () => {
    if (!window.location.pathname.includes('/followers')) {
      console.error('❌ Please go to x.com/USERNAME/followers first!');
      return;
    }

    const username = window.location.pathname.split('/')[1];
    console.log(`👥 Scraping followers of @${username}...`);

    const followers = new Map();
    let scrolls = 0;
    let noNewCount = 0;

    while (followers.size < CONFIG.MAX_FOLLOWERS && noNewCount < 5) {
      const cells = document.querySelectorAll('[data-testid="UserCell"]');
      const beforeCount = followers.size;

      cells.forEach(cell => {
        const user = extractUser(cell);
        if (user && user.handle && !followers.has(user.handle)) {
          followers.set(user.handle, user);
        }
      });

      const added = followers.size - beforeCount;
      if (added > 0) {
        console.log(`👥 Collected ${followers.size} followers...`);
        noNewCount = 0;
      } else {
        noNewCount++;
      }

      window.scrollBy(0, 800);
      await sleep(CONFIG.SCROLL_DELAY);
      scrolls++;

      if (scrolls > 200) break;
    }

    const followerList = Array.from(followers.values());

    console.log('\n' + '='.repeat(60));
    console.log(`👥 SCRAPED ${followerList.length} FOLLOWERS`);
    console.log('='.repeat(60) + '\n');

    followerList.slice(0, 5).forEach((f, i) => {
      console.log(`${i + 1}. @${f.handle} - ${f.displayName}`);
    });
    if (followerList.length > 5) {
      console.log(`   ... and ${followerList.length - 5} more\n`);
    }

    if (CONFIG.FORMAT === 'json' || CONFIG.FORMAT === 'both') {
      download(JSON.stringify(followerList, null, 2), `${username}_followers_${Date.now()}.json`, 'application/json');
      console.log('💾 Downloaded followers.json');
    }

    if (CONFIG.FORMAT === 'csv' || CONFIG.FORMAT === 'both') {
      const csv = [
        'Handle,DisplayName,Bio,FollowsYou,ProfileURL',
        ...followerList.map(f => 
          `"@${f.handle}","${f.displayName.replace(/"/g, '""')}","${f.bio.replace(/"/g, '""').replace(/\n/g, ' ')}",${f.followsYou},"${f.profileUrl}"`
        )
      ].join('\n');
      download(csv, `${username}_followers_${Date.now()}.csv`, 'text/csv');
      console.log('💾 Downloaded followers.csv');
    }

    window.scrapedFollowers = followerList;
    console.log('\n✅ Done! Access data: window.scrapedFollowers');
  };

  run();
})();

⚙️ Configuration

Setting Default Description
MAX_FOLLOWERS 5000 M a x f o l l o w e r s
SCROLL_DELAY 1500 S c r o l l d e l a y
FORMAT 'both', 'json', 'csv', 'both'

📖 Step-by-Step Tutorial

Step 1: Navigate to the right page

Open your browser and go to x.com/USERNAME/followers. Make sure you're logged in to your X/Twitter account.

Step 2: Open the browser console

  • Chrome/Edge: Press F12 or Ctrl+Shift+J (Mac: Cmd+Option+J)
  • Firefox: Press F12 or Ctrl+Shift+K
  • Safari: Enable Developer menu in Preferences → Advanced, then press Cmd+Option+C

Step 3: Paste the script

Copy the entire script from scripts/scrapeFollowers.js and paste it into the console.

Step 4: Customize the CONFIG (optional)

Before running, you can modify the CONFIG object at the top of the script to adjust behavior:

const CONFIG = {
  // Edit these values before running
  // See Configuration table above for all options
};

Step 5: Run and monitor

Press Enter to run the script. Watch the console for real-time progress logs:

  • ✅ Green messages = success
  • 🔄 Blue messages = in progress
  • ⚠️ Yellow messages = warnings
  • ❌ Red messages = errors

Step 6: Export results

Most scripts automatically download results as JSON/CSV when complete. Check your Downloads folder.


🖥️ CLI Usage

You can also run this via the XActions CLI:

# Install XActions globally
npm install -g xactions

# Run via CLI
xactions --help

🤖 MCP Server Usage

Use with AI agents (Claude, Cursor, etc.) via the MCP server:

# Start MCP server
npm run mcp

See the MCP Setup Guide for integration with Claude Desktop, Cursor, and other AI tools.


📁 Source Files

File Description
scripts/scrapeFollowers.js Main script

🔗 Related Scripts

Script Description
Scrape Profile with Replies Scrape a profile's tweets AND replies
Scrape Analytics Scrape your account and post analytics
Scrape Bookmarks Scrape all your bookmarked tweets
Scrape Cashtag Search Scrape cashtag search results with sentiment analysis
Scrape DMs Export your DM conversations

Author: nich (@nichxbt) — XActions on GitHub

⚡ Ready to try Scrape Followers?

XActions is 100% free and open-source. No API keys, no fees, no signup.

Browse All Scripts