fix(extractor): bring back VixSrc language exclusion
This commit is contained in:
parent
26120d1662
commit
ac7d2480ea
6 changed files with 93 additions and 20 deletions
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
67
src/extractor/__fixtures__/VixSrc/https:vixsrc.totv4200943
generated
Normal file
67
src/extractor/__fixtures__/VixSrc/https:vixsrc.totv4200943
generated
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -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`] = `
|
||||
[
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue