debug: add /api/events-debug/:artist endpoint to inspect raw Ticketmaster response

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-06-08 21:06:10 +02:00
1 parent 7fe755379b
commit d47a3404b3
1 file changed
+20
+20
View File
@@ -360,6 +360,26 @@ app.get('/api/events/:artist', (req, res) => {
}).on('error', e => { console.error('[events] request error:', e.message); res.json([]); }); }).on('error', e => { console.error('[events] request error:', e.message); res.json([]); });
}); });
// Debug-only: returns raw Ticketmaster response so you can see exactly what the API sends back.
// Visit /api/events-debug/Maduk in your browser to test.
app.get('/api/events-debug/:artist', (req, res) => {
const key = CONFIG.ticketmasterKey;
if (!key) return res.json({ error: 'TICKETMASTER_API_KEY not set in .env' });
const artist = req.params.artist;
const now = new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
const url = `https://app.ticketmaster.com/discovery/v2/events.json` +
`?keyword=${encodeURIComponent(artist)}&classificationName=music` +
`&startDateTime=${now}&size=5&sort=date,asc&apikey=${key}`;
https.get(url, { headers: { 'Accept': 'application/json' } }, upstream => {
let body = '';
upstream.on('data', d => body += d);
upstream.on('end', () => {
try { res.json({ status: upstream.statusCode, url: url.replace(key, 'KEY_HIDDEN'), body: JSON.parse(body) }); }
catch { res.json({ status: upstream.statusCode, raw: body.slice(0, 500) }); }
});
}).on('error', e => res.json({ error: e.message }));
});
app.get('/api/health', (req, res) => { app.get('/api/health', (req, res) => {
res.json({ res.json({
status: 'ok', ytdlpVersion, status: 'ok', ytdlpVersion,