const fs = require('fs'); const path = require('path'); const cheerio = require('cheerio'); const urls = [ { name: 'tours', url: 'https://www.thewallthathealsreynolds.org/tours.html' }, { name: 'escort', url: 'https://www.thewallthathealsreynolds.org/escort.html' }, { name: 'honor', url: 'https://www.thewallthathealsreynolds.org/honor.html' }, { name: 'contact', url: 'https://www.thewallthathealsreynolds.org/contact.html' } ]; const { execSync } = require('child_process'); async function scrapeForms() { for (const item of urls) { console.log(`Fetching ${item.url}...`); try { const html = execSync(`curl -s -k "${item.url}"`).toString(); const $ = cheerio.load(html); // Find the form container let formHtml = ''; const formContainer = $('.contact-form'); if (formContainer.length > 0) { formHtml = $.html(formContainer); } else { const justForm = $('form[data-validate]'); if (justForm.length > 0) { formHtml = $.html(justForm); } else { const fallback = $('form'); if (fallback.length > 0) { formHtml = $.html(fallback.first()); } } } if (formHtml) { const finalHtml = `