Search TikTok videos by keyword via Scavio API at $0.005/request. The search/videos endpoint returns video metadata with engagement stats, creator info, and pagination support for deep result sets.
Prerequisites
- Scavio API key
- Python 3.8+ or Node.js 18+
- Target keyword or phrase
Walkthrough
Step 1: Run a video search
Search TikTok videos by keyword using the search/videos endpoint.
import requests, os
HEADERS = {'Authorization': f'Bearer {os.environ["SCAVIO_API_KEY"]}',
'Content-Type': 'application/json'}
resp = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
headers=HEADERS,
json={'keyword': 'productivity tools', 'count': 20, 'cursor': 0})
data = resp.json()['data']
for v in data.get('videos', []):
print(f"{v['desc'][:50]} | {v['stats']['playCount']:,} plays")Step 2: Paginate through results
Use cursor from the response for next page.
if data.get('has_more'):
page2 = requests.post(
'https://api.scavio.dev/api/v1/tiktok/search/videos',
headers=HEADERS,
json={'keyword': 'productivity tools', 'count': 20,
'cursor': data['cursor']}).json()['data']
print(f'Page 2: {len(page2.get("videos", []))} results')Python Example
import requests, os
HEADERS = {'Authorization': f'Bearer {os.environ["SCAVIO_API_KEY"]}',
'Content-Type': 'application/json'}
def search_videos(keyword, max_pages=3):
videos = []
cursor = 0
for _ in range(max_pages):
resp = requests.post('https://api.scavio.dev/api/v1/tiktok/search/videos',
headers=HEADERS,
json={'keyword': keyword, 'count': 20, 'cursor': cursor}).json()['data']
videos.extend(resp.get('videos', []))
if not resp.get('has_more'):
break
cursor = resp['cursor']
return videos
results = search_videos('saas tools')
for v in results[:5]:
print(f"{v['desc'][:40]} - {v['stats']['playCount']:,} plays")JavaScript Example
const H = {'Authorization': `Bearer ${process.env.SCAVIO_API_KEY}`, 'Content-Type': 'application/json'};
async function searchVideos(keyword, maxPages = 3) {
const videos = [];
let cursor = 0;
for (let i = 0; i < maxPages; i++) {
const r = await fetch('https://api.scavio.dev/api/v1/tiktok/search/videos', {
method: 'POST', headers: H,
body: JSON.stringify({keyword, count: 20, cursor})
}).then(r => r.json());
videos.push(...(r.data.videos || []));
if (!r.data.has_more) break;
cursor = r.data.cursor;
}
return videos;
}
searchVideos('saas tools').then(v => console.log(`${v.length} videos found`));Expected Output
Array of TikTok videos matching the keyword with engagement metrics, creator info, and video metadata. Paginated with cursor.