Files

25 lines
658 B
JavaScript

import http from 'http';
function fetchHTML(path) {
return new Promise((resolve, reject) => {
http.get(`http://localhost:3000${path}`, (res) => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => resolve(data));
}).on('error', reject);
});
}
async function run() {
for (const locale of ['pl', 'de']) {
const html = await fetchHTML(`/${locale}/kontakt`);
console.log(`\n=== OPTIONS FOR /${locale}/kontakt ===`);
const regex = /<option[^>]*>([^<]*)<\/option>/g;
let match;
while ((match = regex.exec(html)) !== null) {
console.log(`[OPTION] ${match[1]}`);
}
}
}
run();