From fa8e3fa7e138b75f41112997f006ff22377a3d15 Mon Sep 17 00:00:00 2001 From: TPN Date: Sun, 7 Apr 2024 11:21:48 +0000 Subject: [PATCH] fix vidsrc --- .vscode/settings.json | 5 ++++- src/providers/embeds/vidsrc.ts | 27 +++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e4df0f2..1a2362a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,8 @@ { "editor.formatOnSave": true, "editor.defaultFormatter": "dbaeumer.vscode-eslint", - "eslint.format.enable": true + "eslint.format.enable": true, + "[typescript]": { + "editor.defaultFormatter": "vscode.typescript-language-features" + } } diff --git a/src/providers/embeds/vidsrc.ts b/src/providers/embeds/vidsrc.ts index 069c2f6..ae945d2 100644 --- a/src/providers/embeds/vidsrc.ts +++ b/src/providers/embeds/vidsrc.ts @@ -32,21 +32,24 @@ export const vidsrcembedScraper = makeEmbed({ if (!finalUrl.includes('.m3u8')) throw new Error('Unable to find HLS playlist'); let setPassLink = html.match(setPassRegex)?.[1]; - if (!setPassLink) throw new Error('Unable to find set_pass.php link'); - if (setPassLink.startsWith('//')) { - setPassLink = `https:${setPassLink}`; + // isn't neeeded, the stream works without it anyway + // shouldn't fail if the setpass link is not found + if (setPassLink) { + if (setPassLink.startsWith('//')) { + setPassLink = `https:${setPassLink}`; + } + + // VidSrc uses a password endpoint to temporarily whitelist the user's IP. This is called in an interval by the player. + // It currently has no effect on the player itself, the content plays fine without it. + // In the future we might have to introduce hooks for the frontend to call this endpoint. + await ctx.proxiedFetcher(setPassLink, { + headers: { + referer: ctx.url, + }, + }); } - // VidSrc uses a password endpoint to temporarily whitelist the user's IP. This is called in an interval by the player. - // It currently has no effect on the player itself, the content plays fine without it. - // In the future we might have to introduce hooks for the frontend to call this endpoint. - await ctx.proxiedFetcher(setPassLink, { - headers: { - referer: ctx.url, - }, - }); - return { stream: [ {