Build a TikTok Trend Tracker with Node.js (No Login Required)
Source: Dev.to

If you are a creator or marketer, “trend research” usually means scrolling TikTok for hours and calling it work.
But what if you could just run a script and get a list of:
- The top trending hashtags right now.
- The most popular music/sounds being used.
- The breakout creators of the day.
In this tutorial, we’ll build a TikTok Trend Tracker using Node.js and the SociaVault API.
The Goal
We want a command‑line tool that outputs a daily report like this:
🔥 TOP TRENDING HASHTAGS
1. #fyp (2.1B views)
2. #coding (500M views)
3. #ai (300M views)
🎵 VIRAL MUSIC
1. "Original Sound - User123"
2. "Flowers - Miley Cyrus"
Prerequisites
- Node.js installed.
- A SociaVault API Key.
Step 1: Project Setup
mkdir tiktok-trends
cd tiktok-trends
npm init -y
npm install axios dotenv
Create a .env file:
SOCIAVAULT_API_KEY=your_api_key
Step 2: Fetching Trends
We’ll use two powerful endpoints:
/v1/scrape/tiktok/trending– gets the current trending feed./v1/scrape/tiktok/music/popular– gets the top sounds.
Create tracker.js:
require('dotenv').config();
const axios = require('axios');
const API_KEY = process.env.SOCIAVAULT_API_KEY;
const BASE_URL = 'https://api.sociavault.com/v1/scrape/tiktok';
const headers = {
Authorization: `Bearer ${API_KEY}`,
};
async function getTrendingFeed() {
try {
console.log('📉 Fetching trending feed...');
const response = await axios.get(`${BASE_URL}/trending`, { headers });
return response.data.data || [];
} catch (error) {
console.error('Error fetching feed:', error.message);
return [];
}
}
async function getPopularMusic() {
try {
console.log('🎵 Fetching popular music...');
const response = await axios.get(`${BASE_URL}/music/popular`, { headers });
return response.data.data || [];
} catch (error) {
console.error('Error fetching music:', error.message);
return [];
}
}
Step 3: Analyzing the Data
The raw data is huge. We need to extract the insights.
function analyzeTrends(videos) {
const hashtags = {};
videos.forEach((video) => {
// Extract hashtags from description
const tags = video.desc.match(/#[\w]+/g) || [];
tags.forEach((tag) => {
hashtags[tag] = (hashtags[tag] || 0) + 1;
});
});
// Sort by frequency and keep top 10
return Object.entries(hashtags)
.sort((a, b) => b[1] - a[1])
.slice(0, 10);
}
Step 4: The Main Loop
Now let’s put it all together.
async function main() {
console.log('🚀 Starting Trend Tracker...\n');
// 1. Get Data
const [videos, music] = await Promise.all([getTrendingFeed(), getPopularMusic()]);
// 2. Analyze Hashtags
const topTags = analyzeTrends(videos);
// 3. Print Report
console.log('\n🔥 TOP TRENDING HASHTAGS (from current feed)');
console.log('-------------------------------------------');
topTags.forEach((tag, i) => {
console.log(`${i + 1}. ${tag[0]} (Found in ${tag[1]} videos)`);
});
console.log('\n🎵 VIRAL MUSIC');
console.log('-------------------------------------------');
music.slice(0, 5).forEach((song, i) => {
console.log(`${i + 1}. ${song.title} - ${song.author}`);
});
}
main();
Why Use an API?
TikTok’s web structure is notoriously difficult to scrape. It uses:
- Dynamic class names (obfuscation).
- Infinite scrolling.
- Heavy fingerprinting.
If you try to scrape this with Selenium or Puppeteer, you’ll spend most of your time fixing broken selectors. Using an API like SociaVault lets you focus on the data, not the scraping infrastructure.
Taking It Further
You could expand this script to:
- Save to Database – store daily trends in Postgres/Supabase to track longevity.
- Alerts – send a Discord notification when a specific keyword (e.g., “crypto”) enters the top 10.
- Content Generation – use OpenAI to generate video ideas based on the trending hashtags.
Happy coding!