Actualizar robot.js
This commit is contained in:
33
robot.js
33
robot.js
@@ -70,22 +70,23 @@ async function runMultiasistencia(ownerId, user, pass) {
|
|||||||
if (descHeader && descHeader.nextElementSibling) rawDesc = clean(descHeader.nextElementSibling.innerText);
|
if (descHeader && descHeader.nextElementSibling) rawDesc = clean(descHeader.nextElementSibling.innerText);
|
||||||
const idxDate = rawDesc.search(/\b\d{2}\/\d{2}\/\d{4}\b/);
|
const idxDate = rawDesc.search(/\b\d{2}\/\d{2}\/\d{4}\b/);
|
||||||
const cleanDesc = idxDate !== -1 ? rawDesc.substring(0, idxDate).trim() : rawDesc;
|
const cleanDesc = idxDate !== -1 ? rawDesc.substring(0, idxDate).trim() : rawDesc;
|
||||||
const rawCPField = findByCab("Distrito Postal") || "";
|
// ... (dentro de runMultiasistencia - evaluate)
|
||||||
const cpMatch = rawCPField.match(/\b\d{5}\b/);
|
const rawCPField = findByCab("Distrito Postal") || "";
|
||||||
const cpOnly = cpMatch ? cpMatch[0] : "";
|
const cpMatch = rawCPField.match(/\b\d{5}\b/);
|
||||||
const popOnly = rawCPField.replace(cpOnly, '').replace('-', '').trim();
|
const cpOnly = cpMatch ? cpMatch[0] : "";
|
||||||
const phoneMatch = body.match(/[6789]\d{8}/);
|
const popOnly = rawCPField.replace(cpOnly, '').replace('-', '').trim();
|
||||||
return {
|
|
||||||
"Expediente": findByCab("Número Reparación") || "",
|
return {
|
||||||
"Nombre Cliente": findByCab("Nombre Cliente") || "",
|
"Expediente": findByCab("Número Reparación") || "",
|
||||||
"Dirección": findByCab("Dirección") || "",
|
"Nombre Cliente": findByCab("Nombre Cliente") || "",
|
||||||
"Población": popOnly,
|
"Dirección": findByCab("Dirección") || "",
|
||||||
"Código Postal": cpOnly,
|
"Población": popOnly,
|
||||||
"Compañía": "MULTI - " + (findByCab("Procedencia") || "MULTIASISTENCIA"),
|
"Código Postal": cpOnly, // CAMPO RECUPERADO
|
||||||
"Descripción": cleanDesc,
|
"Compañía": "MULTI - " + (findByCab("Procedencia") || "MULTIASISTENCIA"),
|
||||||
"Teléfono": phoneMatch ? phoneMatch[0] : "",
|
"Descripción": cleanDesc,
|
||||||
"Urgente": findByCab("Urgente") || "No"
|
"Teléfono": phoneMatch ? phoneMatch[0] : "",
|
||||||
};
|
"Urgente": findByCab("Urgente") || "No"
|
||||||
|
};
|
||||||
});
|
});
|
||||||
if (scrapData && scrapData['Nombre Cliente']) break;
|
if (scrapData && scrapData['Nombre Cliente']) break;
|
||||||
} catch (e) { continue; }
|
} catch (e) { continue; }
|
||||||
|
|||||||
Reference in New Issue
Block a user