fix(extractor): make VixSrc fall back to multi instead of it if language cannot be determined

This commit is contained in:
WebStreamr 2026-01-15 09:48:55 +00:00
parent 5103be82a4
commit ce11a80ba9
No known key found for this signature in database
5 changed files with 106 additions and 10 deletions

View file

@ -7,7 +7,7 @@ import { VixSrc } from './VixSrc';
const logger = winston.createLogger({ transports: [new winston.transports.Console({ level: 'nope' })] });
const extractorRegistry = new ExtractorRegistry(logger, [new VixSrc(new FetcherMock(`${__dirname}/__fixtures__/VixSrc`))]);
const ctx = createTestContext({ de: 'on', en: 'on', it: 'on' });
const ctx = createTestContext();
describe('VixSrc', () => {
test('Full Metal Jacket', async () => {
@ -18,6 +18,10 @@ describe('VixSrc', () => {
expect(await extractorRegistry.handle(ctx, new URL('https://vixsrc.to/tv/42009/4/2'))).toMatchSnapshot();
});
test('Rental Family', async () => {
expect(await extractorRegistry.handle(ctx, new URL('https://vixsrc.to/movie/1208348'))).toMatchSnapshot();
});
test('Black Mirror is excluded if no matching language was found', async () => {
const ctx = createTestContext({ de: 'on' });

View file

@ -1,9 +1,5 @@
import { Context, CountryCode, Format, Meta, UrlResult } from '../types';
import {
CustomRequestConfig,
guessHeightFromPlaylist, hasMultiEnabled,
iso639FromCountryCode,
} from '../utils';
import { CustomRequestConfig, guessHeightFromPlaylist, hasMultiEnabled, iso639FromCountryCode } from '../utils';
import { Extractor } from './Extractor';
export class VixSrc extends Extractor {
@ -46,7 +42,7 @@ export class VixSrc extends Extractor {
ttl: this.ttl,
meta: {
...meta,
countryCodes,
countryCodes: countryCodes.length ? countryCodes : [CountryCode.multi],
height: meta.height ?? await guessHeightFromPlaylist(ctx, this.fetcher, playlistUrl, { headers }),
},
},
@ -56,7 +52,7 @@ export class VixSrc extends Extractor {
private async determineCountryCodesFromPlaylist(ctx: Context, playlistUrl: URL, init?: CustomRequestConfig): Promise<CountryCode[]> {
const playlist = await this.fetcher.text(ctx, playlistUrl, init);
const countryCodes: CountryCode[] = [CountryCode.it];
const countryCodes: CountryCode[] = [];
(Object.keys(CountryCode) as CountryCode[]).forEach((countryCode) => {
const iso639 = iso639FromCountryCode(countryCode);

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,11 @@
#EXTM3U
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English [CC]",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="eng",URI="https://vixsrc.to/playlist/612252?type=subtitle&rendition=eng-2&token=A4DdWVOC-Zk7oVrYIQU3bA&expires=1773654453&edge=sc-u9-01"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English [Forced]",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="eng-forced",URI="https://vixsrc.to/playlist/612252?type=subtitle&rendition=eng-forced-3&token=A4DdWVOC-Zk7oVrYIQU3bA&expires=1773654453&edge=sc-u9-01"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="French",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="fre",URI="https://vixsrc.to/playlist/612252?type=subtitle&rendition=fre-4&token=A4DdWVOC-Zk7oVrYIQU3bA&expires=1773654453&edge=sc-u9-01"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Spanish",DEFAULT=NO,AUTOSELECT=NO,FORCED=NO,LANGUAGE="spa",URI="https://vixsrc.to/playlist/612252?type=subtitle&rendition=spa-5&token=A4DdWVOC-Zk7oVrYIQU3bA&expires=1773654453&edge=sc-u9-01"
#EXT-X-STREAM-INF:BANDWIDTH=4500000,CODECS="avc1.640028,mp4a.40.2",RESOLUTION=1920x1080,SUBTITLES="subs"
https://vixsrc.to/playlist/612252?type=video&rendition=1080p&token=ILslAWZ4iHG13XwOYOr42g&expires=1773654453&edge=sc-u9-01
#EXT-X-STREAM-INF:BANDWIDTH=1800000,CODECS="avc1.64001f,mp4a.40.2",RESOLUTION=1280x720,SUBTITLES="subs"
https://vixsrc.to/playlist/612252?type=video&rendition=720p&token=9LPJeLV-X45xQ9bKCLyYFA&expires=1773654453&edge=sc-u9-01
#EXT-X-STREAM-INF:BANDWIDTH=720000,CODECS="avc1.640015,mp4a.40.2",RESOLUTION=640x360,SUBTITLES="subs"
https://vixsrc.to/playlist/612252?type=video&rendition=360p&token=CQDIdX_LN3QdQ9yFRDMNlA&expires=1773654453&edge=sc-u9-01

View file

@ -7,8 +7,8 @@ exports[`VixSrc Black Mirror 1`] = `
"label": "VixSrc",
"meta": {
"countryCodes": [
"it",
"en",
"it",
],
"extractorId": "vixsrc",
"height": 1080,
@ -28,8 +28,8 @@ exports[`VixSrc Full Metal Jacket 1`] = `
"label": "VixSrc",
"meta": {
"countryCodes": [
"it",
"en",
"it",
],
"extractorId": "vixsrc",
"height": 1080,
@ -39,3 +39,21 @@ exports[`VixSrc Full Metal Jacket 1`] = `
},
]
`;
exports[`VixSrc Rental Family 1`] = `
[
{
"format": "hls",
"label": "VixSrc",
"meta": {
"countryCodes": [
"multi",
],
"extractorId": "vixsrc",
"height": 1080,
},
"ttl": 21600000,
"url": "https://vixsrc.to/playlist/612252.m3u8?token=d4118614964ebe7f00430371d305378d&expires=1773654453&h=1",
},
]
`;