fix: bypass Corgi WMI in VIN decode chain + misc integrations
- vehicles.service.ts: remove Corgi from resolveVin chain; go straight to PartsCatalogs → PL24 → EMEX without offline WMI lookup - End condition simplified: return null only when EMEX also fails (no corgiKnown fallback) - Add scripts/test-emex-http.mjs: proxy timing test for EMEX HTTP decode Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
69
scripts/test-emex-http.mjs
Normal file
69
scripts/test-emex-http.mjs
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* EMEX HTTP decode timing test
|
||||
* Usage: node scripts/test-emex-http.mjs
|
||||
*/
|
||||
import { ProxyAgent } from "/home/s/ss/node_modules/.pnpm/undici@7.22.0/node_modules/undici/index.js";
|
||||
|
||||
const VIN = "WDD1173431N193569";
|
||||
const EMEX_BASE_URL = "https://emexdwc.ae";
|
||||
const UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";
|
||||
|
||||
// Same proxy config as emex.service.ts defaults
|
||||
const PROXY_HOST = "74.81.81.81";
|
||||
const PROXY_PORT_START = 10001;
|
||||
const PROXY_PORT_END = 10099;
|
||||
const PROXY_USER = "1726bbe361918676d44e";
|
||||
const PROXY_PASS = "f11c7b6128cc86c6";
|
||||
|
||||
const port = Math.floor(Math.random() * (PROXY_PORT_END - PROXY_PORT_START + 1)) + PROXY_PORT_START;
|
||||
const proxyUri = `http://${PROXY_USER}:${PROXY_PASS}@${PROXY_HOST}:${port}`;
|
||||
|
||||
console.log(`VIN : ${VIN}`);
|
||||
console.log(`Proxy : ${PROXY_HOST}:${port}`);
|
||||
console.log(`URL : ${EMEX_BASE_URL}/Vehicles.aspx?ft=findByVIN&c=&ssd=&vin=${VIN}`);
|
||||
console.log("─".repeat(50));
|
||||
|
||||
const agent = new ProxyAgent({
|
||||
uri: proxyUri,
|
||||
connect: { timeout: 30000 },
|
||||
requestTls: { timeout: 30000 },
|
||||
});
|
||||
|
||||
const url = `${EMEX_BASE_URL}/Vehicles.aspx?ft=findByVIN&c=&ssd=&vin=${VIN}`;
|
||||
|
||||
const t0 = Date.now();
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
headers: { "User-Agent": UA, Accept: "text/html,application/xhtml+xml" },
|
||||
signal: AbortSignal.timeout(60000),
|
||||
dispatcher: agent,
|
||||
});
|
||||
|
||||
const elapsed = Date.now() - t0;
|
||||
const html = await res.text();
|
||||
|
||||
console.log(`HTTP status : ${res.status}`);
|
||||
console.log(`Süre : ${elapsed} ms`);
|
||||
console.log(`Response : ${html.length} bytes`);
|
||||
|
||||
// Araç listesini parse et
|
||||
const linkRx = /href="(Vehicle\.aspx\?[^"]+)">([^<]+)<\/a>/g;
|
||||
const matches = [];
|
||||
let m;
|
||||
while ((m = linkRx.exec(html)) !== null) {
|
||||
matches.push(m[2].trim());
|
||||
}
|
||||
|
||||
if (matches.length > 0) {
|
||||
console.log(`\nBulunan araçlar (${matches.length}):`);
|
||||
matches.forEach((v, i) => console.log(` [${i}] ${v}`));
|
||||
} else {
|
||||
console.log("\nAraç bulunamadı (boş sonuç).");
|
||||
// Ham HTML'in ilk 500 karakterini göster
|
||||
console.log("\nHTML (ilk 500 kar):");
|
||||
console.log(html.slice(0, 500));
|
||||
}
|
||||
} catch (err) {
|
||||
const elapsed = Date.now() - t0;
|
||||
console.error(`HATA (${elapsed} ms): ${err.message}`);
|
||||
}
|
||||
Reference in New Issue
Block a user