Files
ContentGen_BE/test-api-social3.js
T
Harun CAN a40619ef33
Backend Deploy 🚀 / build-and-deploy (push) Has been cancelled
main
2026-05-06 10:48:07 +02:00

48 lines
1.8 KiB
JavaScript

const { PrismaClient } = require('@prisma/client');
const { GoogleGenAI } = require('@google/genai');
const prisma = new PrismaClient();
async function main() {
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
const promptText = `Generate comprehensive SEO metadata and social media content for the following video project.
TOPIC: "Bier: Sein 13.000 Jahre altes Geheimnis, das Sie nicht kennen? 🤯"
CURRENT TITLE: "Bier: Sein 13.000 Jahre altes Geheimnis, das Sie nicht kennen? 🤯"
LANGUAGE: de (generate all text in THIS language)
Return ONLY valid JSON matching this exact structure, with no markdown formatting or backticks:
{
"seo": {
"title": "SEO optimized title (under 60 chars)",
"description": "Meta description (150-200 chars)",
"keywords": ["keyword1", "keyword2", "keyword3", "keyword4", "keyword5"],
"hashtags": ["#hashtag1", "#hashtag2", "#hashtag3"],
"trendingHashtags": ["#trending1", "#trending2"],
"estimatedSearchVolume": "Summary of search volume for keywords",
"schemaMarkup": { "@type": "VideoObject", "name": "..." }
},
"socialContent": {
"youtubeTitle": "Clickable YouTube title with emojis",
"youtubeDescription": "Full YouTube description including hashtags and call to actions",
"tiktokCaption": "Catchy TikTok caption with trending hashtags",
"instagramCaption": "Engaging Instagram caption with emojis and hashtags",
"twitterText": "Viral X (Twitter) post text under 280 characters"
}
}`;
try {
const response = await ai.models.generateContent({
model: 'gemini-2.5-flash',
contents: promptText,
config: {
responseMimeType: 'application/json',
}
});
console.log("RAW TEXT:\n", response.text);
} catch (err) {
console.error(err);
}
}
main();