On Instagram Reels and TikTok, the audio track is just as important as the video. Using a "Trending Audio" before it peaks is one of the most reliable ways to hack the algorithm and get millions of organic views.
But how do you find trending audios before everyone else does?
In this tutorial, we'll build a Node.js script that scrapes recent Reels from top creators in your niche, extracts the audio tracks they are using, and counts the frequencies to identify emerging viral sounds.
The Architecture
- Targeting: Define a list of "trendsetter" Instagram accounts in your niche.
- Data Extraction: Fetch their most recent Reels.
- Audio Analysis: Extract the audio track ID and name from each Reel.
- Aggregation: Count which audios are being used the most across different creators.
The Tooling
Instagram's official Graph API does not provide access to Reels audio data for third-party developers. Scraping Instagram manually will result in an immediate IP ban.
We will use the SociaVault API, which provides a clean endpoint to fetch Instagram Reels and their associated audio metadata without needing proxies or headless browsers.
Step 1: Setup
npm init -y
npm install axios dotenv
Create your .env file:
SOCIAVAULT_API_KEY=your_api_key_here
Step 2: Fetching Reels from Trendsetters
Create index.js. We'll write a function to fetch the latest Reels for a given username.
require('dotenv').config();
const axios = require('axios');
const API_KEY = process.env.SOCIAVAULT_API_KEY;
const BASE_URL = 'https://api.sociavault.com/v1/instagram';
async function getRecentReels(username) {
console.log(`Fetching Reels for @${username}...`);
try {
const response = await axios.get(`${BASE_URL}/profile/reels`, {
headers: { 'Authorization': `Bearer ${API_KEY}` },
params: { username: username, limit: 15 }
});
return response.data.data || [];
} catch (error) {
console.error(`Failed to fetch @${username}:`, error.message);
return [];
}
}
Step 3: Extracting and Aggregating Audio Data
Now we'll loop through our list of trendsetters, extract the audio data from their Reels, and keep a running tally of which audios appear most frequently.
async function trackViralAudios(targetAccounts) {
const audioTracker = new Map();
for (const account of targetAccounts) {
const reels = await getRecentReels(account);
reels.forEach(reel => {
// Check if the reel has an audio track attached
if (reel.audio_track) {
const audioId = reel.audio_track.id;
const audioName = reel.audio_track.title;
const audioAuthor = reel.audio_track.author;
if (audioTracker.has(audioId)) {
// Increment count if we've seen this audio before
const existing = audioTracker.get(audioId);
existing.count += 1;
existing.usedBy.add(account);
} else {
// Add new audio to tracker
audioTracker.set(audioId, {
id: audioId,
name: audioName,
author: audioAuthor,
count: 1,
usedBy: new Set([account]),
url: `https://www.instagram.com/reels/audio/${audioId}/`
});
}
}
});
// Small delay to prevent rate limiting
await new Promise(resolve => setTimeout(resolve, 1000));
}
return Array.from(audioTracker.values());
}
Step 4: Finding the Winners
We want to find audios that are being used by multiple different creators. If an audio is used 5 times, but all by the same creator, it's not a trend. If it's used 5 times by 5 different creators, it's a viral trend.
async function run() {
// Define trendsetters in your niche (e.g., fitness)
const fitnessTrendsetters = [
'chrisbumstead',
'noeldeyzel_bodybuilder',
'leanbeefpatty',
'willtennyson',
'davidlaid'
];
console.log("Starting Viral Audio Tracker...");
const allAudios = await trackViralAudios(fitnessTrendsetters);
// Filter and sort: We want audios used by at least 2 different creators
const trendingAudios = allAudios
.filter(audio => audio.usedBy.size >= 2)
.sort((a, b) => b.usedBy.size - a.usedBy.size);
console.log('\n' + '='.repeat(50));
console.log('🔥 EMERGING VIRAL AUDIOS DETECTED 🔥');
console.log('='.repeat(50));
if (trendingAudios.length === 0) {
console.log("No cross-creator trends detected right now.");
return;
}
trendingAudios.slice(0, 5).forEach((audio, index) => {
console.log(`\n#${index + 1}: "${audio.name}" by ${audio.author}`);
console.log(`Used by ${audio.usedBy.size} top creators: ${Array.from(audio.usedBy).join(', ')}`);
console.log(`Audio Link: ${audio.url}`);
});
}
run();
The Output
When you run the script, you'll get a curated list of audios that are currently gaining traction in your specific niche:
Starting Viral Audio Tracker...
Fetching Reels for @chrisbumstead...
Fetching Reels for @noeldeyzel_bodybuilder...
Fetching Reels for @leanbeefpatty...
Fetching Reels for @willtennyson...
Fetching Reels for @davidlaid...
==================================================
🔥 EMERGING VIRAL AUDIOS DETECTED 🔥
==================================================
#1: "Phonk Edit (Slowed)" by DJ Drift
Used by 4 top creators: chrisbumstead, noeldeyzel_bodybuilder, willtennyson, davidlaid
Audio Link: https://www.instagram.com/reels/audio/1234567890/
#2: "Original Audio" by leanbeefpatty
Used by 2 top creators: leanbeefpatty, willtennyson
Audio Link: https://www.instagram.com/reels/audio/0987654321/
Why This is Valuable
Instead of scrolling through the Reels feed for hours trying to "feel" what's trending, you now have a data-driven approach.
If you run this script daily via a Cron job, you can spot an audio the moment a second or third major creator uses it. You can then immediately film a Reel using that audio, riding the algorithmic wave before the audio gets saturated with millions of videos.
By using SociaVault, you can scale this to track hundreds of accounts across Instagram and TikTok simultaneously without worrying about getting blocked.
Get your free API key at SociaVault.com and start hacking the algorithm today.
Top comments (0)