feat(source): bring back VidSrc as multi source
This reverts commit 1bd85fb4ad.
This commit is contained in:
parent
9354c0ee9b
commit
381fb89cfb
5 changed files with 79 additions and 2 deletions
23
src/source/VidSrc.test.ts
Normal file
23
src/source/VidSrc.test.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { createTestContext } from '../test';
|
||||
import { ImdbId } from '../utils';
|
||||
import { VidSrc } from './VidSrc';
|
||||
|
||||
const ctx = createTestContext();
|
||||
|
||||
describe('VidSrc', () => {
|
||||
let source: VidSrc;
|
||||
|
||||
beforeEach(() => {
|
||||
source = new VidSrc();
|
||||
});
|
||||
|
||||
test('handle imdb black mirror s4e2', async () => {
|
||||
const streams = await source.handle(ctx, 'series', new ImdbId('tt2085059', 4, 2));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('handle imdb full metal jacket', async () => {
|
||||
const streams = await source.handle(ctx, 'series', new ImdbId('tt0093058', undefined, undefined));
|
||||
expect(streams).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
24
src/source/VidSrc.ts
Normal file
24
src/source/VidSrc.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { ContentType } from 'stremio-addon-sdk';
|
||||
import { Context, CountryCode } from '../types';
|
||||
import { Id } from '../utils';
|
||||
import { Source, SourceResult } from './Source';
|
||||
|
||||
export class VidSrc extends Source {
|
||||
public readonly id = 'vidsrc';
|
||||
|
||||
public readonly label = 'VidSrc';
|
||||
|
||||
public readonly contentTypes: ContentType[] = ['movie', 'series'];
|
||||
|
||||
public readonly countryCodes: CountryCode[] = [CountryCode.multi];
|
||||
|
||||
public readonly baseUrl = 'https://vidsrc-embed.ru';
|
||||
|
||||
public async handleInternal(_ctx: Context, _type: string, id: Id): Promise<SourceResult[]> {
|
||||
const url = id.season
|
||||
? new URL(`/embed/tv/${id.id}/${id.season}-${id.episode}`, this.baseUrl)
|
||||
: new URL(`/embed/movie/${id.id}`, this.baseUrl);
|
||||
|
||||
return [{ url, meta: { countryCodes: [CountryCode.multi] } }];
|
||||
};
|
||||
}
|
||||
27
src/source/__snapshots__/VidSrc.test.ts.snap
Normal file
27
src/source/__snapshots__/VidSrc.test.ts.snap
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`VidSrc handle imdb black mirror s4e2 1`] = `
|
||||
[
|
||||
{
|
||||
"meta": {
|
||||
"countryCodes": [
|
||||
"multi",
|
||||
],
|
||||
},
|
||||
"url": "https://vidsrc-embed.ru/embed/tv/tt2085059/4-2",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`VidSrc handle imdb full metal jacket 1`] = `
|
||||
[
|
||||
{
|
||||
"meta": {
|
||||
"countryCodes": [
|
||||
"multi",
|
||||
],
|
||||
},
|
||||
"url": "https://vidsrc-embed.ru/embed/movie/tt0093058",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
|
@ -17,6 +17,7 @@ import { RgShows } from './RgShows';
|
|||
import { Source } from './Source';
|
||||
import { StreamKiste } from './StreamKiste';
|
||||
import { VerHdLink } from './VerHdLink';
|
||||
import { VidSrc } from './VidSrc';
|
||||
import { VixSrc } from './VixSrc';
|
||||
|
||||
export * from './Source';
|
||||
|
|
@ -31,6 +32,8 @@ export const createSources = (fetcher: Fetcher): Source[] => {
|
|||
new VixSrc(fetcher),
|
||||
// AL
|
||||
new Kokoshka(fetcher),
|
||||
// EN
|
||||
new VidSrc(),
|
||||
// ES / MX
|
||||
new CineHDPlus(fetcher),
|
||||
new Cuevana(fetcher),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ exports[`buildManifest default manifest 1`] = `
|
|||
"config": [
|
||||
{
|
||||
"key": "multi",
|
||||
"title": "Multi 🌐 (4KHDHub, RgShows, VixSrc)",
|
||||
"title": "Multi 🌐 (4KHDHub, RgShows, VidSrc, VixSrc)",
|
||||
"type": "checkbox",
|
||||
},
|
||||
{
|
||||
|
|
@ -86,7 +86,7 @@ exports[`buildManifest default manifest 1`] = `
|
|||
|
||||
Supported languages: Albanian, German, Castilian Spanish, French, Hindi, Italian, Latin American Spanish, Tamil, Telugu
|
||||
|
||||
Supported sources: 4KHDHub, RgShows, VixSrc, Kokoshka, CineHDPlus, Cuevana, HomeCine, VerHdLink, Einschalten, KinoGer, MegaKino, MeineCloud, StreamKiste, Frembed, FrenchCloud, Movix, Eurostreaming, MostraGuarda
|
||||
Supported sources: 4KHDHub, RgShows, VixSrc, Kokoshka, VidSrc, CineHDPlus, Cuevana, HomeCine, VerHdLink, Einschalten, KinoGer, MegaKino, MeineCloud, StreamKiste, Frembed, FrenchCloud, Movix, Eurostreaming, MostraGuarda
|
||||
|
||||
Supported extractors: ",
|
||||
"id": "webstreamr",
|
||||
|
|
|
|||
Loading…
Reference in a new issue