scraping-tweets-from-account — скилл для Claude Code: выгрузка твитов
Скилл выгружает твиты, ответы и медиа из публичного аккаунта Twitter/X через актёра apidojo/tweet-scraper на Apify. Пригодится, когда нужен датасет по чужому профилю.
npx skills add apidojo-io/apidojo-skills --skill scraping-tweets-from-account -a claude-codeЧто делает scraping-tweets-from-account
Скилл превращает запрос вроде «собери все посты с этого аккаунта» в запуск актёра apidojo~tweet-scraper и отдаёт таблицу: текст твита, лайки, ретвиты, ответы, ссылки на медиа и дату публикации. Внутри четыре шага — проверить, что аккаунт публичный, запустить актёр, дождаться статуса SUCCEEDED, забрать датасет.
Запускать можно скриптом scripts/run_actor.js: он сам ждёт завершения и сохраняет результат в CSV или JSON. Есть вариант через Apify MCP (apify:run-actor) и запасной путь — REST API с curl и опросом RUN_ID. Для работы нужна переменная окружения APIFY_TOKEN, иначе ничего не стартует.
Фильтров много: searchTerms с продвинутыми запросами Twitter, sort (Latest, Top, Latest+Top), tweetLanguage, maxItems, start и end по датам, пороги по ретвитам и лайкам, отбор только с картинками или видео. При таймауте README советует снизить maxItems до 500 за прогон. Приватные и заблокированные аккаунты дают 0 результатов — это не сбой, а ограничение самого источника.
Какие задачи решает
- выгрузить историю твитов публичного аккаунта в CSV
- собрать посты по хэштегу с фильтром по языку
- отфильтровать твиты по минимальному числу лайков и ретвитов
- получить ссылки на медиа из ленты пользователя
- сравнить активность двух аккаунтов за период
Примеры запросов агенту
- Собери все твиты с аккаунта
@NASAза последний месяц и сохрани в JSON - Выгрузи посты по запросу
#AI lang:en, только с видео, максимум 200 штук - Сделай таблицу твитов этого профиля с лайками, ретвитами и датами
Как установить scraping-tweets-from-account
1Через Skills CLI (Vercel)
npx skills add apidojo-io/apidojo-skills --skill scraping-tweets-from-account -a claude-code2Вручную: положить файлы
~/.claude/skills/scraping-tweets-from-account/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/scraping-tweets-from-account/
1Через Skills CLI (Vercel)
npx skills add apidojo-io/apidojo-skills --skill scraping-tweets-from-account -a codex2Вручную: положить файлы
.agents/skills/scraping-tweets-from-account/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add apidojo-io/apidojo-skills --skill scraping-tweets-from-account -a cursor2Вручную: положить файлы
.cursor/skills/scraping-tweets-from-account/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install apidojo-io/apidojo-skills scraping-tweets-from-account2Вручную: положить файлы
.github/skills/scraping-tweets-from-account/SKILL.md1Через Skills CLI (Vercel)
npx skills add apidojo-io/apidojo-skills --skill scraping-tweets-from-account -a gemini-cli2Командой платформы
gemini skills install https://github.com/apidojo-io/apidojo-skills --path skills/primitives/scraping-tweets-from-accountВручную: положить файлы
.devin/skills/scraping-tweets-from-account/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add apidojo-io/apidojo-skills --skill scraping-tweets-from-account -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о scraping-tweets-from-account
Как установить scraping-tweets-from-account в Claude Code?
Выполните npx skills add apidojo-io/apidojo-skills --skill scraping-tweets-from-account -a claude-code. Файл скилла появится по пути ~/.claude/skills/scraping-tweets-from-account/SKILL.md.
Что делает scraping-tweets-from-account?
Запускает актёра apidojo~tweet-scraper на Apify и возвращает датасет по публичному аккаунту Twitter/X: текст, лайки, ретвиты, ответы, медиа и дату каждого твита.
Что нужно для работы скилла?
Переменная окружения APIFY_TOKEN. Опционально можно поставить Apify MCP-сервер, тогда запуск идёт через apify:run-actor.
Исходный текст
SKILL.md · Apache-2.0
---
name: scraping-tweets-from-account
description: >
Scrapes all tweets, replies, and media from any Twitter/X account using apidojo's
Tweet scraper on Apify. Triggers when the user asks to: get all tweets from a Twitter
account, export a user's tweet history, scrape a specific Twitter profile's posts,
fetch the latest tweets from an account, download tweet data from a user timeline,
or collect all posts from a Twitter username. Returns tweet text, likes, retweets,
replies, media URLs, and timestamp per tweet.
Ideal for journalists, researchers, competitive analysts, and data engineers.
license: Apache-2.0
metadata:
author: apidojo
version: "1.0"
apify-actor: apidojo/tweet-scraper
---
# Scraping Tweets from an Account
Exports the full tweet history of any public Twitter/X account. Returns the raw timeline dataset including replies and media.
## Prerequisites
- `APIFY_TOKEN` environment variable set
- Optional: Apify MCP server installed
## Inputs
| Parameter | Type | Required | Default | Notes |
|-----------|------|----------|---------|-------|
| `searchTerms` | array | ✅ | `[]` | Twitter advanced search queries (e.g. `["#AI lang:en", "from:NASA"]`) |
| `sort` | string | Optional | `Top` | Sort order: `Latest`, `Top`, or `Latest+Top` |
| `tweetLanguage` | string | Optional | — | ISO 639-1 language code (e.g. `en`) |
| `maxItems` | number | Optional | Unlimited | Maximum tweets to return |
| `onlyVerifiedUsers` | boolean | Optional | `false` | Only tweets from verified users |
| `onlyTwitterBlue` | boolean | Optional | `false` | Only Twitter Blue subscribers |
| `onlyImage` | boolean | Optional | `false` | Only tweets with images |
| `onlyVideo` | boolean | Optional | `false` | Only tweets with videos |
| `onlyQuote` | boolean | Optional | `false` | Only quote tweets |
| `author` | string | Optional | — | Filter to a specific author handle |
| `inReplyTo` | string | Optional | — | Tweets replying to a specific handle |
| `mentioning` | string | Optional | — | Tweets mentioning a specific handle |
| `geotaggedNear` | string | Optional | — | Tweets near a location |
| `withinRadius` | string | Optional | — | Radius around geotaggedNear |
| `geocode` | string | Optional | — | Lat/lng + radius string |
| `placeObjectId` | string | Optional | — | Tweets tagged with a place |
| `minimumRetweets` | number | Optional | — | Minimum retweet count |
| `minimumFavorites` | number | Optional | — | Minimum like count |
| `minimumReplies` | number | Optional | — | Minimum reply count |
| `start` | string | Optional | — | Tweets after this date (YYYY-MM-DD) |
| `end` | string | Optional | — | Tweets before this date (YYYY-MM-DD) |
| `includeSearchTerms` | boolean | Optional | `false` | Add the matched search term to each tweet |
| `customMapFunction` | string | Optional | — | JavaScript function to transform each output object |
## Workflow
```
Progress:
- [ ] Step 1: Confirm account is public
- [ ] Step 2: Run tweet-scraper
- [ ] Step 3: Poll for SUCCEEDED
- [ ] Step 4: Fetch and deliver dataset
```
### Step 1: Validate Input
Strip `@` from username if present. Do not attempt to scrape private accounts — the actor will return 0 results.
### Step 2: Run the Actor
**Recommended — run_actor.js (handles waiting, output, and file saving automatically):**
```bash
# Quick answer (prints table to chat)
node scripts/run_actor.js \
--actor "apidojo~tweet-scraper" \
--input '{"param": "value"}'
# Save as CSV
node scripts/run_actor.js \
--actor "apidojo~tweet-scraper" \
--input '{"param": "value"}' \
--output YYYY-MM-DD_results.csv --format csv
# Save as JSON
node scripts/run_actor.js \
--actor "apidojo~tweet-scraper" \
--input '{"param": "value"}' \
--output YYYY-MM-DD_results.json --format json
```
> `APIFY_TOKEN` must be set in environment or `.env` file.
**If Apify MCP is available:**
```
Tool: apify:run-actor
Actor: "apidojo~tweet-scraper"
Input:
{
"twitterHandles": ["<handle>"],
"maxItems": 200,
"sort": "Latest"
}
```
**REST API fallback:**
```bash
curl -X POST \
"https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"twitterHandles": ["<handle>"], "maxItems": 200, "sort": "Latest"}'
```
Save `id` as `RUN_ID`. Poll until `status = SUCCEEDED`:
```bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | grep '"status"'
```
Fetch results:
```bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json"
```
### Step 3: Handle Edge Cases
- **0 results**: Account may be private, suspended, or handle misspelled. Report to user.
- **Fewer results than expected**: Account may have fewer public tweets than requested. Return what is available.
- **Protected account**: Actor returns empty — inform user the account is private.
## Output Format
```
# Tweet Timeline: @<username>
Tweets collected: N | Includes replies: YES/NO | Includes retweets: YES/NO
| Tweet ID | Text (truncated) | Likes | Retweets | Replies | Media | Timestamp |
|----------|-----------------|-------|----------|---------|-------|-----------|
| ... | ... | ... | ... | ... | ... | ... |
Full dataset: N rows × 12 fields
Available fields: id, text, likeCount, retweetCount, replyCount, quoteCount,
isReply, isRetweet, media, tweetUrl, lang, createdAt
```
## Troubleshooting
**0 results for a known public account:** Try again — Twitter may rate-limit intermittently.
**Missing older tweets:** Twitter API limits historical access; very old tweets may not be available.
**Timeout:** Reduce `maxItems` to 500 max per run.
© apidojo · Apache-2.0 · apidojo-io/apidojo-skills