feat(source): add Einschalten

This commit is contained in:
WebStreamr 2025-08-19 09:50:04 +00:00
parent 2d9f9bf1af
commit b6a8e6f448
No known key found for this signature in database
6 changed files with 68 additions and 1 deletions

View file

@ -0,0 +1,18 @@
import { createTestContext } from '../test';
import { FetcherMock, TmdbId } from '../utils';
import { Einschalten } from './Einschalten';
const ctx = createTestContext({ de: 'on' });
describe('Einschalten', () => {
let source: Einschalten;
beforeEach(() => {
source = new Einschalten(new FetcherMock(`${__dirname}/__fixtures__/Einschalten`));
});
test('handle superman', async () => {
const streams = await source.handle(ctx, 'movie', new TmdbId(1061474, undefined, undefined));
expect(streams).toMatchSnapshot();
});
});

35
src/source/Einschalten.ts Normal file
View file

@ -0,0 +1,35 @@
import { ContentType } from 'stremio-addon-sdk';
import { Context, CountryCode } from '../types';
import { Fetcher, getTmdbId, Id } from '../utils';
import { Source, SourceResult } from './types';
interface EinschaltenResponse {
releaseName: string;
streamUrl: string;
}
export class Einschalten implements Source {
public readonly id = 'einschalten';
public readonly label = 'Einschalten';
public readonly contentTypes: ContentType[] = ['movie'];
public readonly countryCodes: CountryCode[] = [CountryCode.de];
public readonly baseUrl = 'https://einschalten.in';
private readonly fetcher: Fetcher;
public constructor(fetcher: Fetcher) {
this.fetcher = fetcher;
}
public async handle(ctx: Context, _type: string, id: Id): Promise<SourceResult[]> {
const tmdbId = await getTmdbId(ctx, this.fetcher, id);
const { releaseName, streamUrl } = JSON.parse(await this.fetcher.text(ctx, new URL(`/api/movies/${tmdbId.id}/watch`, this.baseUrl))) as EinschaltenResponse;
return [{ countryCode: CountryCode.de, title: releaseName, url: new URL(streamUrl) }];
};
}

View file

@ -0,0 +1 @@
{"releaseName":"Superman.2025.German.DL.720p.WEB.H264-ZeroTwo","streamUrl":"https://vide0.net/e/qtvqjblhu74i"}

View file

@ -0,0 +1,11 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`Einschalten handle superman 1`] = `
[
{
"countryCode": "de",
"title": "Superman.2025.German.DL.720p.WEB.H264-ZeroTwo",
"url": "https://vide0.net/e/qtvqjblhu74i",
},
]
`;

View file

@ -1,6 +1,7 @@
import { Fetcher } from '../utils';
import { CineHDPlus } from './CineHDPlus';
import { Cuevana } from './Cuevana';
import { Einschalten } from './Einschalten';
import { Eurostreaming } from './Eurostreaming';
import { Frembed } from './Frembed';
import { FrenchCloud } from './FrenchCloud';
@ -34,6 +35,7 @@ export const createSources = (fetcher: Fetcher): Source[] => [
new HomeCine(fetcher),
new VerHdLink(fetcher),
// DE
new Einschalten(fetcher),
new KinoGer(fetcher),
new MegaKino(fetcher),
new MeineCloud(fetcher),

View file

@ -16,7 +16,7 @@ exports[`buildManifest default manifest 1`] = `
},
{
"key": "de",
"title": "German 🇩🇪 (KinoGer, MegaKino, MeineCloud, StreamKiste)",
"title": "German 🇩🇪 (Einschalten, KinoGer, MegaKino, MeineCloud, StreamKiste)",
"type": "checkbox",
},
{