From 783c4b5d5a02e47273524e9d71c3c21cec57a126 Mon Sep 17 00:00:00 2001 From: leoca Date: Wed, 14 Oct 2026 01:06:34 +0000 Subject: [PATCH] fix: don't abort playlist:format on an unparseable .mpd response getStreamInfo() already ignores .m3u8 responses that hls-parser cannot read, but the .mpd branch let parseManifest() throw. A stream URL ending in .mpd that answers 200 with an HTML page makes mpd-parser throw DASH_INVALID_XML, which rejects inside eachLimit and kills playlist:format before anything is saved. playlist:update hits the same path when adding a stream. --- scripts/utils.ts | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/scripts/utils.ts b/scripts/utils.ts index 66997adc78..891f7ad6e5 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -175,22 +175,26 @@ export async function getStreamInfo( // do nothing } } else if (url.includes('.mpd')) { - const manifest = parseManifest(data, { - manifestUri: url, - eventHandler: ({ type, message }) => console.log(`${type}: ${message}`) - }) + try { + const manifest = parseManifest(data, { + manifestUri: url, + eventHandler: ({ type, message }) => console.log(`${type}: ${message}`) + }) - const playlist = orderBy(manifest.playlists, [p => p.attributes.BANDWIDTH], ['desc'])[0] + const playlist = orderBy(manifest.playlists, [p => p.attributes.BANDWIDTH], ['desc'])[0] - if (playlist) { - const attr = playlist.attributes + if (playlist) { + const attr = playlist.attributes - info = { - resolution: { width: attr.RESOLUTION.width, height: attr.RESOLUTION.height }, - bandwidth: attr.BANDWIDTH, - frameRate: attr['FRAME-RATE'], - codecs: attr.CODECS + info = { + resolution: { width: attr.RESOLUTION.width, height: attr.RESOLUTION.height }, + bandwidth: attr.BANDWIDTH, + frameRate: attr['FRAME-RATE'], + codecs: attr.CODECS + } } + } catch { + // do nothing } }