// Test Google Trends API import { createRequire } from 'module'; const require = createRequire(import.meta.url); const googleTrends = require('google-trends-api'); async function testTrends() { try { console.log('Testing Google Trends API...'); const query = { geo: 'ES' }; const results = await googleTrends.realTimeTrends(query); const trendsData = JSON.parse(results); console.log('✅ API working!'); console.log('📈 Found', trendsData.storySummaries.trendingStories.length, 'trending stories'); // Show first trend if (trendsData.storySummaries.trendingStories.length > 0) { const firstTrend = trendsData.storySummaries.trendingStories[0]; console.log('🔥 Top trend:', firstTrend.title); if (firstTrend.articles && firstTrend.articles.length > 0) { console.log('📰 First article:', firstTrend.articles[0].articleTitle); } } } catch (error) { console.error('❌ Error:', error.message); } } testTrends();