From ac7d2480eaaf2def02870e614f3854ce25af0889 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Thu, 2 Oct 2025 15:37:47 +0000 Subject: [PATCH] fix(extractor): bring back VixSrc language exclusion --- src/extractor/VixSrc.test.ts | 2 +- src/extractor/VixSrc.ts | 6 +- ...3dc2f9b3dfda326d6andexpires1764603370andh1 | 17 +++++ .../VixSrc/https:vixsrc.totv4200943 | 67 +++++++++++++++++++ .../__snapshots__/VixSrc.test.ts.snap | 19 +----- src/utils/config.ts | 2 + 6 files changed, 93 insertions(+), 20 deletions(-) create mode 100644 src/extractor/__fixtures__/VixSrc/https:vixsrc.toplaylist307317.m3u8token490682762ade1403dc2f9b3dfda326d6andexpires1764603370andh1 create mode 100644 src/extractor/__fixtures__/VixSrc/https:vixsrc.totv4200943 diff --git a/src/extractor/VixSrc.test.ts b/src/extractor/VixSrc.test.ts index d833bdd..41214de 100644 --- a/src/extractor/VixSrc.test.ts +++ b/src/extractor/VixSrc.test.ts @@ -21,6 +21,6 @@ describe('VixSrc', () => { test('Black Mirror is excluded if no matching language was found', async () => { const ctx = createTestContext({ de: 'on' }); - expect(await extractorRegistry.handle(ctx, new URL('https://vixsrc.to/tv/42009/4/2'))).toMatchSnapshot(); + expect(await extractorRegistry.handle(ctx, new URL('https://vixsrc.to/tv/42009/4/3'))).toMatchSnapshot(); }); }); diff --git a/src/extractor/VixSrc.ts b/src/extractor/VixSrc.ts index 0a52578..c5a5ee3 100644 --- a/src/extractor/VixSrc.ts +++ b/src/extractor/VixSrc.ts @@ -1,7 +1,7 @@ import { Context, CountryCode, Format, Meta, UrlResult } from '../types'; import { CustomRequestInit, - guessHeightFromPlaylist, + guessHeightFromPlaylist, hasMultiEnabled, iso639FromCountryCode, } from '../utils'; import { Extractor } from './Extractor'; @@ -34,6 +34,10 @@ export class VixSrc extends Extractor { const countryCodes = await this.determineCountryCodesFromPlaylist(ctx, playlistUrl, { headers }); + if (!hasMultiEnabled(ctx.config) && !countryCodes.some(countryCode => countryCode in ctx.config)) { + return []; + } + return [ { url: playlistUrl, diff --git a/src/extractor/__fixtures__/VixSrc/https:vixsrc.toplaylist307317.m3u8token490682762ade1403dc2f9b3dfda326d6andexpires1764603370andh1 b/src/extractor/__fixtures__/VixSrc/https:vixsrc.toplaylist307317.m3u8token490682762ade1403dc2f9b3dfda326d6andexpires1764603370andh1 new file mode 100644 index 0000000..13f526c --- /dev/null +++ b/src/extractor/__fixtures__/VixSrc/https:vixsrc.toplaylist307317.m3u8token490682762ade1403dc2f9b3dfda326d6andexpires1764603370andh1 @@ -0,0 +1,17 @@ +#EXTM3U +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="Italian",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="ita",URI="https://vixsrc.to/playlist/307317?type=audio&rendition=ita&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="English",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="eng",URI="https://vixsrc.to/playlist/307317?type=audio&rendition=eng&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English [CC]",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="eng",URI="https://vixsrc.to/playlist/307317?type=subtitle&rendition=3-eng&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="German",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="ger",URI="https://vixsrc.to/playlist/307317?type=subtitle&rendition=4-ger&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="French [CC]",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="fre",URI="https://vixsrc.to/playlist/307317?type=subtitle&rendition=5-fre&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="French",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="fre",URI="https://vixsrc.to/playlist/307317?type=subtitle&rendition=6-fre&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Italian [Forced]",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="forced-ita",URI="https://vixsrc.to/playlist/307317?type=subtitle&rendition=7-forced-ita&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Italian",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="ita",URI="https://vixsrc.to/playlist/307317?type=subtitle&rendition=8-ita&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Japanese",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="jpn",URI="https://vixsrc.to/playlist/307317?type=subtitle&rendition=9-jpn&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Ukrainian",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="ukr",URI="https://vixsrc.to/playlist/307317?type=subtitle&rendition=10-ukr&token=sLMeTlpX42bE_-gRKOl5Yg&expires=1764603370&edge=sc-u14-01" +#EXT-X-STREAM-INF:BANDWIDTH=1200000,CODECS="avc1.640028,mp4a.40.2",RESOLUTION=854x480,AUDIO="audio",SUBTITLES="subs" +https://vixsrc.to/playlist/307317?type=video&rendition=480p&token=gQSTIJXRfTS9VJgJivZCsA&expires=1764603370&edge=sc-u14-01 +#EXT-X-STREAM-INF:BANDWIDTH=2150000,CODECS="avc1.640028,mp4a.40.2",RESOLUTION=1280x720,AUDIO="audio",SUBTITLES="subs" +https://vixsrc.to/playlist/307317?type=video&rendition=720p&token=vSeyIFZy-RAkQUF899pHAQ&expires=1764603370&edge=sc-u14-01 +#EXT-X-STREAM-INF:BANDWIDTH=4500000,CODECS="avc1.640028,mp4a.40.2",RESOLUTION=1920x1080,AUDIO="audio",SUBTITLES="subs" +https://vixsrc.to/playlist/307317?type=video&rendition=1080p&token=Kkh_YHe465c_f-8YPn5UxA&expires=1764603370&edge=sc-u14-01 \ No newline at end of file diff --git a/src/extractor/__fixtures__/VixSrc/https:vixsrc.totv4200943 b/src/extractor/__fixtures__/VixSrc/https:vixsrc.totv4200943 new file mode 100644 index 0000000..2f2c612 --- /dev/null +++ b/src/extractor/__fixtures__/VixSrc/https:vixsrc.totv4200943 @@ -0,0 +1,67 @@ + + + + + + 307317 + + + + + + + + + + + + +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/extractor/__snapshots__/VixSrc.test.ts.snap b/src/extractor/__snapshots__/VixSrc.test.ts.snap index f46ef1b..dfe02a7 100644 --- a/src/extractor/__snapshots__/VixSrc.test.ts.snap +++ b/src/extractor/__snapshots__/VixSrc.test.ts.snap @@ -19,24 +19,7 @@ exports[`VixSrc Black Mirror 1`] = ` ] `; -exports[`VixSrc Black Mirror is excluded if no matching language was found 1`] = ` -[ - { - "format": "hls", - "label": "VixSrc", - "meta": { - "countryCodes": [ - "it", - "en", - ], - "height": 1080, - }, - "sourceId": "vixsrc_", - "ttl": 21600000, - "url": "https://vixsrc.to/playlist/307316.m3u8?token=5e3c2b315b1eee966c5261902e02d3b4&expires=1764445261&h=1", - }, -] -`; +exports[`VixSrc Black Mirror is excluded if no matching language was found 1`] = `[]`; exports[`VixSrc Full Metal Jacket 1`] = ` [ diff --git a/src/utils/config.ts b/src/utils/config.ts index 94ae3df..2702554 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -11,6 +11,8 @@ export const showExternalUrls = (config: Config): boolean => 'includeExternalUrl export const noCache = (config: Config): boolean => 'noCache' in config; +export const hasMultiEnabled = (config: Config): boolean => 'multi' in config; + export const disableExtractorConfigKey = (extractor: Extractor): string => `disableExtractor_${extractor.id}`; export const isExtractorDisabled = (config: Config, extractor: Extractor): boolean => disableExtractorConfigKey(extractor) in config;