This guide will walk you through the essential steps to start using the VidNavigator API with our official SDKs.
Step 1: Get Your API Key
First, you’ll need an API key. Sign up for a free account on the VidNavigator Developer Dashboard to get your key.
Keep this key safe, as you’ll need it to authenticate all of your API requests.
Step 2: Install an SDK
We provide official SDKs for Python and JavaScript to make interacting with our API as seamless as possible.
Step 3: Make Your First API Call
Now you’re ready to make your first API call. Here’s a simple example that retrieves the transcript of a YouTube video. You can also use the Postman collection to make your first API call.
VidNavigator has separate endpoints for YouTube and other platforms. Use get_youtube_transcript for YouTube videos and get_transcript for other platforms like TikTok, X/Twitter, etc.
Python
import os
from vidnavigator import VidNavigatorClient, VidNavigatorError
# It's recommended to load your API key from an environment variable
# Create a .env file with: VIDNAVIGATOR_API_KEY="your_api_key_here"
import dotenv
dotenv.load_dotenv()
client = VidNavigatorClient()
try:
# For YouTube videos, use get_youtube_transcript
result = client.get_youtube_transcript(
video_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"
)
print("Successfully retrieved transcript for:", result.data.video_info.title)
print("Transcript snippet:", result.data.transcript[0].text)
except VidNavigatorError as e:
print(f"An error occurred: {e.message}")
JavaScript
const { VidNavigatorClient, VidNavigatorError } = require('vidnavigator');
// It's recommended to load your API key from an environment variable
const client = new VidNavigatorClient({
apiKey: process.env.VIDNAVIGATOR_API_KEY,
});
async function getTranscript() {
try {
// For YouTube videos, use getYouTubeTranscript
const { video_info, transcript } = await client.getYouTubeTranscript({
video_url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
});
console.log("Successfully retrieved transcript for:", video_info.title);
console.log("Transcript snippet:", transcript[0].text);
} catch (error) {
if (error instanceof VidNavigatorError) {
console.error(`An error occurred: ${error.message}`);
} else {
console.error("An unexpected error occurred:", error);
}
}
}
getTranscript();
Next Steps
You’ve successfully made your first API call! Here’s where you can go next: