File size: 815 Bytes
36d488d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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();