SurfSense/surfsense_web/content/docs/connectors/native/tiktok.mdx

45 lines
1.9 KiB
Text

---
title: TikTok
description: Scrape public TikTok videos by URL, profile, hashtag, or search
---
The TikTok scraper pulls structured public data from TikTok. Give it URLs (a video, a profile, a hashtag, or a search page) and/or profiles, hashtags, or search terms, and it returns videos (caption, author, play/like/comment/share counts, music, hashtags, timestamps, and the web URL).
## Endpoint
```bash
POST /api/v1/workspaces/{workspace_id}/scrapers/tiktok/scrape
```
## Inputs
At least one of `urls`, `profiles`, `hashtags`, or `search_queries` is required.
| Field | Default | Description |
|-------|---------|-------------|
| `urls` | — | TikTok URLs: a video, a profile (`/@<user>`), a hashtag (`/tag/<name>`), or a search URL (max 20 sources per call) |
| `profiles` | — | Profile usernames, with or without a leading `@` |
| `hashtags` | — | Hashtag names, without the `#` |
| `search_queries` | — | Search terms to run on TikTok |
| `results_per_page` | `10` | Max videos per profile/hashtag/search target |
| `max_items` | `10` | Max total videos returned across all sources (hard cap 100) |
## Example
```bash
curl -X POST "$BASE_URL/api/v1/workspaces/1/scrapers/tiktok/scrape" \
-H "Authorization: Bearer $SURFSENSE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"hashtags": ["food"],
"max_items": 25
}'
```
The response is `{ "items": [...] }` — one item per video. Billing is per returned item.
<Callout type="info">
Video, hashtag, and search targets are the reliable paths. TikTok restricts the profile video endpoint for automated clients, so a `profiles` target can return no items even when the account is public — prefer hashtags, search, or a direct video URL.
</Callout>
For the full input and output JSON schemas and generated code snippets in your language, open **API Playground → TikTok → Scrape** in your workspace.