debug: xREL debug-endpoint temporär
This commit is contained in:
@@ -307,3 +307,39 @@ router.put('/settings', authenticate, requireAdmin, (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
||||||
|
// DEBUG – temporär, nach Test entfernen
|
||||||
|
router.get('/debug-xrel', authenticate, async (req, res) => {
|
||||||
|
const title = req.query.title || 'Mandalorian';
|
||||||
|
const log = [];
|
||||||
|
try {
|
||||||
|
// Step 1: ext_info search
|
||||||
|
const searchUrl = `${XREL_BASE}/search/ext_info.json?q=${encodeURIComponent(title)}&type=movie&limit=5`;
|
||||||
|
log.push({ step: 'search_url', url: searchUrl });
|
||||||
|
const searchRes = await fetch(searchUrl, { headers: { Accept: 'application/json' }, signal: AbortSignal.timeout(6000) });
|
||||||
|
log.push({ step: 'search_status', status: searchRes.status });
|
||||||
|
const searchData = await searchRes.json();
|
||||||
|
log.push({ step: 'search_response', data: searchData });
|
||||||
|
|
||||||
|
if (searchData.results?.length) {
|
||||||
|
const extInfoId = searchData.results[0].id;
|
||||||
|
log.push({ step: 'ext_info_id', id: extInfoId });
|
||||||
|
|
||||||
|
// Step 2a: Scene releases
|
||||||
|
const sceneUrl = `${XREL_BASE}/release/ext_info.json?id=${extInfoId}&per_page=5`;
|
||||||
|
const sceneRes = await fetch(sceneUrl, { headers: { Accept: 'application/json' }, signal: AbortSignal.timeout(6000) });
|
||||||
|
const sceneData = await sceneRes.json();
|
||||||
|
log.push({ step: 'scene_releases', status: sceneRes.status, keys: Object.keys(sceneData), sample: JSON.stringify(sceneData).slice(0, 500) });
|
||||||
|
|
||||||
|
// Step 2b: P2P releases
|
||||||
|
const p2pUrl = `${XREL_BASE}/p2p/releases.json?ext_info_id=${extInfoId}&per_page=5`;
|
||||||
|
const p2pRes = await fetch(p2pUrl, { headers: { Accept: 'application/json' }, signal: AbortSignal.timeout(6000) });
|
||||||
|
const p2pData = await p2pRes.json();
|
||||||
|
log.push({ step: 'p2p_releases', status: p2pRes.status, keys: Object.keys(p2pData), sample: JSON.stringify(p2pData).slice(0, 500) });
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log.push({ step: 'error', message: e.message });
|
||||||
|
}
|
||||||
|
res.json(log);
|
||||||
|
});
|
||||||
|
module.exports = router;
|
||||||
|
|||||||
Reference in New Issue
Block a user