The "Content Flywheel" is the holy grail of marketing. You record one video, and it becomes a Reel, a TikTok, a Tweet, and a Blog Post.
But doing this manually is exhausting. Transcribing video? Formatting text? No thanks.
In this tutorial, we’ll build a Content Repurposing Bot that:
- Takes an Instagram Reel URL.
- Extracts the Transcript (what was actually said).
- Extracts the Caption (what was written).
- Combines them into a raw text file ready for editing.
The Stack
- Node.js
- SociaVault API: For the heavy lifting (scraping).
Step 1: Setup
mkdir reel-to-text
cd reel-to-text
npm init -y
npm install axios dotenv
Step 2: The Repurposer Script
We need to hit two endpoints:
-
/v1/scrape/instagram/post-info: To get the caption and metadata. -
/v1/scrape/instagram/transcript: To get the spoken words.
Create repurpose.js:
require('dotenv').config();
const axios = require('axios');
const fs = require('fs');
const API_KEY = process.env.SOCIAVAULT_API_KEY;
const BASE_URL = 'https://api.sociavault.com/v1/scrape/instagram';
const headers = { 'Authorization': `Bearer ${API_KEY}` };
async function repurposeReel(reelUrl) {
console.log(`🎥 Processing Reel: ${reelUrl}`);
try {
// 1. Get Post Metadata (Caption, Likes, etc.)
console.log(' ...fetching metadata');
const infoRes = await axios.get(`${BASE_URL}/post-info`, {
params: { url: reelUrl },
headers
});
const post = infoRes.data.data;
// 2. Get Transcript
console.log(' ...fetching transcript');
let transcriptText = "No transcript available.";
try {
const transRes = await axios.get(`${BASE_URL}/transcript`, {
params: { url: reelUrl },
headers
});
// Join all segments into one block of text
if (transRes.data.data && transRes.data.data.length > 0) {
transcriptText = transRes.data.data.map(t => t.text).join(' ');
}
} catch (e) {
console.log(' (Transcript fetch failed or not available)');
}
// 3. Format the Output
const output = `
# REEL REPURPOSING DRAFT
-----------------------
**Source**: ${reelUrl}
**Author**: ${post.owner ? post.owner.username : 'Unknown'}
**Likes**: ${post.likes_count}
-----------------------
## 📝 ORIGINAL CAPTION
${post.caption}
## 🗣️ VIDEO TRANSCRIPT
${transcriptText}
-----------------------
*Generated by SociaVault Repurposer*
`;
// 4. Save to File
const filename = `draft-${Date.now()}.md`;
fs.writeFileSync(filename, output);
console.log(`✅ Saved draft to ${filename}`);
} catch (error) {
console.error('❌ Error:', error.message);
}
}
// Run it
const targetReel = 'https://www.instagram.com/reel/C3...'; // Replace with real URL
repurposeReel(targetReel);
How It Works
- Metadata: We grab the caption first. Often, creators put the "meat" of the content in the caption.
- Transcript: This is the game changer. SociaVault extracts the auto-generated captions from the video itself. This gives you the exact script the creator used.
- Combination: We dump it all into a Markdown file.
Next Level: Add AI
The logical next step is to pipe this output into OpenAI.
You could add a function that takes transcriptText and sends it to GPT-4 with the prompt:
"Turn this video transcript into a structured LinkedIn post with bullet points."
Now you have a fully automated video-to-text pipeline.
Why SociaVault?
Instagram makes it incredibly hard to get transcripts programmatically. You'd usually have to download the video, extract the audio, and run it through Whisper (which is slow and expensive).
SociaVault grabs the existing transcript data directly from Instagram's internal API, making it instant and cheap.
Grab your free API key at SociaVault.com and start building!
Top comments (0)