From 7f470070d91b7c05f3898ef0d3adcbd1f9fa6208 Mon Sep 17 00:00:00 2001 From: Dicken Date: Fri, 19 Jun 2026 22:15:29 +0200 Subject: [PATCH] =?UTF-8?q?debug:=20Tudum-Fetch=20und=20Regex-Parsing-Erge?= =?UTF-8?q?bnis=20pr=C3=BCfen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/tools/media/routes.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/backend/src/tools/media/routes.js b/backend/src/tools/media/routes.js index 0f2d724..050003d 100644 --- a/backend/src/tools/media/routes.js +++ b/backend/src/tools/media/routes.js @@ -945,6 +945,37 @@ router.get('/streaming/debug/:providerId', authenticate, requireAdmin, async (re } catch(e) { res.status(500).json({ error: e.message }); } }); +// Debug: rohen Tudum-Abruf + Parsing-Ergebnis prüfen +router.get('/streaming/debug-tudum/:mediaKind', authenticate, requireAdmin, async (req, res) => { + const mediaKind = req.params.mediaKind === 'tv' ? 'tv' : 'movie'; + try { + const path = mediaKind === 'tv' ? '/germany/tv' : '/germany'; + const resp = await fetch(`https://www.netflix.com/tudum/top10${path}`, { + headers: { 'User-Agent': 'Mozilla/5.0 (compatible; DickenDock/1.0)' }, + signal: AbortSignal.timeout(8000), + }); + const html = await resp.text(); + + const tableSection = html.split(/Top 10 (?:Shows|Movies) in Germany overview/i)[1] || ''; + const lineMatches = [...tableSection.matchAll(/\|\s*(\d{2})!\[[^\]]*\]\([^)]*\)([^|]+?)\s*\|\s*(\d+)\s*\|/g)]; + + const altMatches = [...html.matchAll(/!\[([^\]]+?)(?::\s*(?:Limited Series|Season \d+))?\]\([^)]*\)[\s\S]{0,80}?#(\d{1,2}) in (?:Shows|Movies)/g)]; + + res.json({ + httpStatus: resp.status, + htmlLength: html.length, + hasOverviewSection: tableSection.length > 0, + tableSectionPreview: tableSection.slice(0, 500), + lineMatchesCount: lineMatches.length, + lineMatchesSample: lineMatches.slice(0, 3).map(m => ({ rank: m[1], title: m[2], weeks: m[3] })), + altMatchesCount: altMatches.length, + altMatchesSample: altMatches.slice(0, 5).map(m => ({ title: m[1], rank: m[2] })), + }); + } catch (e) { + res.status(500).json({ error: e.message, stack: e.stack }); + } +}); + router.post('/streaming/clear-cache', authenticate, requireAdmin, (req, res) => { const r = db.prepare("DELETE FROM xrel_cache WHERE cache_key LIKE 'streaming-top10:%'").run(); res.json({ ok: true, cleared: r.changes });