fix: KoePi loggt jetzt alle Angebote (nicht nur das erste), leafletflights-Diagnose entfernt
This commit is contained in:
@@ -118,33 +118,9 @@ async function fetchOffersViaApi() {
|
||||
|
||||
console.log('🍺 KöPi API: totalResults=', json.totalResults, '| results.length=', json.results?.length);
|
||||
if (json.results?.[0]) {
|
||||
console.log('🍺 KöPi API Rohdaten (erster Treffer, VOLLSTÄNDIG):', JSON.stringify(json.results[0]));
|
||||
}
|
||||
|
||||
// Reine Diagnose (rein informativ, wirft bei Fehlschlag keinen Fehler für den
|
||||
// Hauptablauf): probiert, ob der leafletflights-Endpoint zusätzliche
|
||||
// Store-/Adressinfos zu den gefundenen Prospekt-Kampagnen liefert
|
||||
try {
|
||||
const flightIds = [...new Set((json.results || []).map(r => r.leafletFlightId).filter(Boolean))];
|
||||
if (flightIds.length) {
|
||||
const flightUrl = `https://api.marktguru.de/api/v1/leafletflights?as=mobile&limit=8&zipCode=${MG_ZIP}`;
|
||||
const flightRes = await fetch(flightUrl, {
|
||||
headers: {
|
||||
'x-clientkey': MARKTGURU_CLIENT_KEY,
|
||||
'x-apikey': MARKTGURU_API_KEY,
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
});
|
||||
console.log('🍺 KöPi leafletflights-Diagnose: HTTP', flightRes.status);
|
||||
if (flightRes.ok) {
|
||||
const flightJson = await flightRes.json();
|
||||
console.log('🍺 KöPi leafletflights-Diagnose Rohdaten (VOLLSTÄNDIG):', JSON.stringify(flightJson).slice(0, 4000));
|
||||
} else {
|
||||
console.log('🍺 KöPi leafletflights-Diagnose Body:', (await flightRes.text().catch(()=>'')).slice(0, 500));
|
||||
}
|
||||
}
|
||||
} catch (diagErr) {
|
||||
console.log('🍺 KöPi leafletflights-Diagnose fehlgeschlagen (ignoriert):', diagErr.message);
|
||||
(json.results || []).forEach((r, i) => {
|
||||
console.log(`🍺 KöPi API Rohdaten [${i}] (${r.advertisers?.[0]?.name || '?'}, € ${r.price}):`, JSON.stringify(r));
|
||||
});
|
||||
}
|
||||
|
||||
return (json.results || []).map(r => {
|
||||
|
||||
Reference in New Issue
Block a user