Social Media Data Hub
Use Apify to collect social media data from TikTok, Instagram, X/Twitter, and YouTube through one consistent workflow.
Core Capabilities
- 1. Profile lookup - Retrieve profile metadata such as follower count, content volume, and bio.
- Bulk post retrieval - Pull recent or popular posts for an account together with engagement metrics.
- Single-post lookup - Input a post URL and return a normalized record with key metrics.
- Comment retrieval - Fetch comment threads for a supported post URL.
- Cross-platform normalization - Map all supported platforms into one shared schema for analysis.
Actor Mapping
| Platform | Actor ID | Purpose |
|---|
| TikTok | INLINECODE0 | Profiles, posts, comments |
| Instagram |
apify/instagram-scraper | Profiles, posts, comments |
| X/Twitter (bulk) |
apidojo/tweet-scraper | Bulk tweet retrieval (50+ items) |
| X/Twitter (precise) |
apidojo/twitter-scraper-lite | Single tweet, conversation, or small batches |
| YouTube |
streamers/youtube-scraper | Channels and videos |
Usage
All scripts live under {baseDir}/scripts/, are executed with python3, and return JSON.
Profile Lookup
CODEBLOCK0
Bulk Post Retrieval
CODEBLOCK1
Single-Post Lookup
CODEBLOCK2
Comment Retrieval
CODEBLOCK3
Cross-Platform Normalization
INLINECODE7 is used internally by the fetch scripts and can also be run directly:
CODEBLOCK4
Unified Data Model
Normalized Post (NormalizedPost)
| Field | Type | Description |
|---|
| INLINECODE9 | string | INLINECODE10 / instagram / twitter / INLINECODE13 |
| INLINECODE14 |
string | Platform-native post ID |
|
post_url | string | Post URL |
|
text | string | Caption, text body, or title |
|
created_at | string | ISO 8601 timestamp |
|
author_name | string | Author username |
|
author_display_name | string | Display name |
|
likes | int | Like count |
|
comments | int | Comment count |
|
shares | int | Share or repost count, or
null |
|
views | int | View count, play count, or
null |
|
saves | int | Save or bookmark count, or
null |
|
hashtags | list | Hashtag list |
|
media_type | string |
video /
image /
text /
carousel |
Normalized Profile (NormalizedProfile)
| Field | Type | Description |
|---|
| INLINECODE35 | string | Platform identifier |
| INLINECODE36 |
string | Username or handle |
|
display_name | string | Display name |
|
bio | string | Biography or profile summary |
|
followers | int | Follower count |
|
following | int | Following count, or
null |
|
posts_count | int | Total content count, or
null |
|
profile_url | string | Profile URL |
|
verified | bool | Verification status |
Cost Reference (BRONZE Tier)
| Operation | TikTok | Instagram | X/Twitter | YouTube |
|---|
| Per post | $0.003 | $0.0023 | $0.0004 | $0.003 |
| Bulk 1K items |
$3.00 | $2.30 | $0.40 | $3.00 |
| Single-item lookup | ~$0.50 (minimum charge) | $0.0023 | $0.05 | $0.003 |
See {baseDir}/references/apify_actors_reference.md for actor inputs, selection guidance, and pricing details.
Notes
- - TikTok has a $0.50 minimum per run, so bulk retrieval is usually more cost-effective than single-item lookups.
- For X/Twitter, use
tweet-scraper when you need 50 or more items and twitter-scraper-lite for smaller batches or single tweets. - Instagram comments are limited to 50 comments per post.
- YouTube comments are not handled by these scripts; use a dedicated YouTube Comments Scraper actor instead.
- All scripts call the Apify REST API directly and do not rely on the
apify-client SDK.
社交媒体数据枢纽
通过统一的工作流程,使用Apify从TikTok、Instagram、X/Twitter和YouTube收集社交媒体数据。
核心功能
- 1. 个人资料查询 - 获取个人资料元数据,如粉丝数、内容数量和简介。
- 批量帖子检索 - 拉取账号的近期或热门帖子及其互动指标。
- 单帖查询 - 输入帖子URL,返回包含关键指标的标准记录。
- 评论检索 - 获取支持的帖子URL下的评论线程。
- 跨平台标准化 - 将所有支持的平台映射到统一的共享模式进行分析。
Actor映射
| 平台 | Actor ID | 用途 |
|---|
| TikTok | clockworks/tiktok-scraper | 个人资料、帖子、评论 |
| Instagram |
apify/instagram-scraper | 个人资料、帖子、评论 |
| X/Twitter(批量) | apidojo/tweet-scraper | 批量推文检索(50条以上) |
| X/Twitter(精确) | apidojo/twitter-scraper-lite | 单条推文、对话或小批量 |
| YouTube | streamers/youtube-scraper | 频道和视频 |
使用方法
所有脚本位于{baseDir}/scripts/目录下,使用python3执行,返回JSON格式数据。
个人资料查询
bash
python3 {baseDir}/scripts/fetch_profile.py --platform tiktok --username khaby.lame
python3 {baseDir}/scripts/fetch_profile.py --platform instagram --username natgeo
python3 {baseDir}/scripts/fetch_profile.py --platform twitter --username elonmusk
python3 {baseDir}/scripts/fetch_profile.py --platform youtube --channel-url https://www.youtube.com/@MrBeast
批量帖子检索
bash
python3 {baseDir}/scripts/fetch_posts.py --platform tiktok --username khaby.lame --count 20
python3 {baseDir}/scripts/fetch_posts.py --platform instagram --username natgeo --count 30
python3 {baseDir}/scripts/fetch_posts.py --platform twitter --username elonmusk --count 100
python3 {baseDir}/scripts/fetch_posts.py --platform youtube --channel-url https://www.youtube.com/@MrBeast --count 50
单帖查询
bash
python3 {baseDir}/scripts/fetchsinglepost.py --url https://www.tiktok.com/@user/video/123456
python3 {baseDir}/scripts/fetchsinglepost.py --url https://www.instagram.com/p/ABC123/
python3 {baseDir}/scripts/fetchsinglepost.py --url https://x.com/user/status/123456
python3 {baseDir}/scripts/fetchsinglepost.py --url https://www.youtube.com/watch?v=ABC123
评论检索
bash
python3 {baseDir}/scripts/fetch_comments.py --url https://www.tiktok.com/@user/video/123456 --count 50
python3 {baseDir}/scripts/fetch_comments.py --url https://www.instagram.com/p/ABC123/ --count 30
python3 {baseDir}/scripts/fetch_comments.py --url https://x.com/user/status/123456 --count 100
跨平台标准化
normalize.py被fetch脚本内部使用,也可以直接运行:
bash
echo | python3 {baseDir}/scripts/normalize.py --platform tiktok --type post
统一数据模型
标准化帖子(NormalizedPost)
| 字段 | 类型 | 描述 |
|---|
| platform | 字符串 | tiktok / instagram / twitter / youtube |
| post_id |
字符串 | 平台原生帖子ID |
| post_url | 字符串 | 帖子URL |
| text | 字符串 | 标题、正文或描述 |
| created_at | 字符串 | ISO 8601时间戳 |
| author_name | 字符串 | 作者用户名 |
| author
displayname | 字符串 | 显示名称 |
| likes | 整数 | 点赞数 |
| comments | 整数 | 评论数 |
| shares | 整数 | 分享或转发数,或null |
| views | 整数 | 观看或播放数,或null |
| saves | 整数 | 收藏或书签数,或null |
| hashtags | 列表 | 标签列表 |
| media_type | 字符串 | video / image / text / carousel |
标准化个人资料(NormalizedProfile)
| 字段 | 类型 | 描述 |
|---|
| platform | 字符串 | 平台标识 |
| username |
字符串 | 用户名或账号 |
| display_name | 字符串 | 显示名称 |
| bio | 字符串 | 个人简介或资料摘要 |
| followers | 整数 | 粉丝数 |
| following | 整数 | 关注数,或null |
| posts_count | 整数 | 内容总数,或null |
| profile_url | 字符串 | 个人资料URL |
| verified | 布尔值 | 认证状态 |
成本参考(BRONZE层级)
| 操作 | TikTok | Instagram | X/Twitter | YouTube |
|---|
| 每条帖子 | $0.003 | $0.0023 | $0.0004 | $0.003 |
| 批量1000条 |
$3.00 | $2.30 | $0.40 | $3.00 |
| 单条查询 | ~$0.50(最低收费) | $0.0023 | $0.05 | $0.003 |
详见{baseDir}/references/apifyactorsreference.md,了解actor输入、选择指南和定价详情。
注意事项
- - TikTok每次运行有$0.50的最低收费,因此批量检索通常比单条查询更具成本效益。
- 对于X/Twitter,当需要50条及以上内容时使用tweet-scraper,小批量或单条推文使用twitter-scraper-lite。
- Instagram每条帖子的评论限制为50条。
- YouTube评论不通过这些脚本处理;请使用专用的YouTube评论抓取actor。
- 所有脚本直接调用Apify REST API,不依赖apify-client SDK。