Skip to content
Back to skills

Collection

ASecurity

Unified Twitter/X API client for retrieving user info and tweets via twitterapi.io. Supports user lookup and advanced tweet search with a clean Typer-based CLI and agent-friendly Python interface.

  • 24 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
content-marketingpythongobashapi

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-b6e1baba/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-b6e1baba)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: x-api
description: Unified Twitter/X API client for retrieving user info and tweets via twitterapi.io. Supports user lookup and advanced tweet search with a clean Typer-based CLI and agent-friendly Python interface.
---

# X (Twitter) API Skill via twitterapi.io

A unified Twitter/X API client providing access to user information and advanced tweet search through twitterapi.io. Built with Typer for a clean CLI experience and designed to be agent-friendly for programmatic usage.

## CLI Usage

The unified client (`.claude/skills/x-api/src/twitter.py`) provides two subcommands with structured JSON output.

### 1. Get User Info

Retrieve user information by screen name. Returns a structured response with user information.

**Note**: The calculated fields (`last_tweet_date`, `last_reply_date`, `is_hebrew_writer`) are set to default values and require a separate search call using `search from:{username}` to populate.

```bash
python3 twitter.py userinfo <screenname>

# Example:
python3 twitter.py userinfo elonmusk
```

**Response Format:**

The userinfo command returns a `UserInfoResponse` Pydantic model with the following structure:

```json
{
  "status": "active",
  "profile": "https://pbs.twimg.com/profile_images/...",
  "blue_verified": true,
  "verification_type": "Business",
  "affiliates": {},
  "business_account": {},
  "desc": "User bio description",
  "name": "Display Name",
  "website": "example.com",
  "protected": false,
  "location": "Location",
  "following": 100,
  "followers": 1000,
  "statuses_count": 5000,
  "media_count": 50,
  "created_at": "2020-01-01T00:00:00.000Z",
  "last_tweet_date": null,
  "last_reply_date": null,
  "is_hebrew_writer": false
}
```

### 2. Search Tweets

Search for tweets matching a query with optional search type filtering. Returns a filtered response excluding `next_cursor`, and omitting `id` and `media` fields from each tweet.

```bash
python3 twitter.py search <query> [--type Top|Latest|Media|People|Lists]

# Basic Examples:
python3 twitter.py search "artificial intelligence" --type Latest
python3 twitter.py search SpaceX
python3 twitter.py search "developers" --type People
python3 twitter.py search "tech lists" --type Lists
```

**Response Format:**

The search command returns a `SearchResponse` Pydantic model with the following structure:

```json
{
  "timeline": [
    {
      "screen_name": "fishcatut",
      "bookmarks": 9,
      "favorites": 241,
      "created_at": "2023-09-16T18:08:33.000Z",
      "text": "What's going on here #cybertruck #tesla",
      "lang": "iw",
      "quotes": 14,
      "replies": 42,
      "retweets": 19
    }
  ]
}
```

#### Advanced Search Operators

The search endpoint supports Twitter's advanced search syntax for precise filtering:

**User Filters:**
```bash
# Posts from a specific user
python3 twitter.py search "from:elonmusk Tesla"

# Posts directed to a user
python3 twitter.py search "to:NASA space"
```

**Date Filters:**
```bash
# Posts since a specific date
python3 twitter.py search "AI since:2025-01-01"

# Posts within a date range
python3 twitter.py search "climate change since:2025-01-01 until:2025-01-31"

# Using Unix timestamps for precise timing
python3 twitter.py search "breaking news since_time:1704067200"
```

**Content Type Filters:**
```bash
# Posts with images only
python3 twitter.py search "sunset filter:images"

# Posts with videos
python3 twitter.py search "tutorial filter:videos"

# Posts with links
python3 twitter.py search "article filter:links"

# Reply posts only
python3 twitter.py search "question filter:replies"
```

**Language Filter:**
```bash
# Posts in specific language (ISO 639-1 codes)
python3 twitter.py search "technology lang:iw"
```

**Exclusion Operator:**
```bash
# Exclude specific terms (use minus operator)
python3 twitter.py search "from:NASA -Mars"
python3 twitter.py search "Python -snake"
```

**Combined Queries:**
```bash
# Complex multi-filter search
python3 twitter.py search "from:elonmusk since:2025-01-01 until:2025-01-07 Tesla -filter:replies"

# Search for content with media from specific user in date range
python3 twitter.py search "from:NASA filter:images since:2025-01-01"
```

## Common Use Cases

- **Research**: Retrieve and analyze user information, search for specific topics
- **Data Collection**: Gather tweets, replies, and user information for analysis
- **Validation**: Verify Twitter usernames or number of followers
- **Engagement Analysis**: Analyze replies and interactions on specific tweets

## Error Handling

Common error scenarios:
- **401 Unauthorized**: Invalid or missing API key - verify `XAPI_IO_API_KEY` is set in your `.env` file
- **429 Too Many Requests**: Rate limit exceeded - implement delays between requests
- **404 Not Found**: User/tweet not found - verify usernames are correct
- **500 Server Error**: twitterapi.io service issue - retry with exponential backoff

The `TwitterAPIClient` automatically handles these errors and provides clear error messages.

## Configuration

Set the following environment variable in your `.env` file:

```bash
XAPI_IO_API_KEY=your_api_key_here
```

You can obtain an API key from [twitterapi.io](https://twitterapi.io).

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in content-marketing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.