Skip to content

Instantly share code, notes, and snippets.

@SaurusAraAra
Created May 19, 2026 17:51
Show Gist options
  • Select an option

  • Save SaurusAraAra/22684488d0c1fdb1bc3cfa745880bc1d to your computer and use it in GitHub Desktop.

Select an option

Save SaurusAraAra/22684488d0c1fdb1bc3cfa745880bc1d to your computer and use it in GitHub Desktop.
const axios = require('axios');
async function tiktokSearch(query = 'dance tiktok') {
try {
const { data } = await axios({
method: 'POST',
url: 'https://tikwm.com/api/feed/search',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'User-Agent': 'Mozilla/5.0 (Linux; Android 10)',
'Cookie': 'current_language=en'
},
data: new URLSearchParams({
keywords: query,
count: 10,
cursor: 0,
HD: 1
}).toString()
});
const videos = data?.data?.videos || [];
if (!videos.length) {
return console.log('No video found');
}
const result = videos.map(v => ({
title: v.title,
cover: v.cover,
no_watermark: v.play,
watermark: v.wmplay,
music: v.music,
author: {
nickname: v.author.nickname,
avatar: v.author.avatar
},
stats: {
views: v.play_count,
likes: v.digg_count,
comments: v.comment_count,
shares: v.share_count
}
}));
console.log(JSON.stringify(result, null, 2));
} catch (e) {
console.error('Error:', e.message);
}
}
tiktokSearch();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment