Merge pull request #90 from JamesHawkinss/dev

Add new provider: flixhq
This commit is contained in:
James Hawkins 2022-11-16 21:58:33 +00:00 committed by GitHub
commit b0822c8ad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "movie-web", "name": "movie-web",
"version": "2.0.3", "version": "2.0.4",
"private": true, "private": true,
"homepage": "https://movie.squeezebox.dev", "homepage": "https://movie.squeezebox.dev",
"dependencies": { "dependencies": {

View File

@ -2,4 +2,4 @@ export const CORS_PROXY_URL = "https://proxy-1.movie-web.workers.dev/?destinatio
export const OMDB_API_KEY = "aa0937c0"; export const OMDB_API_KEY = "aa0937c0";
export const DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb"; export const DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb";
export const GITHUB_LINK = "https://github.com/JamesHawkinss/movie-web"; export const GITHUB_LINK = "https://github.com/JamesHawkinss/movie-web";
export const APP_VERSION = "2.0.3"; export const APP_VERSION = "2.0.4";

View File

@ -0,0 +1,67 @@
import {
MWMediaProvider,
MWMediaType,
MWPortableMedia,
MWMediaStream,
MWQuery,
MWProviderMediaResult
} from "providers/types";
import { CORS_PROXY_URL } from "mw_constants";
export const flixhqProvider: MWMediaProvider = {
id: "flixhq",
enabled: true,
type: [MWMediaType.MOVIE],
displayName: "flixhq",
async getMediaFromPortable(media: MWPortableMedia): Promise<MWProviderMediaResult> {
const searchRes = await fetch(
`${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/info?id=${encodeURIComponent(media.mediaId)}`
).then((d) => d.json());
return {
...media,
title: searchRes.title,
year: searchRes.releaseDate,
} as MWProviderMediaResult;
},
async searchForMedia(query: MWQuery): Promise<MWProviderMediaResult[]> {
const searchRes = await fetch(
`${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/${encodeURIComponent(query.searchQuery)}`
).then((d) => d.json());
const results: MWProviderMediaResult[] = (searchRes || []).results.map((item: any) => ({
title: item.title,
year: item.releaseDate,
mediaId: item.id,
type: MWMediaType.MOVIE,
}));
return results;
},
async getStream(media: MWPortableMedia): Promise<MWMediaStream> {
const searchRes = await fetch(
`${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/info?id=${encodeURIComponent(media.mediaId)}`
).then((d) => d.json());
const params = new URLSearchParams({
episodeId: searchRes.episodes[0].id,
mediaId: media.mediaId
})
const watchRes = await fetch(
`${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/watch?${encodeURIComponent(params.toString())}`
).then((d) => d.json());
const source = watchRes.sources.reduce((p: any, c: any) => (c.quality > p.quality) ? c : p);
return {
url: source.url,
type: source.isM3U8 ? "m3u8" : "mp4",
captions: []
} as MWMediaStream;
},
};

View File

@ -3,12 +3,14 @@ import { gDrivePlayerScraper } from "providers/list/gdriveplayer";
import { MWWrappedMediaProvider, WrapProvider } from "providers/wrapper"; import { MWWrappedMediaProvider, WrapProvider } from "providers/wrapper";
import { gomostreamScraper } from "providers/list/gomostream"; import { gomostreamScraper } from "providers/list/gomostream";
import { xemovieScraper } from "providers/list/xemovie"; import { xemovieScraper } from "providers/list/xemovie";
import { flixhqProvider } from "providers/list/flixhq";
export const mediaProvidersUnchecked: MWWrappedMediaProvider[] = [ export const mediaProvidersUnchecked: MWWrappedMediaProvider[] = [
WrapProvider(theFlixScraper), WrapProvider(theFlixScraper),
WrapProvider(gDrivePlayerScraper), WrapProvider(gDrivePlayerScraper),
WrapProvider(gomostreamScraper), WrapProvider(gomostreamScraper),
WrapProvider(xemovieScraper), WrapProvider(xemovieScraper),
WrapProvider(flixhqProvider),
]; ];
export const mediaProviders: MWWrappedMediaProvider[] = export const mediaProviders: MWWrappedMediaProvider[] =