AI Gaming Content
by @nicemaths123
Scrapes trending gaming data and viral clips to generate optimized scripts and produce viral gaming videos with AI for content creators and monetization.
Scrape Trending Gaming Discussions from Reddit
import ApifyClient from 'apify-client';const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
async function scrapeGamingReddit() {
const subreddits = [
"https://www.reddit.com/r/gaming/",
"https://www.reddit.com/r/pcgaming/",
"https://www.reddit.com/r/PS5/",
"https://www.reddit.com/r/NintendoSwitch/",
"https://www.reddit.com/r/Games/"
];
const run = await client.actor("apify/reddit-scraper").call({
startUrls: subreddits.map(url => ({ url })),
maxPostCount: 30,
maxComments: 10,
sort: "hot"
});
const { items } = await run.dataset().getData();
// Score by controversy potential (high comments to upvotes ratio = hot take territory)
return items.map(post => ({
title: post.title,
subreddit: post.subreddit,
score: post.score,
comments: post.numComments,
upvoteRatio: post.upvoteRatio,
controversyScore: post.numComments > 0 ? Math.round(post.numComments / Math.max(post.score, 1) * 100) : 0,
url: post.url,
created: post.created,
flair: post.flair || ''
})).sort((a, b) => b.controversyScore - a.controversyScore);
}
const trending = await scrapeGamingReddit();
console.log("Top trending gaming topics:");
trending.slice(0, 10).forEach((t, i) => {
console.log(${i + 1}. [${t.controversyScore}] ${t.title} (${t.subreddit}));
});
Scrape Viral Gaming Content from TikTok and YouTube
async function scrapeViralGamingContent(game = "gaming") {
const hashtags = [game, ${game}tiktok, 'gamingtiktok', 'gamingclips', 'gamernews']; const [ttRun, ytRun] = await Promise.all([
client.actor("apify/tiktok-hashtag-scraper").call({
hashtags: hashtags.slice(0, 3),
resultsPerPage: 30,
shouldDownloadVideos: false
}),
client.actor("apify/youtube-scraper").call({
searchKeywords: [${game} 2025, ${game} news, ${game} review],
maxResults: 30,
type: "video",
sortBy: "view_count"
})
]);
const [tt, yt] = await Promise.all([
ttRun.dataset().getData(),
ytRun.dataset().getData()
]);
// Identify top formats
const formatDetection = (text) => {
const t = (text || '').toLowerCase();
if (t.includes('tier list') || t.includes('ranking')) return 'Tier List';
if (t.includes('review') || t.includes('worth')) return 'Review';
if (t.includes('vs') || t.includes('versus') || t.includes('better')) return 'Comparison';
if (t.includes('tip') || t.includes('trick') || t.includes('hack')) return 'Tips & Tricks';
if (t.includes('news') || t.includes('update') || t.includes('patch')) return 'News/Update';
if (t.includes('hot take') || t.includes('unpopular') || t.includes('controversial')) return 'Hot Take';
if (t.includes('compilation') || t.includes('moments') || t.includes('montage')) return 'Compilation';
return 'Other';
};
const tiktokTop = tt.items.sort((a, b) => (b.playCount || 0) - (a.playCount || 0)).slice(0, 15);
const youtubeTop = yt.items.sort((a, b) => (b.viewCount || 0) - (a.viewCount || 0)).slice(0, 15);
// Count formats
const formatCounts = {};
[...tiktokTop, ...youtubeTop].forEach(v => {
const format = formatDetection(v.text || v.title);
formatCounts[format] = (formatCounts[format] || 0) + 1;
});
return {
tiktokTop: tiktokTop.map(v => ({
text: v.text,
views: v.playCount,
likes: v.diggCount,
shares: v.shareCount,
format: formatDetection(v.text),
sound: v.musicMeta?.musicName
})),
youtubeTop: youtubeTop.map(v => ({
title: v.title,
views: v.viewCount,
likes: v.likeCount,
channel: v.channelName,
format: formatDetection(v.title),
duration: v.duration
})),
winningFormats: Object.entries(formatCounts)
.sort((a, b) => b[1] - a[1])
.map(([format, count]) => ({ format, count })),
trendingSounds: tiktokTop
.filter(v => v.sound)
.map(v => v.sound)
.filter((v, i, a) => a.indexOf(v) === i)
.slice(0, 5)
};
}
const gamingContent = await scrapeViralGamingContent("GTA6");
console.log("Winning formats:", gamingContent.winningFormats);
Detect Emerging Games Before They Peak
async function detectEmergingGames() {
// Scrape Reddit for rising discussions
const redditRun = await client.actor("apify/reddit-search-scraper").call({
queries: ["new game 2025", "upcoming game", "game announcement", "hidden gem game"],
maxItems: 50
}); // Scrape Google Trends for rising game searches
const trendsRun = await client.actor("apify/google-trends-scraper").call({
searchTerms: ["new video game", "game release 2025", "best game 2025"],
geo: "US",
timeRange: "past7Days"
});
// Scrape YouTube for low-view-count videos on trending topics (content gap)
const ytRun = await client.actor("apify/youtube-scraper").call({
searchKeywords: ["new game 2025 review"],
maxResults: 30,
type: "video",
sortBy: "date"
});
const [reddit, trends, yt] = await Promise.all([
redditRun.dataset().getData(),
trendsRun.dataset().getData(),
ytRun.dataset().getData()
]);
// Find games mentioned in Reddit with high engagement but few YouTube videos
const gameNames = new Set();
reddit.items.forEach(post => {
const words = (post.title || '').split(/\s+/);
// Simple heuristic: capitalized multi-word phrases are likely game names
words.forEach((w, i) => {
if (w.length > 3 && w[0] === w[0].toUpperCase() && words[i + 1]?.[0] === words[i + 1]?.[0]?.toUpperCase()) {
gameNames.add(${w} ${words[i + 1]});
}
});
});
// Check which have few YouTube results (content gap = opportunity)
const lowCompetition = yt.items
.filter(v => (v.viewCount || 0) < 10000)
.map(v => v.title);
return {
emergingTopics: reddit.items
.sort((a, b) => (b.score || 0) - (a.score || 0))
.slice(0, 10)
.map(p => ({ title: p.title, score: p.score, comments: p.numComments })),
potentialGameNames: [...gameNames].slice(0, 20),
contentGaps: lowCompetition.slice(0, 10),
searchTrends: trends.items?.slice(0, 10)
};
}
const emerging = await detectEmergingGames();
console.log("Emerging topics:", emerging.emergingTopics.slice(0, 5));
console.log("Content gaps:", emerging.contentGaps.slice(0, 5));
Generate Gaming Video Scripts with AI
import axios from 'axios';;async function generateGamingScripts(trendData, gameTopic, count = 5) { const topHooks = trendData.tiktokTop?.slice(0, 5).map(v =>
"${(v.text || '').substring(0, 80)}" (${(v.views || 0).toLocaleString()} views)).join('\n') || 'No TikTok data';const formats = trendData.winningFormats?.map(f =>
${f.format} (${f.count}x)).join(', ') || 'Mixed';const prompt =
You are a viral gaming content creator. Generate ${count} short-form video scripts about "${gameTopic}".VIRAL DATA (from real top-performing gaming videos): Top hooks: ${topHooks}
Winning formats: ${formats}
RULES FOR EACH SCRIPT:
Hook in first 2 seconds (gaming audiences scroll FAST) 100 to 160 words (30 to 45 second video for gaming) Use one of these proven formats: Hot Take, Tier List, "Things You Missed", News Reaction, Tips Include gaming-specific language (no corporate tone) Each script gets 2 hook variations (A/B test) End with engagement CTA ("drop your rank in comments", "follow for daily gaming news") Include 5 hashtags per script FORMAT: SCRIPT [number]: [title] FORMAT: [format type] HOOK A: [hook variation 1] HOOK B: [hook variation 2] BODY: [script body] CTA: [call to action] HASHTAGS: [5 hashtags]
Generate all ${count} scripts now.
const { data } = await axios.post('https://api.anthropic.com/v1/messages', { model: "claude-sonnet-4-20250514", max_tokens: 2000, messages: [{ role: "user", content: prompt }] }, { headers: { 'x-api-key': process.env.CLAUDE_API_KEY, 'anthropic-version': '2023-06-01' } });
return data.content[0].text; }
const scripts = await generateGamingScripts(gamingContent, "GTA 6", 5); console.log(scripts);
Produce Gaming Videos with InVideo AI
const invideo = axios.create({
baseURL: 'https://api.invideo.io/v1',
headers: {
'Authorization': Bearer ${process.env.INVIDEO_API_KEY},
'Content-Type': 'application/json'
}
});async function produceGamingVideo(script) {
const response = await invideo.post('/videos/generate', {
script: script,
format: "9:16",
duration: "short",
style: "dynamic",
voiceover: {
enabled: true,
voice: "en-US-male-1",
speed: 1.15 // gaming audience prefers fast pacing
},
captions: {
enabled: true,
style: "bold-bottom",
highlight: true
},
music: {
enabled: true,
mood: "energetic",
volume: 0.3
}
});
const videoId = response.data.videoId;
let exportUrl = null;
while (!exportUrl) {
await new Promise(r => setTimeout(r, 5000));
const status = await invideo.get(/videos/${videoId}/status);
if (status.data.state === "completed") exportUrl = status.data.exportUrl;
if (status.data.state === "failed") throw new Error("Video generation failed");
}
return { videoId, exportUrl };
}
Monetization Analysis
async function analyzeMonetization(game, youtubeData) {
// Estimate CPM by niche (gaming CPMs are $3-8)
const estimatedCPM = 5.50; const channelAnalysis = youtubeData.youtubeTop.map(v => {
const estimatedRevenue = Math.round((v.views / 1000) * estimatedCPM * 100) / 100;
return {
title: v.title,
channel: v.channel,
views: v.views,
estimatedAdRevenue: estimatedRevenue,
format: v.format
};
});
// Best monetization formats
const formatRevenue = {};
channelAnalysis.forEach(v => {
if (!formatRevenue[v.format]) formatRevenue[v.format] = { totalViews: 0, count: 0 };
formatRevenue[v.format].totalViews += v.views;
formatRevenue[v.format].count++;
});
const bestFormats = Object.entries(formatRevenue)
.map(([format, data]) => ({
format,
avgViews: Math.round(data.totalViews / data.count),
estimatedRevenuePer: Math.round((data.totalViews / data.count / 1000) * estimatedCPM * 100) / 100
}))
.sort((a, b) => b.avgViews - a.avgViews);
return {
estimatedCPM,
topEarningVideos: channelAnalysis.sort((a, b) => b.estimatedAdRevenue - a.estimatedAdRevenue).slice(0, 5),
bestFormatsForRevenue: bestFormats,
monthlyPotential: {
"1_video_per_day": Math.round(30 * bestFormats[0]?.estimatedRevenuePer || 0),
"3_videos_per_week": Math.round(12 * bestFormats[0]?.estimatedRevenuePer || 0)
},
sponsorshipAngle: Gaming channels with 10K+ subs covering ${game} can charge $500-2000 per sponsored video
};
}
const monetization = await analyzeMonetization("GTA 6", gamingContent);
console.log("Monthly potential (daily uploads):", $${monetization.monthlyPotential["1_video_per_day"]});
console.log("Best format for revenue:", monetization.bestFormatsForRevenue[0]);
Full Pipeline: Research, Script, Produce, Calendar
import { writeFileSync } from 'fs';async function fullGamingContentPipeline(game, videoCount = 5) {
console.log(Starting Gaming Content Pipeline for: ${game});
// 1. Scrape trends
const reddit = await scrapeGamingReddit();
const content = await scrapeViralGamingContent(game);
console.log(Step 1: ${reddit.length} Reddit topics + ${content.tiktokTop.length + content.youtubeTop.length} viral videos analyzed);
// 2. Generate scripts
const scripts = await generateGamingScripts(content, game, videoCount);
console.log(Step 2: ${videoCount} scripts generated);
// 3. Monetization analysis
const money = await analyzeMonetization(game, content);
console.log(Step 3: Revenue potential $${money.monthlyPotential["1_video_per_day"]}/month);
// 4. Export report
const report = {
game,
generatedAt: new Date().toISOString(),
trendingTopics: reddit.slice(0, 15),
viralContent: content,
scripts,
monetization: money,
contentCalendar: Array.from({ length: 30 }, (_, i) => ({
day: i + 1,
topic: reddit[i % reddit.length]?.title || ${game} content day ${i + 1},
format: content.winningFormats[i % content.winningFormats.length]?.format || 'Hot Take',
platform: ['tiktok', 'youtube_shorts', 'instagram_reels'][i % 3]
}))
};
writeFileSync(gaming-content-${game.replace(/\s+/g, '-')}-${Date.now()}.json, JSON.stringify(report, null, 2));
console.log(Pipeline complete);
return report;
}
await fullGamingContentPipeline("GTA 6", 5);
clawhub install ai-gaming-content