const { exec } = require("node:child_process") class GetCategoryUseCase { constructor({categoriesMapping}) { this.categoriesMapping = categoriesMapping } execute(domain) { exec(`echo ${domain} | bin/gcf1check.sh etc check_categorize_hybrid`, { cwd: '/usr/local/gcf1' }, (error, stdout, stderr)=>{ if (error) { console.error(error) return } const outputParts = stdout.split(/\s+/); // Split by whitespace if (outputParts[3]) { const categoryId = outputParts[2]; console.log({ categoryId }); } else { console.log({ error: 'Category ID not found' }); } }) } } module.exports = { GetCategoryUseCase }