File size: 3,794 Bytes
33644aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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 = `<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>${item.name.charAt(0).toUpperCase() + item.name.slice(1)} Form</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: transparent;
            margin: 0;
            padding: 20px;
            color: #333;
        }
        .contact-form {
            max-width: 600px;
            margin: 0 auto;
            background: #fff;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }
        .form-group {
            margin-bottom: 20px;
        }
        label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #1a365d;
        }
        input[type="text"],
        input[type="email"],
        input[type="tel"],
        select,
        textarea {
            width: 100%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 16px;
            box-sizing: border-box;
        }
        button[type="submit"], input[type="submit"] {
            background-color: #1a365d;
            color: white;
            padding: 12px 24px;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            width: 100%;
            transition: background-color 0.2s;
        }
        button[type="submit"]:hover, input[type="submit"]:hover {
            background-color: #2c5282;
        }
    </style>
</head>
<body>
    ${formHtml.replace(/action="[^"]*"/g, '').replace(/method="[^"]*"/g, '')}
    
    <!-- Integration Script to automatically wire this form up to the Hugging Face API -->
    <script src="/live-site-integration.js"></script>
</body>
</html>`;

                const outputPath = path.join(__dirname, 'public', `${item.name}.html`);
                fs.writeFileSync(outputPath, finalHtml);
                console.log(`Saved form to ${outputPath}`);
            } else {
                console.log(`No form found on ${item.url}`);
            }
        } catch (e) {
            console.error(`Failed to fetch ${item.url}:`, e);
        }
    }
}

scrapeForms();