From 56c50fbb2f80242ec80b080d37a972f3e3792a92 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 2 Nov 2022 11:25:21 +0000 Subject: [PATCH 1/4] Add flixhq provider Fully working movies provider, high quality m3u8 --- src/providers/list/flixhq/index.ts | 67 ++++++++++++++++++++++++++++++ src/providers/methods/providers.ts | 2 + 2 files changed, 69 insertions(+) create mode 100644 src/providers/list/flixhq/index.ts diff --git a/src/providers/list/flixhq/index.ts b/src/providers/list/flixhq/index.ts new file mode 100644 index 00000000..4c163322 --- /dev/null +++ b/src/providers/list/flixhq/index.ts @@ -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 { + const searchRes = await fetch( + `${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/info?id=${media.mediaId}` + ).then((d) => d.json()); + + return { + ...media, + title: searchRes.title, + year: searchRes.releaseDate, + } as MWProviderMediaResult; + }, + + async searchForMedia(query: MWQuery): Promise { + const searchRes = await fetch( + `${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/${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 { + const searchRes = await fetch( + `${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/info?id=${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; + }, +}; diff --git a/src/providers/methods/providers.ts b/src/providers/methods/providers.ts index 142f068b..1cabfbcc 100644 --- a/src/providers/methods/providers.ts +++ b/src/providers/methods/providers.ts @@ -3,12 +3,14 @@ import { gDrivePlayerScraper } from "providers/list/gdriveplayer"; import { MWWrappedMediaProvider, WrapProvider } from "providers/wrapper"; import { gomostreamScraper } from "providers/list/gomostream"; import { xemovieScraper } from "providers/list/xemovie"; +import { flixhqProvider } from "providers/list/flixhq"; export const mediaProvidersUnchecked: MWWrappedMediaProvider[] = [ WrapProvider(theFlixScraper), WrapProvider(gDrivePlayerScraper), WrapProvider(gomostreamScraper), WrapProvider(xemovieScraper), + WrapProvider(flixhqProvider), ]; export const mediaProviders: MWWrappedMediaProvider[] = From bb6e3638297cd56d0f4f744507d59e95aa4893f8 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Sat, 5 Nov 2022 09:14:00 +0000 Subject: [PATCH 2/4] URL encode all params --- src/providers/list/flixhq/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/providers/list/flixhq/index.ts b/src/providers/list/flixhq/index.ts index 4c163322..d192b8e7 100644 --- a/src/providers/list/flixhq/index.ts +++ b/src/providers/list/flixhq/index.ts @@ -17,7 +17,7 @@ export const flixhqProvider: MWMediaProvider = { async getMediaFromPortable(media: MWPortableMedia): Promise { const searchRes = await fetch( - `${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/info?id=${media.mediaId}` + `${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/info?id=${encodeURIComponent(media.mediaId)}` ).then((d) => d.json()); return { @@ -29,7 +29,7 @@ export const flixhqProvider: MWMediaProvider = { async searchForMedia(query: MWQuery): Promise { const searchRes = await fetch( - `${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/${query.searchQuery}` + `${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/${encodeURIComponent(query.searchQuery)}` ).then((d) => d.json()); const results: MWProviderMediaResult[] = (searchRes || []).results.map((item: any) => ({ @@ -44,7 +44,7 @@ export const flixhqProvider: MWMediaProvider = { async getStream(media: MWPortableMedia): Promise { const searchRes = await fetch( - `${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/info?id=${media.mediaId}` + `${CORS_PROXY_URL}https://api.consumet.org/movies/flixhq/info?id=${encodeURIComponent(media.mediaId)}` ).then((d) => d.json()); const params = new URLSearchParams({ From 90f8ad34187d9d5ed33cac1a87691192688a2a5e Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 16 Nov 2022 21:55:59 +0000 Subject: [PATCH 3/4] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 81a83bdb..c19818eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "movie-web", - "version": "2.0.3", + "version": "2.0.4", "private": true, "homepage": "https://movie.squeezebox.dev", "dependencies": { From 5bcb2947f9ded77e2a0222c37860b0dcaa7765d0 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 16 Nov 2022 21:56:47 +0000 Subject: [PATCH 4/4] Update mw_constants.ts --- src/mw_constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mw_constants.ts b/src/mw_constants.ts index 380ca64e..7f6200d7 100644 --- a/src/mw_constants.ts +++ b/src/mw_constants.ts @@ -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 DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb"; export const GITHUB_LINK = "https://github.com/JamesHawkinss/movie-web"; -export const APP_VERSION = "2.0.3"; +export const APP_VERSION = "2.0.4";