TikTok Collection Scraper
Batch extract TikTok user collection folders and their video links — including play counts, likes, comments, and shares. Zero external API, no paid service, just curl_cffi.
Features
- 🔓 No login required — works without cookies for public collections (~80% coverage)
- 🔑 Full access with cookie — get all collections including private ones (100%)
- 🚀 Zero external API — only needs
curl_cffi, no TikHub/RapidAPI/paid services
- 📥 7 input formats — username, @username, profile URL, video URL, short link, user_id, secUid
- 📊 Rich metadata — plays, likes, comments, shares per video
- ⚡ Fast — 50 collections + 300 videos in ~40 seconds
Prerequisites
Ensure curl_cffi is installed:
pip install curl_cffi
Quick Start
Run the bundled script. All paths below are relative to this skill's directory.
# Guest mode (public collections, no cookie needed)
python3 scripts/scrape_collections.py <target> -o /tmp/result.json
# Login mode (all collections, 100% coverage)
python3 scripts/scrape_collections.py <target> --cookie /path/to/cookie.txt -o /tmp/result.json
Supported Input Formats
| Format |
Example |
| Username |
chengfeng_yulin |
| @Username |
@chengfeng_yulin |
| Profile URL |
https://www.tiktok.com/@chengfeng_yulin |
| Video URL |
https://www.tiktok.com/@user/video/7602514407133941000 |
| Short link |
https://vm.tiktok.com/ZMkVKQxsb/ |
| User ID |
6811802142106764293 |
| secUid |
MS4wLjABAAAA... |
Output Format
JSON with structure:
{
"target": "chengfeng_yulin",
"secUid": "MS4wLjAB...",
"uid": "68118...",
"uniqueId": "chengfeng_yulin",
"mode": "guest",
"totalCollections": 50,
"totalVideos": 308,
"elapsedSeconds": 40.0,
"collections": [
{
"collectionId": "760379...",
"name": "收藏夹名称",
"expected": 3,
"actual": 3,
"items": [
{
"id": "760251...",
"url": "https://www.tiktok.com/@author/video/760251...",
"desc": "Video description...",
"author": "author_username",
"plays": 2000000,
"likes": 25100,
"comments": 632,
"shares": 85000
}
]
}
]
}
Cookie
- Not needed for public collections (status=3, typically ~50% of folders, ~80% of videos)
- Needed for private collections (status=1) — must be the target account's own login cookie
- Cookie format: raw cookie string from browser (semicolon-separated key=value pairs)
How It Works
Uses TikTok's internal web APIs with curl_cffi for Chrome TLS fingerprint impersonation:
- Resolve user — any input format →
secUid (via TikTok's own redirects and page parsing)
- Fetch collections —
GET /api/user/collection_list/ (no auth needed)
- Fetch videos —
GET /api/collection/item_list/ with sourceType=113 (the undocumented key parameter)
sourceType=113 is an undocumented parameter discovered through browser request interception. Without it, the API returns success with empty results.
See references/api-notes.md for full API documentation.
Error Handling
⚠️ = fewer videos than expected (likely deleted videos)
❌ = zero videos returned (video removed or API issue)
- Script retries failed requests up to 3 times with 5s backoff
- Progress is printed to stderr; JSON output goes to stdout (or file with
-o)
1---2name: tiktok-collection-scraper3description: Scrape TikTok user collection folders and their video links with full metadata (plays, likes, comments, shares). Use when user asks to get, scrape, fetch, extract, or download TikTok collections, favorites, saved videos, bookmarks, or collection folder contents for any TikTok account. Accepts any user identifier — username, @username, profile URL, video URL, short link (vm.tiktok.com), user_id, or secUid. Zero external API dependency, no paid service needed, only requires curl_cffi. Works without login cookies for public collections (~80% coverage). Also use for TikTok competitor analysis, content research, viral video discovery, or building video databases.4---56# TikTok Collection Scraper78Batch extract TikTok user collection folders and their video links — including play counts, likes, comments, and shares. Zero external API, no paid service, just `curl_cffi`.910## Features1112- 🔓 **No login required** — works without cookies for public collections (~80% coverage)13- 🔑 **Full access with cookie** — get all collections including private ones (100%)14- 🚀 **Zero external API** — only needs `curl_cffi`, no TikHub/RapidAPI/paid services15- 📥 **7 input formats** — username, @username, profile URL, video URL, short link, user_id, secUid16- 📊 **Rich metadata** — plays, likes, comments, shares per video17- ⚡ **Fast** — 50 collections + 300 videos in ~40 seconds1819## Prerequisites2021Ensure `curl_cffi` is installed:2223```bash24pip install curl_cffi25```2627## Quick Start2829Run the bundled script. All paths below are relative to this skill's directory.3031```bash32# Guest mode (public collections, no cookie needed)33python3 scripts/scrape_collections.py <target> -o /tmp/result.json3435# Login mode (all collections, 100% coverage)36python3 scripts/scrape_collections.py <target> --cookie /path/to/cookie.txt -o /tmp/result.json37```3839### Supported Input Formats4041| Format | Example |42|--------|---------|43| Username | `chengfeng_yulin` |44| @Username | `@chengfeng_yulin` |45| Profile URL | `https://www.tiktok.com/@chengfeng_yulin` |46| Video URL | `https://www.tiktok.com/@user/video/7602514407133941000` |47| Short link | `https://vm.tiktok.com/ZMkVKQxsb/` |48| User ID | `6811802142106764293` |49| secUid | `MS4wLjABAAAA...` |5051## Output Format5253JSON with structure:5455```json56{57 "target": "chengfeng_yulin",58 "secUid": "MS4wLjAB...",59 "uid": "68118...",60 "uniqueId": "chengfeng_yulin",61 "mode": "guest",62 "totalCollections": 50,63 "totalVideos": 308,64 "elapsedSeconds": 40.0,65 "collections": [66 {67 "collectionId": "760379...",68 "name": "收藏夹名称",69 "expected": 3,70 "actual": 3,71 "items": [72 {73 "id": "760251...",74 "url": "https://www.tiktok.com/@author/video/760251...",75 "desc": "Video description...",76 "author": "author_username",77 "plays": 2000000,78 "likes": 25100,79 "comments": 632,80 "shares": 8500081 }82 ]83 }84 ]85}86```8788## Cookie8990- **Not needed** for public collections (status=3, typically ~50% of folders, ~80% of videos)91- **Needed** for private collections (status=1) — must be the target account's own login cookie92- Cookie format: raw cookie string from browser (semicolon-separated key=value pairs)9394## How It Works9596Uses TikTok's internal web APIs with `curl_cffi` for Chrome TLS fingerprint impersonation:97981. **Resolve user** — any input format → `secUid` (via TikTok's own redirects and page parsing)992. **Fetch collections** — `GET /api/user/collection_list/` (no auth needed)1003. **Fetch videos** — `GET /api/collection/item_list/` with `sourceType=113` (the undocumented key parameter)101102> `sourceType=113` is an undocumented parameter discovered through browser request interception. Without it, the API returns success with empty results.103104See `references/api-notes.md` for full API documentation.105106## Error Handling107108- `⚠️` = fewer videos than expected (likely deleted videos)109- `❌` = zero videos returned (video removed or API issue)110- Script retries failed requests up to 3 times with 5s backoff111- Progress is printed to stderr; JSON output goes to stdout (or file with `-o`)