const { VidNavigatorClient, VidNavigatorError } = require('vidnavigator');
const client = new VidNavigatorClient({
apiKey: process.env.VIDNAVIGATOR_API_KEY,
});
async function analyzeVideo() {
try {
const result = await client.analyzeVideo({
video_url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
query: "What is the main theme of this song?"
});
console.log("Summary:", result.transcript_analysis.summary);
console.log("Answer to your query:", result.transcript_analysis.query_answer);
} catch (error) {
if (error instanceof VidNavigatorError) {
console.error(`An error occurred: ${error.message}`);
} else {
console.error("An unexpected error occurred:", error);
}
}
}
analyzeVideo();