From cfe01e34c57f0990ffc47ef79706843409443304 Mon Sep 17 00:00:00 2001 From: marsalva Date: Fri, 13 Feb 2026 23:56:02 +0000 Subject: [PATCH] Actualizar robot.js --- robot.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/robot.js b/robot.js index 8660c59..5cb18fd 100644 --- a/robot.js +++ b/robot.js @@ -70,22 +70,23 @@ async function runMultiasistencia(ownerId, user, pass) { if (descHeader && descHeader.nextElementSibling) rawDesc = clean(descHeader.nextElementSibling.innerText); const idxDate = rawDesc.search(/\b\d{2}\/\d{2}\/\d{4}\b/); const cleanDesc = idxDate !== -1 ? rawDesc.substring(0, idxDate).trim() : rawDesc; - const rawCPField = findByCab("Distrito Postal") || ""; - const cpMatch = rawCPField.match(/\b\d{5}\b/); - const cpOnly = cpMatch ? cpMatch[0] : ""; - const popOnly = rawCPField.replace(cpOnly, '').replace('-', '').trim(); - const phoneMatch = body.match(/[6789]\d{8}/); - return { - "Expediente": findByCab("Número Reparación") || "", - "Nombre Cliente": findByCab("Nombre Cliente") || "", - "Dirección": findByCab("Dirección") || "", - "Población": popOnly, - "Código Postal": cpOnly, - "Compañía": "MULTI - " + (findByCab("Procedencia") || "MULTIASISTENCIA"), - "Descripción": cleanDesc, - "Teléfono": phoneMatch ? phoneMatch[0] : "", - "Urgente": findByCab("Urgente") || "No" - }; + // ... (dentro de runMultiasistencia - evaluate) +const rawCPField = findByCab("Distrito Postal") || ""; +const cpMatch = rawCPField.match(/\b\d{5}\b/); +const cpOnly = cpMatch ? cpMatch[0] : ""; +const popOnly = rawCPField.replace(cpOnly, '').replace('-', '').trim(); + +return { + "Expediente": findByCab("Número Reparación") || "", + "Nombre Cliente": findByCab("Nombre Cliente") || "", + "Dirección": findByCab("Dirección") || "", + "Población": popOnly, + "Código Postal": cpOnly, // CAMPO RECUPERADO + "Compañía": "MULTI - " + (findByCab("Procedencia") || "MULTIASISTENCIA"), + "Descripción": cleanDesc, + "Teléfono": phoneMatch ? phoneMatch[0] : "", + "Urgente": findByCab("Urgente") || "No" +}; }); if (scrapData && scrapData['Nombre Cliente']) break; } catch (e) { continue; }