Skip to content

⚡ Quick Start Guide

Get up and running with Xeepy in under 5 minutes.


📦 Installation

pip install xeepy

Option 2: From Source

git clone https://github.com/nirholas/Get-Tweet-Replies-With-Python-Tweepy.git
cd Get-Tweet-Replies-With-Python-Tweepy
pip install -e .

Option 3: With AI Features

pip install xeepy[ai]  # Includes OpenAI, Anthropic clients

🔐 Authentication

Xeepy uses cookie-based authentication (no API keys needed!).

  1. Open x.com in your browser
  2. Open Developer Tools (F12 or Cmd+Option+I)
  3. Go to ApplicationCookiesx.com
  4. Find the auth_token cookie and copy its value

Step 2: Configure Xeepy

from xeepy import Xeepy

# Option A: Pass directly
async with Xeepy(auth_token="your_auth_token_here") as x:
    ...

# Option B: Environment variable (recommended)
# export XEEPY_AUTH_TOKEN=your_auth_token_here
async with Xeepy() as x:
    ...

# Option C: Config file
# Create ~/.xeepy/config.yaml

~/.xeepy/config.yaml:

auth:
  auth_token: "your_auth_token_here"

settings:
  headless: true
  rate_limit: true


🎯 5-Minute Examples

Example 1: Get Tweet Replies

The original purpose of this repo - finally working!

import asyncio
from xeepy import Xeepy

async def main():
    async with Xeepy() as x:
        # Get replies to any tweet
        replies = await x.scrape.replies(
            "https://x.com/elonmusk/status/1234567890",
            limit=50
        )

        print(f"Found {len(replies)} replies!")

        for reply in replies[:5]:
            print(f"@{reply.username}: {reply.text[:100]}...")

        # Export to CSV
        x.export.to_csv(replies, "replies.csv")

asyncio.run(main())

Example 2: Unfollow Non-Followers

The most requested feature!

import asyncio
from xeepy import Xeepy

async def main():
    async with Xeepy() as x:
        # First, do a dry run to see who would be unfollowed
        preview = await x.unfollow.non_followers(
            max_unfollows=50,
            whitelist=["friend1", "important_account"],
            dry_run=True
        )

        print(f"Would unfollow {len(preview.unfollowed_users)} users:")
        for user in preview.unfollowed_users[:10]:
            print(f"  - @{user}")

        # If you're sure, run for real
        # result = await x.unfollow.non_followers(dry_run=False)

asyncio.run(main())

Example 3: Auto-Like by Keywords

import asyncio
from xeepy import Xeepy

async def main():
    async with Xeepy() as x:
        # Auto-like tweets containing keywords
        result = await x.engage.auto_like(
            keywords=["python", "machinelearning", "AI"],
            max_likes=25,
            duration_minutes=15
        )

        print(f"Liked {result.success_count} tweets!")

asyncio.run(main())

Example 4: Detect Unfollowers

import asyncio
from xeepy import Xeepy

async def main():
    async with Xeepy() as x:
        # Check who unfollowed you
        report = await x.monitor.unfollowers()

        if report.unfollowers:
            print(f"😢 {len(report.unfollowers)} people unfollowed you:")
            for user in report.unfollowers:
                print(f"  - @{user}")
        else:
            print("✅ No one unfollowed you!")

        if report.new_followers:
            print(f"🎉 {len(report.new_followers)} new followers!")

asyncio.run(main())

Example 5: AI-Powered Reply Generation

import asyncio
from xeepy import Xeepy
from xeepy.ai import ContentGenerator

async def main():
    async with Xeepy() as x:
        # Initialize AI (requires API key)
        ai = ContentGenerator(
            provider="openai",
            api_key="sk-..."
        )

        # Generate reply for a tweet
        tweet = "Just shipped my first Python package! 🐍"

        reply = await ai.generate_reply(
            tweet_text=tweet,
            style="supportive"
        )

        print(f"Suggested reply: {reply}")
        # Output: "Congrats! 🎉 What does it do? Would love to check it out!"

asyncio.run(main())

🖥️ CLI Quick Start

# Setup authentication
xeepy auth login

# Get tweet replies
xeepy scrape replies https://x.com/user/status/123 -o replies.csv

# Unfollow non-followers (dry run)
xeepy unfollow non-followers --dry-run

# Auto-like by keyword
xeepy engage auto-like "python" --max 25

# Check unfollowers
xeepy monitor unfollowers

📁 Project Structure

After installation, here's how to organize your project:

my_twitter_project/
├── main.py              # Your main script
├── config.yaml          # Configuration (optional)
├── .env                 # Environment variables
└── output/              # Exported data
    ├── replies.csv
    ├── followers.json
    └── unfollowers.json

main.py:

import asyncio
from xeepy import Xeepy

async def main():
    async with Xeepy() as x:
        # Your automation code here
        pass

if __name__ == "__main__":
    asyncio.run(main())

.env:

XEEPY_AUTH_TOKEN=your_auth_token
OPENAI_API_KEY=sk-...  # Optional, for AI features


⚠️ Important Notes

Rate Limits

Xeepy automatically handles rate limiting, but be aware: - Don't run multiple instances simultaneously - Start with small numbers (10-25 actions) - Wait between sessions (15-30 minutes)

Session Expiry

Your auth_token may expire. If you get authentication errors: 1. Re-fetch your auth_token from the browser 2. Update your configuration

Headless Mode

By default, Xeepy runs headless (no visible browser). To see what's happening:

async with Xeepy(headless=False) as x:
    # Browser window will be visible
    pass

🚀 Next Steps

  1. Full API Reference - All available methods
  2. Examples - More code examples
  3. AI Features - AI integration guide
  4. CLI Reference - All CLI commands

🆘 Troubleshooting

"Authentication failed"

  • Re-fetch your auth_token from the browser
  • Make sure you're logged into X/Twitter

"Element not found"

  • X/Twitter may have updated their UI
  • Check for Xeepy updates: pip install --upgrade xeepy

"Rate limited"

  • You're making too many requests
  • Wait 15-30 minutes before continuing
  • Reduce your action limits

Need help?


Ready to automate? Let's go! 🚀