const fs = require('fs');

async function scrape() {
  try {
    const response = await fetch('https://api.firecrawl.dev/v1/scrape', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer fc-f54fdd68b31c4ef59c37b208efda869a'
      },
      body: JSON.stringify({
        url: 'https://solvior.themejunction.net/home-01-landing/',
        formats: ['html']
      })
    });

    const data = await response.json();
    if (data.data && data.data.html) {
      fs.writeFileSync('page.html', data.data.html);
      console.log('Successfully saved to page.html');
    } else {
      console.log('Failed:', data);
    }
  } catch (err) {
    console.error(err);
  }
}

scrape();
