youtube-auto-bot / scratch /test-pexels.js
Nathan
Security: Fresh clean migration to GitHub
36d488d
Raw History Blame Contribute Delete
815 Bytes
const path = require('path');
require('dotenv').config({ path: path.join(__dirname, '..', '.env') });
const pexels = require('../utils/pexels-service');
async function test() {
console.log('🚀 Testing Pexels Stock Video Search...');
const query = 'forest';
console.log(`🔍 Searching for: ${query}`);
try {
const link = await pexels.searchVideo(query);
if (link) {
console.log('✅ Found Video Link:', link);
const outputPath = path.join(__dirname, 'test_pexels.mp4');
console.log('📥 Downloading...');
await pexels.downloadVideo(link, outputPath);
console.log('✅ Download Complete:', outputPath);
} else {
console.log('❌ No video found.');
}
} catch (error) {
console.error('❌ Test Failed:', error.message);
}
}
test();