From 2a4aa2a68041d7e6104a386c25ca78b17350c694 Mon Sep 17 00:00:00 2001 From: himanshu8443 Date: Mon, 16 Jun 2025 22:26:38 +0530 Subject: [PATCH] renaming --- providers/autoEmbed/allCatalog.ts | 20 -- providers/autoEmbed/catalog.ts | 20 ++ providers/autoEmbed/index.ts | 14 - .../autoEmbed/{allGetInfo.ts => meta.ts} | 52 ++-- .../autoEmbed/{allGetPost.ts => posts.ts} | 24 +- .../autoEmbed/{allGetStream.ts => stream.ts} | 210 ++++++------- providers/cinemaLuxe/catalog.ts | 20 ++ providers/cinemaLuxe/clCatalog.ts | 20 -- .../{clGetEpisodes.ts => episodes.ts} | 38 +-- providers/cinemaLuxe/index.ts | 16 - .../cinemaLuxe/{clGetMeta.ts => meta.ts} | 40 +-- .../cinemaLuxe/{clGetPosts.ts => posts.ts} | 32 +- .../cinemaLuxe/{clGetSteam.ts => stream.ts} | 20 +- providers/dooflix/catalog.ts | 12 + providers/dooflix/dooCatalog.ts | 12 - providers/dooflix/index.ts | 14 - providers/dooflix/{dooGetInfo.ts => meta.ts} | 54 ++-- .../dooflix/{dooGetPosts.ts => posts.ts} | 74 ++--- .../dooflix/{dooGetSteam.ts => stream.ts} | 20 +- providers/drive/catalog.ts | 60 ++-- .../{driveGetEpisodesList.ts => episodes.ts} | 14 +- providers/drive/index.ts | 16 - providers/drive/{driveGetInfo.ts => meta.ts} | 64 ++-- .../drive/{driveGetPosts.ts => posts.ts} | 34 +-- .../drive/{driveGetStream.ts => stream.ts} | 28 +- providers/filmyfly/catalog.ts | 16 + .../{ffGetEpisodes.ts => episodes.ts} | 18 +- providers/filmyfly/ffCatalog.ts | 16 - providers/filmyfly/ffGetMeta.ts | 56 ---- providers/filmyfly/index.ts | 16 - providers/filmyfly/meta.ts | 56 ++++ .../filmyfly/{ffGetPosts.ts => posts.ts} | 32 +- .../filmyfly/{ffGetStream.ts => stream.ts} | 26 +- providers/flixhq/catalog.ts | 16 + providers/flixhq/flixhqCatalog.ts | 16 - providers/flixhq/index.ts | 25 -- .../flixhq/{flixhqGetInfo.ts => meta.ts} | 32 +- .../flixhq/{flixhqGetPosts.ts => posts.ts} | 28 +- .../flixhq/{flixhqGetStream.ts => stream.ts} | 26 +- providers/guardahd/catalog.ts | 12 + providers/guardahd/guardahdCatalog.ts | 12 - providers/guardahd/guardahdGetPosts.ts | 44 --- providers/guardahd/index.ts | 15 - providers/guardahd/meta.ts | 91 ++++++ providers/guardahd/posts.ts | 85 ++++++ .../{GetGuardahdStream.ts => stream.ts} | 57 ++-- providers/hdhub4u/catalog.ts | 61 ++++ providers/hdhub4u/hdhubCatalog.ts | 61 ---- providers/hdhub4u/index.ts | 14 - .../hdhub4u/{hdhubGetInfo.ts => meta.ts} | 64 ++-- .../hdhub4u/{hdhubGetPosts.ts => posts.ts} | 40 +-- .../hdhub4u/{hdhub4uGetSteam.ts => stream.ts} | 83 ++--- providers/hiAnime/catalog.ts | 20 ++ providers/hiAnime/hiCatalog.ts | 20 -- providers/hiAnime/index.ts | 14 - providers/hiAnime/{hiGetInfo.ts => meta.ts} | 42 +-- providers/hiAnime/{hiGetPosts.ts => posts.ts} | 24 +- .../hiAnime/{HiGetSteam.ts => stream.ts} | 28 +- .../katmovies/{katCatalog.ts => catalog.ts} | 0 .../{katGetEpsodes.ts => episodes.ts} | 38 +-- providers/katmovies/index.ts | 16 - .../katmovies/{katGetInfo.ts => meta.ts} | 76 ++--- .../katmovies/{katGetPosts.ts => posts.ts} | 34 +-- .../katmovies/{katGetSteam.ts => stream.ts} | 62 ++-- providers/kissKh/catalog.ts | 20 ++ providers/kissKh/index.ts | 14 - providers/kissKh/kissKhCatalog.ts | 20 -- .../kissKh/{kissKhGetInfo.ts => meta.ts} | 26 +- .../kissKh/{kissKhGetPosts.ts => posts.ts} | 22 +- .../kissKh/{kissKhGetStream.ts => stream.ts} | 16 +- providers/luxMovies/catalog.ts | 101 ++++++ providers/luxMovies/episodes.ts | 39 +++ providers/luxMovies/index.ts | 17 -- providers/luxMovies/luxCatalog.ts | 101 ------ providers/luxMovies/luxGetPosts.ts | 111 ------- .../{vega/getInfo.ts => luxMovies/meta.ts} | 115 +++---- providers/luxMovies/posts.ts | 111 +++++++ .../getStream.ts => luxMovies/stream.ts} | 80 ++--- providers/mod/catalog.ts | 84 ++--- providers/mod/episodes.ts | 52 ++++ providers/mod/index.ts | 17 -- providers/mod/meta.ts | 71 +++++ providers/mod/modGetEpisodesList.ts | 52 ---- providers/mod/modGetInfo.ts | 71 ----- providers/mod/{modGetPosts.ts => posts.ts} | 36 +-- providers/mod/{modGetStream.ts => stream.ts} | 188 ++++++------ providers/moviesApi/index.ts | 10 +- .../moviesApi/{mpGetStream.ts => stream.ts} | 0 providers/multi/catalog.ts | 77 +++++ providers/multi/index.ts | 14 - providers/multi/{multiGetInfo.ts => meta.ts} | 46 +-- providers/multi/multiCatalog.ts | 77 ----- providers/multi/{multiPosts.ts => posts.ts} | 34 +-- .../multi/{multiGetStream.ts => stream.ts} | 92 +++--- providers/netflixMirror/catalog.ts | 16 + providers/netflixMirror/episodes.ts | 49 +++ providers/netflixMirror/index.ts | 16 - .../netflixMirror/{nfGetInfo.ts => meta.ts} | 40 +-- providers/netflixMirror/nfCatalog.ts | 16 - providers/netflixMirror/nfGetEpisodes.ts | 49 --- .../netflixMirror/{nfGetPost.ts => posts.ts} | 62 ++-- .../stream.ts} | 26 +- providers/primeMirror/catalog.ts | 16 + providers/primeMirror/episodes.ts | 49 +++ providers/primeMirror/index.ts | 16 - .../primeMirror/{pmGetInfo.ts => meta.ts} | 40 +-- providers/primeMirror/pmGetEpisodes.ts | 49 --- providers/primeMirror/posts.ts | 135 ++++++++ .../nfGetSteam.ts => primeMirror/stream.ts} | 26 +- providers/primewire/catalog.ts | 16 + providers/primewire/index.ts | 14 - providers/primewire/{pwGetInfo.ts => meta.ts} | 52 ++-- .../primewire/{pwGetPosts.ts => posts.ts} | 38 +-- providers/primewire/pwCatalogl.ts | 16 - .../primewire/{pwGetStream.ts => stream.ts} | 104 +++---- providers/protonMovies/catalog.ts | 20 ++ providers/protonMovies/index.ts | 14 - providers/protonMovies/meta.ts | 109 +++++++ .../{protonGetPosts.ts => posts.ts} | 50 +-- providers/protonMovies/protonCatalog.ts | 20 -- providers/protonMovies/protonGetMeta.ts | 109 ------- .../{protonGetStream.ts => stream.ts} | 133 ++++---- providers/ridoMovies/catalog.ts | 12 + providers/ridoMovies/index.ts | 15 - providers/ridoMovies/meta.ts | 87 ++++++ providers/ridoMovies/posts.ts | 85 ++++++ providers/ridoMovies/ridoGetMeta.ts | 87 ------ .../ridoMovies/{ridoGetSream.ts => stream.ts} | 34 +-- providers/ringz/catalog.ts | 16 + providers/ringz/index.ts | 14 - providers/ringz/meta.ts | 87 ++++++ .../ringz/{ringzGetPosts.ts => posts.ts} | 30 +- providers/ringz/ringzCatalog.ts | 16 - providers/ringz/ringzGetMeta.ts | 87 ------ .../ringz/{ringzGetStream.ts => stream.ts} | 6 +- providers/showbox/catalog.ts | 16 + .../{sbGetEpisodeList.ts => episodes.ts} | 12 +- providers/showbox/index.ts | 16 - providers/showbox/{sbGetMeta.ts => meata.ts} | 42 +-- providers/showbox/{sbGetPosts.ts => posts.ts} | 32 +- providers/showbox/sbCatalog.ts | 16 - providers/showbox/sbGetStream.ts | 43 --- providers/showbox/stream.ts | 43 +++ providers/tokyoInsider/catalog.ts | 12 +- providers/tokyoInsider/index.ts | 15 - providers/tokyoInsider/meta.ts | 65 ++++ .../{tokyoGetPosts.ts => posts.ts} | 34 +-- providers/tokyoInsider/stream.ts | 33 ++ providers/tokyoInsider/tokyoGetInfo.ts | 65 ---- providers/tokyoInsider/tokyoGetStream.ts | 33 -- providers/topmovies/catalog.ts | 85 ++++++ providers/topmovies/episodes.ts | 52 ++++ providers/topmovies/index.ts | 17 -- providers/topmovies/meta.ts | 71 +++++ providers/topmovies/posts.ts | 94 ++++++ providers/topmovies/stream.ts | 288 ++++++++++++++++++ providers/topmovies/topCatalog.ts | 85 ------ providers/topmovies/topGetPosts.ts | 94 ------ providers/uhd/catalog.ts | 37 +++ providers/uhd/index.ts | 15 - providers/uhd/{getUhdInfo.ts => meta.ts} | 92 +++--- providers/uhd/{uhdGetPosts.ts => posts.ts} | 64 ++-- providers/uhd/{uhdGetStream.ts => stream.ts} | 134 ++++---- providers/uhd/uhCtatalog.ts | 37 --- providers/vadapav/VagapavCatalog.ts | 16 - providers/vadapav/catalog.ts | 16 + .../{vadapavGetEpisodes.ts => episodes.ts} | 18 +- providers/vadapav/index.ts | 16 - .../vadapav/{vadapavGetInfo.ts => meta.ts} | 46 +-- .../vadapav/{vadapavGetPosts.ts => posts.ts} | 34 +-- providers/vadapav/stream.ts | 21 ++ providers/vadapav/vadapavGetStream.ts | 22 -- providers/vega/catalog.ts | 100 +++--- providers/vega/episodes.ts | 39 +++ providers/vega/getEpisodesLink.ts | 39 --- providers/vega/index.ts | 17 -- providers/vega/meta.ts | 158 ++++++++++ providers/vega/{getPosts.ts => posts.ts} | 88 +++--- providers/vega/stream.ts | 117 +++++++ providers/world4u/catalog.ts | 32 +- ...{world4uGetEpisodeLinks.ts => episodes.ts} | 18 +- providers/world4u/index.ts | 16 - .../world4u/{world4uGetInfo.ts => meta.ts} | 50 +-- .../world4u/{world4uGetPosts.ts => posts.ts} | 36 +-- .../{world4uGetStream.ts => stream.ts} | 146 ++++----- 185 files changed, 4645 insertions(+), 3952 deletions(-) delete mode 100644 providers/autoEmbed/allCatalog.ts create mode 100644 providers/autoEmbed/catalog.ts delete mode 100644 providers/autoEmbed/index.ts rename providers/autoEmbed/{allGetInfo.ts => meta.ts} (61%) rename providers/autoEmbed/{allGetPost.ts => posts.ts} (79%) rename providers/autoEmbed/{allGetStream.ts => stream.ts} (65%) create mode 100644 providers/cinemaLuxe/catalog.ts delete mode 100644 providers/cinemaLuxe/clCatalog.ts rename providers/cinemaLuxe/{clGetEpisodes.ts => episodes.ts} (59%) delete mode 100644 providers/cinemaLuxe/index.ts rename providers/cinemaLuxe/{clGetMeta.ts => meta.ts} (51%) rename providers/cinemaLuxe/{clGetPosts.ts => posts.ts} (54%) rename providers/cinemaLuxe/{clGetSteam.ts => stream.ts} (63%) create mode 100644 providers/dooflix/catalog.ts delete mode 100644 providers/dooflix/dooCatalog.ts delete mode 100644 providers/dooflix/index.ts rename providers/dooflix/{dooGetInfo.ts => meta.ts} (52%) rename providers/dooflix/{dooGetPosts.ts => posts.ts} (59%) rename providers/dooflix/{dooGetSteam.ts => stream.ts} (54%) rename providers/drive/{driveGetEpisodesList.ts => episodes.ts} (60%) delete mode 100644 providers/drive/index.ts rename providers/drive/{driveGetInfo.ts => meta.ts} (55%) rename providers/drive/{driveGetPosts.ts => posts.ts} (53%) rename providers/drive/{driveGetStream.ts => stream.ts} (52%) create mode 100644 providers/filmyfly/catalog.ts rename providers/filmyfly/{ffGetEpisodes.ts => episodes.ts} (54%) delete mode 100644 providers/filmyfly/ffCatalog.ts delete mode 100644 providers/filmyfly/ffGetMeta.ts delete mode 100644 providers/filmyfly/index.ts create mode 100644 providers/filmyfly/meta.ts rename providers/filmyfly/{ffGetPosts.ts => posts.ts} (55%) rename providers/filmyfly/{ffGetStream.ts => stream.ts} (53%) create mode 100644 providers/flixhq/catalog.ts delete mode 100644 providers/flixhq/flixhqCatalog.ts delete mode 100644 providers/flixhq/index.ts rename providers/flixhq/{flixhqGetInfo.ts => meta.ts} (57%) rename providers/flixhq/{flixhqGetPosts.ts => posts.ts} (60%) rename providers/flixhq/{flixhqGetStream.ts => stream.ts} (65%) create mode 100644 providers/guardahd/catalog.ts delete mode 100644 providers/guardahd/guardahdCatalog.ts delete mode 100644 providers/guardahd/guardahdGetPosts.ts delete mode 100644 providers/guardahd/index.ts create mode 100644 providers/guardahd/meta.ts create mode 100644 providers/guardahd/posts.ts rename providers/guardahd/{GetGuardahdStream.ts => stream.ts} (64%) create mode 100644 providers/hdhub4u/catalog.ts delete mode 100644 providers/hdhub4u/hdhubCatalog.ts delete mode 100644 providers/hdhub4u/index.ts rename providers/hdhub4u/{hdhubGetInfo.ts => meta.ts} (62%) rename providers/hdhub4u/{hdhubGetPosts.ts => posts.ts} (54%) rename providers/hdhub4u/{hdhub4uGetSteam.ts => stream.ts} (61%) create mode 100644 providers/hiAnime/catalog.ts delete mode 100644 providers/hiAnime/hiCatalog.ts delete mode 100644 providers/hiAnime/index.ts rename providers/hiAnime/{hiGetInfo.ts => meta.ts} (55%) rename providers/hiAnime/{hiGetPosts.ts => posts.ts} (63%) rename providers/hiAnime/{HiGetSteam.ts => stream.ts} (58%) rename providers/katmovies/{katCatalog.ts => catalog.ts} (100%) rename providers/katmovies/{katGetEpsodes.ts => episodes.ts} (61%) delete mode 100644 providers/katmovies/index.ts rename providers/katmovies/{katGetInfo.ts => meta.ts} (54%) rename providers/katmovies/{katGetPosts.ts => posts.ts} (53%) rename providers/katmovies/{katGetSteam.ts => stream.ts} (55%) create mode 100644 providers/kissKh/catalog.ts delete mode 100644 providers/kissKh/index.ts delete mode 100644 providers/kissKh/kissKhCatalog.ts rename providers/kissKh/{kissKhGetInfo.ts => meta.ts} (59%) rename providers/kissKh/{kissKhGetPosts.ts => posts.ts} (71%) rename providers/kissKh/{kissKhGetStream.ts => stream.ts} (64%) create mode 100644 providers/luxMovies/catalog.ts create mode 100644 providers/luxMovies/episodes.ts delete mode 100644 providers/luxMovies/index.ts delete mode 100644 providers/luxMovies/luxCatalog.ts delete mode 100644 providers/luxMovies/luxGetPosts.ts rename providers/{vega/getInfo.ts => luxMovies/meta.ts} (53%) create mode 100644 providers/luxMovies/posts.ts rename providers/{vega/getStream.ts => luxMovies/stream.ts} (62%) create mode 100644 providers/mod/episodes.ts delete mode 100644 providers/mod/index.ts create mode 100644 providers/mod/meta.ts delete mode 100644 providers/mod/modGetEpisodesList.ts delete mode 100644 providers/mod/modGetInfo.ts rename providers/mod/{modGetPosts.ts => posts.ts} (52%) rename providers/mod/{modGetStream.ts => stream.ts} (51%) rename providers/moviesApi/{mpGetStream.ts => stream.ts} (100%) create mode 100644 providers/multi/catalog.ts delete mode 100644 providers/multi/index.ts rename providers/multi/{multiGetInfo.ts => meta.ts} (51%) delete mode 100644 providers/multi/multiCatalog.ts rename providers/multi/{multiPosts.ts => posts.ts} (52%) rename providers/multi/{multiGetStream.ts => stream.ts} (59%) create mode 100644 providers/netflixMirror/catalog.ts create mode 100644 providers/netflixMirror/episodes.ts delete mode 100644 providers/netflixMirror/index.ts rename providers/netflixMirror/{nfGetInfo.ts => meta.ts} (56%) delete mode 100644 providers/netflixMirror/nfCatalog.ts delete mode 100644 providers/netflixMirror/nfGetEpisodes.ts rename providers/netflixMirror/{nfGetPost.ts => posts.ts} (58%) rename providers/{primeMirror/pmGetStream.ts => netflixMirror/stream.ts} (56%) create mode 100644 providers/primeMirror/catalog.ts create mode 100644 providers/primeMirror/episodes.ts delete mode 100644 providers/primeMirror/index.ts rename providers/primeMirror/{pmGetInfo.ts => meta.ts} (56%) delete mode 100644 providers/primeMirror/pmGetEpisodes.ts create mode 100644 providers/primeMirror/posts.ts rename providers/{netflixMirror/nfGetSteam.ts => primeMirror/stream.ts} (56%) create mode 100644 providers/primewire/catalog.ts delete mode 100644 providers/primewire/index.ts rename providers/primewire/{pwGetInfo.ts => meta.ts} (54%) rename providers/primewire/{pwGetPosts.ts => posts.ts} (51%) delete mode 100644 providers/primewire/pwCatalogl.ts rename providers/primewire/{pwGetStream.ts => stream.ts} (51%) create mode 100644 providers/protonMovies/catalog.ts delete mode 100644 providers/protonMovies/index.ts create mode 100644 providers/protonMovies/meta.ts rename providers/protonMovies/{protonGetPosts.ts => posts.ts} (59%) delete mode 100644 providers/protonMovies/protonCatalog.ts delete mode 100644 providers/protonMovies/protonGetMeta.ts rename providers/protonMovies/{protonGetStream.ts => stream.ts} (77%) create mode 100644 providers/ridoMovies/catalog.ts delete mode 100644 providers/ridoMovies/index.ts create mode 100644 providers/ridoMovies/meta.ts create mode 100644 providers/ridoMovies/posts.ts delete mode 100644 providers/ridoMovies/ridoGetMeta.ts rename providers/ridoMovies/{ridoGetSream.ts => stream.ts} (63%) create mode 100644 providers/ringz/catalog.ts delete mode 100644 providers/ringz/index.ts create mode 100644 providers/ringz/meta.ts rename providers/ringz/{ringzGetPosts.ts => posts.ts} (82%) delete mode 100644 providers/ringz/ringzCatalog.ts delete mode 100644 providers/ringz/ringzGetMeta.ts rename providers/ringz/{ringzGetStream.ts => stream.ts} (67%) create mode 100644 providers/showbox/catalog.ts rename providers/showbox/{sbGetEpisodeList.ts => episodes.ts} (76%) delete mode 100644 providers/showbox/index.ts rename providers/showbox/{sbGetMeta.ts => meata.ts} (57%) rename providers/showbox/{sbGetPosts.ts => posts.ts} (54%) delete mode 100644 providers/showbox/sbCatalog.ts delete mode 100644 providers/showbox/sbGetStream.ts create mode 100644 providers/showbox/stream.ts delete mode 100644 providers/tokyoInsider/index.ts create mode 100644 providers/tokyoInsider/meta.ts rename providers/tokyoInsider/{tokyoGetPosts.ts => posts.ts} (57%) create mode 100644 providers/tokyoInsider/stream.ts delete mode 100644 providers/tokyoInsider/tokyoGetInfo.ts delete mode 100644 providers/tokyoInsider/tokyoGetStream.ts create mode 100644 providers/topmovies/catalog.ts create mode 100644 providers/topmovies/episodes.ts delete mode 100644 providers/topmovies/index.ts create mode 100644 providers/topmovies/meta.ts create mode 100644 providers/topmovies/posts.ts create mode 100644 providers/topmovies/stream.ts delete mode 100644 providers/topmovies/topCatalog.ts delete mode 100644 providers/topmovies/topGetPosts.ts create mode 100644 providers/uhd/catalog.ts delete mode 100644 providers/uhd/index.ts rename providers/uhd/{getUhdInfo.ts => meta.ts} (52%) rename providers/uhd/{uhdGetPosts.ts => posts.ts} (50%) rename providers/uhd/{uhdGetStream.ts => stream.ts} (53%) delete mode 100644 providers/uhd/uhCtatalog.ts delete mode 100644 providers/vadapav/VagapavCatalog.ts create mode 100644 providers/vadapav/catalog.ts rename providers/vadapav/{vadapavGetEpisodes.ts => episodes.ts} (50%) delete mode 100644 providers/vadapav/index.ts rename providers/vadapav/{vadapavGetInfo.ts => meta.ts} (57%) rename providers/vadapav/{vadapavGetPosts.ts => posts.ts} (64%) create mode 100644 providers/vadapav/stream.ts delete mode 100644 providers/vadapav/vadapavGetStream.ts create mode 100644 providers/vega/episodes.ts delete mode 100644 providers/vega/getEpisodesLink.ts delete mode 100644 providers/vega/index.ts create mode 100644 providers/vega/meta.ts rename providers/vega/{getPosts.ts => posts.ts} (52%) create mode 100644 providers/vega/stream.ts rename providers/world4u/{world4uGetEpisodeLinks.ts => episodes.ts} (64%) delete mode 100644 providers/world4u/index.ts rename providers/world4u/{world4uGetInfo.ts => meta.ts} (54%) rename providers/world4u/{world4uGetPosts.ts => posts.ts} (51%) rename providers/world4u/{world4uGetStream.ts => stream.ts} (52%) diff --git a/providers/autoEmbed/allCatalog.ts b/providers/autoEmbed/allCatalog.ts deleted file mode 100644 index b59bd02..0000000 --- a/providers/autoEmbed/allCatalog.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const allCatalog = [ - { - title: 'Popular Movies', - filter: '/top/catalog/movie/top.json', - }, - { - title: 'Popular TV Shows', - filter: '/top/catalog/series/top.json', - }, - { - title: 'Featured Movies', - filter: '/imdbRating/catalog/movie/imdbRating.json', - }, - { - title: 'Featured TV Shows', - filter: '/imdbRating/catalog/series/imdbRating.json', - }, -]; - -export const allGenresList = []; diff --git a/providers/autoEmbed/catalog.ts b/providers/autoEmbed/catalog.ts new file mode 100644 index 0000000..c7ecc6f --- /dev/null +++ b/providers/autoEmbed/catalog.ts @@ -0,0 +1,20 @@ +export const catalog = [ + { + title: "Popular Movies", + filter: "/top/catalog/movie/top.json", + }, + { + title: "Popular TV Shows", + filter: "/top/catalog/series/top.json", + }, + { + title: "Featured Movies", + filter: "/imdbRating/catalog/movie/imdbRating.json", + }, + { + title: "Featured TV Shows", + filter: "/imdbRating/catalog/series/imdbRating.json", + }, +]; + +export const genres = []; diff --git a/providers/autoEmbed/index.ts b/providers/autoEmbed/index.ts deleted file mode 100644 index 144d86c..0000000 --- a/providers/autoEmbed/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {allCatalog, allGenresList} from './allCatalog'; -import {allGetInfo} from './allGetInfo'; -import {allGetStream} from './allGetStream'; -import {allGetPost, allGetSearchPosts} from './allGetPost'; -import {ProviderType} from '../../Manifest'; - -export const autoEmbed: ProviderType = { - catalog: allCatalog, - genres: allGenresList, - GetMetaData: allGetInfo, - GetHomePosts: allGetPost, - GetStream: allGetStream, - GetSearchPosts: allGetSearchPosts, -}; diff --git a/providers/autoEmbed/allGetInfo.ts b/providers/autoEmbed/meta.ts similarity index 61% rename from providers/autoEmbed/allGetInfo.ts rename to providers/autoEmbed/meta.ts index 28b6b26..72a6032 100644 --- a/providers/autoEmbed/allGetInfo.ts +++ b/providers/autoEmbed/meta.ts @@ -1,6 +1,6 @@ -import {EpisodeLink, Info, Link, ProviderContext} from '../types'; +import { EpisodeLink, Info, Link, ProviderContext } from "../types"; -export const allGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -9,43 +9,43 @@ export const allGetInfo = async function ({ }): Promise { const axios = providerContext.axios; try { - console.log('all', link); + console.log("all", link); const res = await axios.get(link); const data = res.data; const meta = { - title: '', - synopsis: '', - image: '', - imdbId: data?.meta?.imdb_id || '', - type: data?.meta?.type || 'movie', + title: "", + synopsis: "", + image: "", + imdbId: data?.meta?.imdb_id || "", + type: data?.meta?.type || "movie", }; const links: Link[] = []; let directLinks: EpisodeLink[] = []; let season = new Map(); - if (meta.type === 'series') { + if (meta.type === "series") { data?.meta?.videos?.map((video: any) => { if (video?.season <= 0) return; if (!season.has(video?.season)) { season.set(video?.season, []); } season.get(video?.season).push({ - title: 'Episode ' + video?.episode, - type: 'series', + title: "Episode " + video?.episode, + type: "series", link: JSON.stringify({ title: data?.meta?.name as string, imdbId: data?.meta?.imdb_id, - season: video?.id?.split(':')[1], - episode: video?.id?.split(':')[2], + season: video?.id?.split(":")[1], + episode: video?.id?.split(":")[2], type: data?.meta?.type, - tmdbId: data?.meta?.moviedb_id?.toString() || '', + tmdbId: data?.meta?.moviedb_id?.toString() || "", year: data?.meta?.year, }), }); }); const keys = Array.from(season.keys()); keys.sort(); - keys.map(key => { + keys.map((key) => { directLinks = season.get(key); links.push({ title: `Season ${key}`, @@ -53,20 +53,20 @@ export const allGetInfo = async function ({ }); }); } else { - console.log('all meta Mv🔥🔥', meta); + console.log("all meta Mv🔥🔥", meta); links.push({ title: data?.meta?.name as string, directLinks: [ { - title: 'Movie', - type: 'movie', + title: "Movie", + type: "movie", link: JSON.stringify({ title: data?.meta?.name as string, imdbId: data?.meta?.imdb_id, - season: '', - episode: '', + season: "", + episode: "", type: data?.meta?.type, - tmdbId: data?.meta?.moviedb_id?.toString() || '', + tmdbId: data?.meta?.moviedb_id?.toString() || "", year: data?.meta?.year, }), }, @@ -80,11 +80,11 @@ export const allGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/autoEmbed/allGetPost.ts b/providers/autoEmbed/posts.ts similarity index 79% rename from providers/autoEmbed/allGetPost.ts rename to providers/autoEmbed/posts.ts index 743b215..9d760d0 100644 --- a/providers/autoEmbed/allGetPost.ts +++ b/providers/autoEmbed/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const allGetPost = async function ({ +export const getPosts = async function ({ filter, signal, providerContext, @@ -13,8 +13,8 @@ export const allGetPost = async function ({ }): Promise { try { const catalog: Post[] = []; - const url = 'https://cinemeta-catalogs.strem.io' + filter; - console.log('allGetPostUrl', url); + const url = "https://cinemeta-catalogs.strem.io" + filter; + console.log("allGetPostUrl", url); const res = await providerContext.axios.get(url, { headers: providerContext.commonHeaders, signal, @@ -33,15 +33,15 @@ export const allGetPost = async function ({ }); } }); - console.log('catalog', catalog.length); + console.log("catalog", catalog.length); return catalog; } catch (err) { - console.error('AutoEmbed error ', err); + console.error("AutoEmbed error ", err); return []; } }; -export const allGetSearchPosts = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, // providerValue, @@ -60,10 +60,10 @@ export const allGetSearchPosts = async function ({ } const catalog: Post[] = []; const url1 = `https://v3-cinemeta.strem.io/catalog/series/top/search=${encodeURI( - searchQuery, + searchQuery )}.json`; const url2 = `https://v3-cinemeta.strem.io/catalog/movie/top/search=${encodeURI( - searchQuery, + searchQuery )}.json`; const res = await providerContext.axios.get(url1, { headers: providerContext.commonHeaders, @@ -71,7 +71,7 @@ export const allGetSearchPosts = async function ({ }); const data = res.data; data?.metas.map((result: any) => { - const title = result.name || ''; + const title = result.name || ""; const id = result?.imdb_id || result?.id; const image = result?.poster; const type = result?.type; @@ -89,7 +89,7 @@ export const allGetSearchPosts = async function ({ }); const data2 = res2.data; data2?.metas.map((result: any) => { - const title = result?.name || ''; + const title = result?.name || ""; const id = result?.imdb_id || result?.id; const image = result?.poster; const type = result?.type; @@ -103,7 +103,7 @@ export const allGetSearchPosts = async function ({ }); return catalog; } catch (err) { - console.error('AutoEmbed error ', err); + console.error("AutoEmbed error ", err); return []; } }; diff --git a/providers/autoEmbed/allGetStream.ts b/providers/autoEmbed/stream.ts similarity index 65% rename from providers/autoEmbed/allGetStream.ts rename to providers/autoEmbed/stream.ts index f2ffd05..3ab896f 100644 --- a/providers/autoEmbed/allGetStream.ts +++ b/providers/autoEmbed/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext, TextTrackType, TextTracks} from '../types'; +import { Stream, ProviderContext, TextTrackType, TextTracks } from "../types"; -export const allGetStream = async ({ +export const getStream = async ({ link: id, type, providerContext, @@ -11,14 +11,14 @@ export const allGetStream = async ({ }): Promise => { try { const streams: Stream[] = []; - const {imdbId, season, episode, title, tmdbId, year} = JSON.parse(id); + const { imdbId, season, episode, title, tmdbId, year } = JSON.parse(id); await getRiveStream( tmdbId, episode, season, type, streams, - providerContext, + providerContext ); return streams; } catch (err) { @@ -33,47 +33,47 @@ export async function getRiveStream( season: string, type: string, Streams: Stream[], - providerContext: ProviderContext, + providerContext: ProviderContext ) { const secret = generateSecretKey(Number(tmdId)); const servers = [ - 'flowcast', - 'shadow', - 'asiacloud', - 'hindicast', - 'anime', - 'animez', - 'guard', - 'curve', - 'hq', - 'ninja', - 'alpha', - 'kaze', - 'zenesis', - 'genesis', - 'zenith', - 'ghost', - 'halo', - 'kinoecho', - 'ee3', - 'volt', - 'putafilme', - 'ophim', - 'kage', + "flowcast", + "shadow", + "asiacloud", + "hindicast", + "anime", + "animez", + "guard", + "curve", + "hq", + "ninja", + "alpha", + "kaze", + "zenesis", + "genesis", + "zenith", + "ghost", + "halo", + "kinoecho", + "ee3", + "volt", + "putafilme", + "ophim", + "kage", ]; - const baseUrl = await providerContext.getBaseUrl('rive'); - const cors = process.env.CORS_PRXY ? process.env.CORS_PRXY + '?url=' : ''; - console.log('CORS: ' + cors); + const baseUrl = await providerContext.getBaseUrl("rive"); + const cors = process.env.CORS_PRXY ? process.env.CORS_PRXY + "?url=" : ""; + console.log("CORS: " + cors); const route = - type === 'series' + type === "series" ? `/api/backendfetch?requestID=tvVideoProvider&id=${tmdId}&season=${season}&episode=${episode}&secretKey=${secret}&service=` : `/api/backendfetch?requestID=movieVideoProvider&id=${tmdId}&secretKey=${secret}&service=`; const url = cors ? cors + encodeURIComponent(baseUrl + route) : baseUrl + route; await Promise.all( - servers.map(async server => { - console.log('Rive: ' + url + server); + servers.map(async (server) => { + console.log("Rive: " + url + server); try { const res = await providerContext.axios.get(url + server, { timeout: 4000, @@ -83,10 +83,10 @@ export async function getRiveStream( if (res.data?.data?.captions) { res.data?.data?.captions.forEach((sub: any) => { subtitles.push({ - language: sub?.label?.slice(0, 2) || 'Und', + language: sub?.label?.slice(0, 2) || "Und", uri: sub?.file, - title: sub?.label || 'Undefined', - type: sub?.file?.endsWith('.vtt') + title: sub?.label || "Undefined", + type: sub?.file?.endsWith(".vtt") ? TextTrackType.VTT : TextTrackType.SUBRIP, }); @@ -94,9 +94,9 @@ export async function getRiveStream( } res.data?.data?.sources.forEach((source: any) => { Streams.push({ - server: source?.source + '-' + source?.quality, + server: source?.source + "-" + source?.quality, link: source?.url, - type: source?.format === 'hls' ? 'm3u8' : 'mp4', + type: source?.format === "hls" ? "m3u8" : "mp4", quality: source?.quality, subtitles: subtitles, }); @@ -104,78 +104,78 @@ export async function getRiveStream( } catch (e) { console.log(e); } - }), + }) ); } function generateSecretKey(id: number | string) { // Array of secret key fragments - updated array from the new implementation const c = [ - 'Yhv40uKAZa', - 'nn8YU4yBA', - 'uNeH', - 'ehK', - 'jT0', - 'n5G', - '99R', - 'MvB1M', - 'DQtPCh', - 'GBRjk4k4I', - 'CzIOoa95UT', - 'BLE8s', - 'GDZlc7', - 'Fz45T', - 'JW6lWn', - 'DE3g4uw0i', - '18KxmYizv', - '8ji', - 'JUDdNMnZ', - 'oGpBippPgm', - '7De8Pg', - 'Zv6', - 'VHT9TVN', - 'bYH6m', - 'aK1', - 'WcWH6jU', - 'Q47YEMi4k', - 'vRD3A', - 'CGOsfJO', - 'BLn8', - 'RgK0drv7l', - 'oPTfGCn3a', - 'MkpMDkttW9', - 'VNI1fPM', - 'XNFi6', - '6cq', - '4LvTksXoEI', - '1rRa2KOZB0', - 'zoOGRb8HT2', - 'mhcXDtvz', - 'NUmexFY2Ur', - '6BIMdvSZ', - 'Tr0zU2vjRd', - 'QPR', - 'fhOqJR', - 'R9VnFY', - 'xkZ99D6S', - 'umY7E', - '5Ds8qyDq', - 'Cc6jy09y3', - 'yvU3iR', - 'Bg07zY', - 'GccECglg', - 'VYd', - '6vOiXqz', - '7xX', - 'UdRrbEzF', - 'fE6wc', - 'BUd25Rb', - 'lxq5Zum89o', + "Yhv40uKAZa", + "nn8YU4yBA", + "uNeH", + "ehK", + "jT0", + "n5G", + "99R", + "MvB1M", + "DQtPCh", + "GBRjk4k4I", + "CzIOoa95UT", + "BLE8s", + "GDZlc7", + "Fz45T", + "JW6lWn", + "DE3g4uw0i", + "18KxmYizv", + "8ji", + "JUDdNMnZ", + "oGpBippPgm", + "7De8Pg", + "Zv6", + "VHT9TVN", + "bYH6m", + "aK1", + "WcWH6jU", + "Q47YEMi4k", + "vRD3A", + "CGOsfJO", + "BLn8", + "RgK0drv7l", + "oPTfGCn3a", + "MkpMDkttW9", + "VNI1fPM", + "XNFi6", + "6cq", + "4LvTksXoEI", + "1rRa2KOZB0", + "zoOGRb8HT2", + "mhcXDtvz", + "NUmexFY2Ur", + "6BIMdvSZ", + "Tr0zU2vjRd", + "QPR", + "fhOqJR", + "R9VnFY", + "xkZ99D6S", + "umY7E", + "5Ds8qyDq", + "Cc6jy09y3", + "yvU3iR", + "Bg07zY", + "GccECglg", + "VYd", + "6vOiXqz", + "7xX", + "UdRrbEzF", + "fE6wc", + "BUd25Rb", + "lxq5Zum89o", ]; // Handle undefined input if (id === undefined) { - return 'rive'; + return "rive"; } try { @@ -195,7 +195,7 @@ function generateSecretKey(id: number | string) { } hash ^= hash >>> 13; hash = (1540483477 * hash) >>> 0; - return (hash ^= hash >>> 15).toString(16).padStart(8, '0'); + return (hash ^= hash >>> 15).toString(16).padStart(8, "0"); }; // Updated MurmurHash-like function to match the new implementation @@ -214,7 +214,7 @@ function generateSecretKey(id: number | string) { hash = (2246822507 * hash) >>> 0; hash ^= hash >>> 13; hash = (3266489909 * hash) >>> 0; - return (hash ^= hash >>> 16).toString(16).padStart(8, '0'); + return (hash ^= hash >>> 16).toString(16).padStart(8, "0"); }; /* eslint-enable no-bitwise */ @@ -225,7 +225,7 @@ function generateSecretKey(id: number | string) { if (isNaN(Number(id))) { // For non-numeric inputs, sum the character codes const charSum = idStr - .split('') + .split("") .reduce((sum, char) => sum + char.charCodeAt(0), 0); // Select array element or fallback to base64 encoded input fragment = c[charSum % c.length] || btoa(idStr); @@ -245,6 +245,6 @@ function generateSecretKey(id: number | string) { ); } catch (error) { // Return fallback value if any errors occur - return 'topSecret'; + return "topSecret"; } } diff --git a/providers/cinemaLuxe/catalog.ts b/providers/cinemaLuxe/catalog.ts new file mode 100644 index 0000000..068e5e4 --- /dev/null +++ b/providers/cinemaLuxe/catalog.ts @@ -0,0 +1,20 @@ +export const catalog = [ + { + title: "Trending", + filter: "/genre/latest-trending-releases/", + }, + { + title: "Netflix", + filter: "/network/netflix/", + }, + { + title: "Amazon Prime", + filter: "/network/prime-video/", + }, + { + title: "Animation", + filter: "/genre/anime/", + }, +]; + +export const genres = []; diff --git a/providers/cinemaLuxe/clCatalog.ts b/providers/cinemaLuxe/clCatalog.ts deleted file mode 100644 index fc8ff8c..0000000 --- a/providers/cinemaLuxe/clCatalog.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const clCatalog = [ - { - title: 'Trending', - filter: '/genre/latest-trending-releases/', - }, - { - title: 'Netflix', - filter: '/network/netflix/', - }, - { - title: 'Amazon Prime', - filter: '/network/prime-video/', - }, - { - title: 'Animation', - filter: '/genre/anime/', - }, -]; - -export const clGenresList = []; diff --git a/providers/cinemaLuxe/clGetEpisodes.ts b/providers/cinemaLuxe/episodes.ts similarity index 59% rename from providers/cinemaLuxe/clGetEpisodes.ts rename to providers/cinemaLuxe/episodes.ts index 4383903..e6ba530 100644 --- a/providers/cinemaLuxe/clGetEpisodes.ts +++ b/providers/cinemaLuxe/episodes.ts @@ -1,6 +1,6 @@ -import {EpisodeLink, ProviderContext} from '../types'; +import { EpisodeLink, ProviderContext } from "../types"; -export const clsEpisodeLinks = async function ({ +export const getEpisodes = async function ({ url, providerContext, }: { @@ -8,7 +8,7 @@ export const clsEpisodeLinks = async function ({ providerContext: ProviderContext; }): Promise { try { - if (!url.includes('luxelinks') || url.includes('luxecinema')) { + if (!url.includes("luxelinks") || url.includes("luxecinema")) { const res = await providerContext.axios.get(url, { headers: providerContext.commonHeaders, }); @@ -18,14 +18,14 @@ export const clsEpisodeLinks = async function ({ url = encodedLink ? atob(encodedLink) : url; } else { const redirectUrlRes = await fetch( - 'https://ext.8man.me/api/cinemaluxe', + "https://ext.8man.me/api/cinemaluxe", { - method: 'POST', + method: "POST", headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", }, - body: JSON.stringify({url}), - }, + body: JSON.stringify({ url }), + } ); const redirectUrl = await redirectUrlRes.json(); url = redirectUrl?.redirectUrl || url; @@ -37,37 +37,37 @@ export const clsEpisodeLinks = async function ({ const html = res.data; let $ = providerContext.cheerio.load(html); const episodeLinks: EpisodeLink[] = []; - if (url.includes('luxedrive')) { + if (url.includes("luxedrive")) { episodeLinks.push({ - title: 'Movie', + title: "Movie", link: url, }); return episodeLinks; } - $('a.maxbutton-4,a.maxbutton,.maxbutton-hubcloud,.ep-simple-button').map( + $("a.maxbutton-4,a.maxbutton,.maxbutton-hubcloud,.ep-simple-button").map( (i, element) => { const title = $(element).text()?.trim(); - const link = $(element).attr('href'); + const link = $(element).attr("href"); if ( title && link && - !title.includes('Batch') && - !title.toLowerCase().includes('zip') + !title.includes("Batch") && + !title.toLowerCase().includes("zip") ) { episodeLinks.push({ title: title - .replace(/\(\d{4}\)/, '') - .replace('Download', 'Movie') - .replace('⚡', '') + .replace(/\(\d{4}\)/, "") + .replace("Download", "Movie") + .replace("⚡", "") .trim(), link, }); } - }, + } ); return episodeLinks; } catch (err) { - console.error('cl episode links', err); + console.error("cl episode links", err); return []; } }; diff --git a/providers/cinemaLuxe/index.ts b/providers/cinemaLuxe/index.ts deleted file mode 100644 index 5631520..0000000 --- a/providers/cinemaLuxe/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {clGenresList, clCatalog} from './clCatalog'; -import {clGetInfo} from './clGetMeta'; -import {clsEpisodeLinks} from './clGetEpisodes'; -import {clGetPostsSearch, clGetPosts} from './clGetPosts'; -import {ProviderType} from '../types'; -import {clGetStream} from './clGetSteam'; - -export const cinemaLuxe: ProviderType = { - catalog: clCatalog, - genres: clGenresList, - GetHomePosts: clGetPosts, - GetMetaData: clGetInfo, - GetSearchPosts: clGetPostsSearch, - GetEpisodeLinks: clsEpisodeLinks, - GetStream: clGetStream, -}; diff --git a/providers/cinemaLuxe/clGetMeta.ts b/providers/cinemaLuxe/meta.ts similarity index 51% rename from providers/cinemaLuxe/clGetMeta.ts rename to providers/cinemaLuxe/meta.ts index cb563ad..81f58f3 100644 --- a/providers/cinemaLuxe/clGetMeta.ts +++ b/providers/cinemaLuxe/meta.ts @@ -1,6 +1,6 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; -export const clGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -14,36 +14,36 @@ export const clGetInfo = async function ({ }); const data = res.data; const $ = providerContext.cheerio.load(data); - const type = url.includes('tvshows') ? 'series' : 'movie'; - const imdbId = ''; - const title = url.split('/')[4].replace(/-/g, ' '); - const image = $('.g-item').find('a').attr('href') || ''; - const synopsis = $('.wp-content').text().trim(); - const tags = $('.sgeneros') + const type = url.includes("tvshows") ? "series" : "movie"; + const imdbId = ""; + const title = url.split("/")[4].replace(/-/g, " "); + const image = $(".g-item").find("a").attr("href") || ""; + const synopsis = $(".wp-content").text().trim(); + const tags = $(".sgeneros") .children() .map((i, element) => $(element).text()) .get() .slice(3); - const rating = Number($('#repimdb').find('strong').text()) + const rating = Number($("#repimdb").find("strong").text()) .toFixed(1) .toString(); const links: Link[] = []; - $('.mb-center.maxbutton-5-center,.ep-button-container').map( + $(".mb-center.maxbutton-5-center,.ep-button-container").map( (i, element) => { const title = $(element) .text() - .replace('\u2b07Download', '') - .replace('\u2b07 Download', '') + .replace("\u2b07Download", "") + .replace("\u2b07 Download", "") .trim(); - const link = $(element).find('a').attr('href'); + const link = $(element).find("a").attr("href"); if (title && link) { links.push({ title, episodesLink: link, - quality: title?.match(/\d+P\b/)?.[0].replace('P', 'p') || '', + quality: title?.match(/\d+P\b/)?.[0].replace("P", "p") || "", }); } - }, + } ); return { title, @@ -58,11 +58,11 @@ export const clGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/cinemaLuxe/clGetPosts.ts b/providers/cinemaLuxe/posts.ts similarity index 54% rename from providers/cinemaLuxe/clGetPosts.ts rename to providers/cinemaLuxe/posts.ts index c18918c..c3e1ed4 100644 --- a/providers/cinemaLuxe/clGetPosts.ts +++ b/providers/cinemaLuxe/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const clGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -11,12 +11,12 @@ export const clGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const baseUrl = await providerContext.getBaseUrl('cinemaLuxe'); + const baseUrl = await providerContext.getBaseUrl("cinemaLuxe"); const url = `${baseUrl + filter}page/${page}/`; - return posts({url, signal, providerContext}); + return posts({ url, signal, providerContext }); }; -export const clGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -28,9 +28,9 @@ export const clGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const baseUrl = await providerContext.getBaseUrl('cinemaLuxe'); + const baseUrl = await providerContext.getBaseUrl("cinemaLuxe"); const url = `${baseUrl}/page/${page}/?s=${searchQuery}`; - return posts({url, signal, providerContext}); + return posts({ url, signal, providerContext }); }; async function posts({ @@ -50,10 +50,10 @@ async function posts({ const data = await res.text(); const $ = providerContext.cheerio.load(data); const catalog: Post[] = []; - $('.item.tvshows,.item.movies').map((i, element) => { - const title = $(element).find('.poster').find('img').attr('alt'); - const link = $(element).find('.poster').find('a').attr('href'); - const image = $(element).find('.poster').find('img').attr('data-src'); + $(".item.tvshows,.item.movies").map((i, element) => { + const title = $(element).find(".poster").find("img").attr("alt"); + const link = $(element).find(".poster").find("a").attr("href"); + const image = $(element).find(".poster").find("img").attr("data-src"); if (title && link && image) { catalog.push({ title: title, @@ -62,10 +62,10 @@ async function posts({ }); } }); - $('.result-item').map((i, element) => { - const title = $(element).find('.thumbnail').find('img').attr('alt'); - const link = $(element).find('.thumbnail').find('a').attr('href'); - const image = $(element).find('.thumbnail').find('img').attr('data-src'); + $(".result-item").map((i, element) => { + const title = $(element).find(".thumbnail").find("img").attr("alt"); + const link = $(element).find(".thumbnail").find("a").attr("href"); + const image = $(element).find(".thumbnail").find("img").attr("data-src"); if (title && link && image) { catalog.push({ title: title, @@ -76,7 +76,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('cinemaluxe error ', err); + console.error("cinemaluxe error ", err); return []; } } diff --git a/providers/cinemaLuxe/clGetSteam.ts b/providers/cinemaLuxe/stream.ts similarity index 63% rename from providers/cinemaLuxe/clGetSteam.ts rename to providers/cinemaLuxe/stream.ts index 654a017..345da71 100644 --- a/providers/cinemaLuxe/clGetSteam.ts +++ b/providers/cinemaLuxe/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext} from '../types'; +import { Stream, ProviderContext } from "../types"; -export const clGetStream = async ({ +export const getStream = async ({ link, signal, providerContext, @@ -12,32 +12,32 @@ export const clGetStream = async ({ }): Promise => { try { let newLink = link; - if (link.includes('luxedrive')) { + if (link.includes("luxedrive")) { const res = await providerContext.axios.get(link); const $ = providerContext.cheerio.load(res.data); - const hubcloudLink = $('a.btn.hubcloud').attr('href'); + const hubcloudLink = $("a.btn.hubcloud").attr("href"); if (hubcloudLink) { newLink = hubcloudLink; } else { - const gdFlixLink = $('a.btn.gdflix').attr('href'); + const gdFlixLink = $("a.btn.gdflix").attr("href"); if (gdFlixLink) { newLink = gdFlixLink; } } } - if (newLink.includes('gdflix')) { + if (newLink.includes("gdflix")) { const sreams = await providerContext.extractors.gdFlixExtracter( newLink, - signal, + signal ); return sreams; } - const res2 = await providerContext.axios.get(newLink, {signal}); + const res2 = await providerContext.axios.get(newLink, { signal }); const data2 = res2.data; const hcLink = data2.match(/location\.replace\('([^']+)'/)?.[1] || newLink; const hubCloudLinks = await providerContext.extractors.hubcloudExtracter( - hcLink.includes('https://hubcloud') ? hcLink : newLink, - signal, + hcLink.includes("https://hubcloud") ? hcLink : newLink, + signal ); return hubCloudLinks; } catch (err) { diff --git a/providers/dooflix/catalog.ts b/providers/dooflix/catalog.ts new file mode 100644 index 0000000..3d8e649 --- /dev/null +++ b/providers/dooflix/catalog.ts @@ -0,0 +1,12 @@ +export const catalog = [ + { + title: "Series", + filter: "/rest-api//v130/tvseries", + }, + { + title: "Movies", + filter: "/rest-api//v130/movies", + }, +]; + +export const genres = []; diff --git a/providers/dooflix/dooCatalog.ts b/providers/dooflix/dooCatalog.ts deleted file mode 100644 index bfe119e..0000000 --- a/providers/dooflix/dooCatalog.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const dooCatalog = [ - { - title: 'Series', - filter: '/rest-api//v130/tvseries', - }, - { - title: 'Movies', - filter: '/rest-api//v130/movies', - }, -]; - -export const dooGenresList = []; diff --git a/providers/dooflix/index.ts b/providers/dooflix/index.ts deleted file mode 100644 index cf24e3a..0000000 --- a/providers/dooflix/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {ProviderType} from '../types'; -import {dooCatalog, dooGenresList} from './dooCatalog'; -import {dooGetInfo} from './dooGetInfo'; -import {dooGetPost, dooGetSearchPost} from './dooGetPosts'; -import {dooGetStream} from './dooGetSteam'; - -export const dooflixProvider: ProviderType = { - catalog: dooCatalog, - genres: dooGenresList, - GetMetaData: dooGetInfo, - GetStream: dooGetStream, - GetHomePosts: dooGetPost, - GetSearchPosts: dooGetSearchPost, -}; diff --git a/providers/dooflix/dooGetInfo.ts b/providers/dooflix/meta.ts similarity index 52% rename from providers/dooflix/dooGetInfo.ts rename to providers/dooflix/meta.ts index 6e35537..e94236a 100644 --- a/providers/dooflix/dooGetInfo.ts +++ b/providers/dooflix/meta.ts @@ -1,14 +1,14 @@ -import {EpisodeLink, Info, Link, ProviderContext} from '../types'; +import { EpisodeLink, Info, Link, ProviderContext } from "../types"; const headers = { - 'Accept-Encoding': 'gzip', - 'API-KEY': '2pm95lc6prpdbk0ppji9rsqo', - Connection: 'Keep-Alive', - 'If-Modified-Since': 'Wed, 14 Aug 2024 13:00:04 GMT', - 'User-Agent': 'okhttp/3.14.9', + "Accept-Encoding": "gzip", + "API-KEY": "2pm95lc6prpdbk0ppji9rsqo", + Connection: "Keep-Alive", + "If-Modified-Since": "Wed, 14 Aug 2024 13:00:04 GMT", + "User-Agent": "okhttp/3.14.9", }; -export const dooGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -16,25 +16,25 @@ export const dooGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios} = providerContext; - const res = await axios.get(link, {headers}); + const { axios } = providerContext; + const res = await axios.get(link, { headers }); const resData = res.data; - const jsonStart = resData?.indexOf('{'); - const jsonEnd = resData?.lastIndexOf('}') + 1; + const jsonStart = resData?.indexOf("{"); + const jsonEnd = resData?.lastIndexOf("}") + 1; const data = JSON?.parse(resData?.substring(jsonStart, jsonEnd))?.title ? JSON?.parse(resData?.substring(jsonStart, jsonEnd)) : resData; - const title = data?.title || ''; - const synopsis = data?.description || ''; - const image = data?.poster_url || ''; + const title = data?.title || ""; + const synopsis = data?.description || ""; + const image = data?.poster_url || ""; const cast = data?.cast || []; - const rating = data?.imdb_rating || ''; - const type = Number(data?.is_tvseries) ? 'series' : 'movie'; + const rating = data?.imdb_rating || ""; + const type = Number(data?.is_tvseries) ? "series" : "movie"; const tags = data?.genre?.map((genre: any) => genre?.name) || []; const links: Link[] = []; - if (type === 'series') { + if (type === "series") { data?.season?.map((season: any) => { - const title = season?.seasons_name || ''; + const title = season?.seasons_name || ""; const directLinks: EpisodeLink[] = season?.episodes?.map((episode: any) => ({ title: episode?.episodes_name, @@ -48,10 +48,10 @@ export const dooGetInfo = async function ({ } else { data?.videos?.map((video: any) => { links.push({ - title: title + ' ' + video?.label, + title: title + " " + video?.label, directLinks: [ { - title: 'Play', + title: "Play", link: video?.file_url, }, ], @@ -59,11 +59,11 @@ export const dooGetInfo = async function ({ }); } return { - image: image?.includes('https') ? image : image?.replace('http', 'https'), + image: image?.includes("https") ? image : image?.replace("http", "https"), synopsis: synopsis, title: title, rating: rating, - imdbId: '', + imdbId: "", cast: cast, tags: tags, type: type, @@ -72,11 +72,11 @@ export const dooGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/dooflix/dooGetPosts.ts b/providers/dooflix/posts.ts similarity index 59% rename from providers/dooflix/dooGetPosts.ts rename to providers/dooflix/posts.ts index e79ed0d..c1159e5 100644 --- a/providers/dooflix/dooGetPosts.ts +++ b/providers/dooflix/posts.ts @@ -1,14 +1,14 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; const headers = { - 'Accept-Encoding': 'gzip', - 'API-KEY': '2pm95lc6prpdbk0ppji9rsqo', - Connection: 'Keep-Alive', - 'If-Modified-Since': 'Wed, 14 Aug 2024 13:00:04 GMT', - 'User-Agent': 'okhttp/3.14.9', + "Accept-Encoding": "gzip", + "API-KEY": "2pm95lc6prpdbk0ppji9rsqo", + Connection: "Keep-Alive", + "If-Modified-Since": "Wed, 14 Aug 2024 13:00:04 GMT", + "User-Agent": "okhttp/3.14.9", }; -export const dooGetPost = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -21,23 +21,23 @@ export const dooGetPost = async function ({ signal: AbortSignal; }): Promise { try { - const {axios, getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('dooflix'); + const { axios, getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("dooflix"); const catalog: Post[] = []; const url = `${baseUrl + filter + `?page=${page}`}`; - const res = await axios.get(url, {headers, signal}); + const res = await axios.get(url, { headers, signal }); const resData = res.data; - if (!resData || typeof resData !== 'string') { - console.warn('Unexpected response format from dooflix API'); + if (!resData || typeof resData !== "string") { + console.warn("Unexpected response format from dooflix API"); return []; } let data; try { - const jsonStart = resData.indexOf('['); - const jsonEnd = resData.lastIndexOf(']') + 1; + const jsonStart = resData.indexOf("["); + const jsonEnd = resData.lastIndexOf("]") + 1; if (jsonStart === -1 || jsonEnd <= jsonStart) { // If we can't find valid JSON array markers, try parsing the entire response @@ -48,12 +48,12 @@ export const dooGetPost = async function ({ data = parsedArray.length > 0 ? parsedArray : resData; } } catch (parseError) { - console.error('Error parsing dooflix response:', parseError); + console.error("Error parsing dooflix response:", parseError); return []; } if (!Array.isArray(data)) { - console.warn('Unexpected data format from dooflix API'); + console.warn("Unexpected data format from dooflix API"); return []; } @@ -61,16 +61,16 @@ export const dooGetPost = async function ({ const id = result?.videos_id; if (!id) return; - const type = !result?.is_tvseries ? 'tvseries' : 'movie'; + const type = !result?.is_tvseries ? "tvseries" : "movie"; const link = `${baseUrl}/rest-api//v130/single_details?type=${type}&id=${id}`; const thumbnailUrl = result?.thumbnail_url; - const image = thumbnailUrl?.includes('https') + const image = thumbnailUrl?.includes("https") ? thumbnailUrl - : thumbnailUrl?.replace('http', 'https'); + : thumbnailUrl?.replace("http", "https"); catalog.push({ - title: result?.title || '', + title: result?.title || "", link, image, }); @@ -78,12 +78,12 @@ export const dooGetPost = async function ({ return catalog; } catch (err) { - console.error('dooflix error:', err); + console.error("dooflix error:", err); return []; } }; -export const dooGetSearchPost = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, providerContext, @@ -99,23 +99,23 @@ export const dooGetSearchPost = async function ({ if (page > 1) { return []; } - const {axios, getBaseUrl} = providerContext; + const { axios, getBaseUrl } = providerContext; const catalog: Post[] = []; - const baseUrl = await getBaseUrl('dooflix'); + const baseUrl = await getBaseUrl("dooflix"); const url = `${baseUrl}/rest-api//v130/search?q=${searchQuery}&type=movietvserieslive&range_to=0&range_from=0&tv_category_id=0&genre_id=0&country_id=0`; - const res = await axios.get(url, {headers, signal}); + const res = await axios.get(url, { headers, signal }); const resData = res.data; - if (!resData || typeof resData !== 'string') { - console.warn('Unexpected search response format from dooflix API'); + if (!resData || typeof resData !== "string") { + console.warn("Unexpected search response format from dooflix API"); return []; } let data; try { - const jsonStart = resData.indexOf('{'); - const jsonEnd = resData.lastIndexOf('}') + 1; + const jsonStart = resData.indexOf("{"); + const jsonEnd = resData.lastIndexOf("}") + 1; if (jsonStart === -1 || jsonEnd <= jsonStart) { data = resData; @@ -125,7 +125,7 @@ export const dooGetSearchPost = async function ({ data = parsedData?.movie ? parsedData : resData; } } catch (parseError) { - console.error('Error parsing dooflix search response:', parseError); + console.error("Error parsing dooflix search response:", parseError); return []; } @@ -136,12 +136,12 @@ export const dooGetSearchPost = async function ({ const link = `${baseUrl}/rest-api//v130/single_details?type=movie&id=${id}`; const thumbnailUrl = result?.thumbnail_url; - const image = thumbnailUrl?.includes('https') + const image = thumbnailUrl?.includes("https") ? thumbnailUrl - : thumbnailUrl?.replace('http', 'https'); + : thumbnailUrl?.replace("http", "https"); catalog.push({ - title: result?.title || '', + title: result?.title || "", link, image, }); @@ -154,12 +154,12 @@ export const dooGetSearchPost = async function ({ const link = `${baseUrl}/rest-api//v130/single_details?type=tvseries&id=${id}`; const thumbnailUrl = result?.thumbnail_url; - const image = thumbnailUrl?.includes('https') + const image = thumbnailUrl?.includes("https") ? thumbnailUrl - : thumbnailUrl?.replace('http', 'https'); + : thumbnailUrl?.replace("http", "https"); catalog.push({ - title: result?.title || '', + title: result?.title || "", link, image, }); @@ -167,7 +167,7 @@ export const dooGetSearchPost = async function ({ return catalog; } catch (error) { - console.error('dooflix search error:', error); + console.error("dooflix search error:", error); return []; } }; diff --git a/providers/dooflix/dooGetSteam.ts b/providers/dooflix/stream.ts similarity index 54% rename from providers/dooflix/dooGetSteam.ts rename to providers/dooflix/stream.ts index ed0f8aa..10dafd4 100644 --- a/providers/dooflix/dooGetSteam.ts +++ b/providers/dooflix/stream.ts @@ -1,6 +1,6 @@ -import {Stream} from '../types'; +import { Stream } from "../types"; -export const dooGetStream = async function ({ +export const getStream = async function ({ link, }: { link: string; @@ -8,19 +8,19 @@ export const dooGetStream = async function ({ try { const streams: Stream[] = []; streams.push({ - server: 'Dooflix', + server: "Dooflix", link: link, - type: 'm3u8', + type: "m3u8", headers: { - Connection: 'Keep-Alive', - 'User-Agent': - 'Mozilla/5.0 (WindowsNT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.37', - Referer: 'https://molop.art/', + Connection: "Keep-Alive", + "User-Agent": + "Mozilla/5.0 (WindowsNT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.37", + Referer: "https://molop.art/", Cookie: - 'cf_clearance=M2_2Hy4lKRy_ruRX3dzOgm3iho1FHe2DUC1lq28BUtI-1737377622-1.2.1.1-6R8RaH94._H2BuNuotsjTZ3fAF6cLwPII0guemu9A5Xa46lpCJPuELycojdREwoonYS2kRTYcZ9_1c4h4epi2LtDvMM9jIoOZKE9pIdWa30peM1hRMpvffTjGUCraHsJNCJez8S_QZ6XkkdP7GeQ5iwiYaI6Grp6qSJWoq0Hj8lS7EITZ1LzyrALI6iLlYjgLmgLGa1VuhORWJBN8ZxrJIZ_ba_pqbrR9fjnyToqxZ0XQaZfk1d3rZyNWoZUjI98GoAxVjnKtcBQQG6b2jYPJuMbbYraGoa54N7E7BR__7o', + "cf_clearance=M2_2Hy4lKRy_ruRX3dzOgm3iho1FHe2DUC1lq28BUtI-1737377622-1.2.1.1-6R8RaH94._H2BuNuotsjTZ3fAF6cLwPII0guemu9A5Xa46lpCJPuELycojdREwoonYS2kRTYcZ9_1c4h4epi2LtDvMM9jIoOZKE9pIdWa30peM1hRMpvffTjGUCraHsJNCJez8S_QZ6XkkdP7GeQ5iwiYaI6Grp6qSJWoq0Hj8lS7EITZ1LzyrALI6iLlYjgLmgLGa1VuhORWJBN8ZxrJIZ_ba_pqbrR9fjnyToqxZ0XQaZfk1d3rZyNWoZUjI98GoAxVjnKtcBQQG6b2jYPJuMbbYraGoa54N7E7BR__7o", }, }); - console.log('doo streams', streams); + console.log("doo streams", streams); return streams; } catch (err) { console.error(err); diff --git a/providers/drive/catalog.ts b/providers/drive/catalog.ts index b792eff..4621818 100644 --- a/providers/drive/catalog.ts +++ b/providers/drive/catalog.ts @@ -1,61 +1,61 @@ -export const driveCatalog = [ +export const catalog = [ { - title: 'Latest', - filter: '', + title: "Latest", + filter: "", }, { - title: 'Anime', - filter: 'category/anime/', + title: "Anime", + filter: "category/anime/", }, { - title: 'Netflix', - filter: 'category/netflix/', + title: "Netflix", + filter: "category/netflix/", }, { - title: '4K', - filter: 'category/2160p-4k/', + title: "4K", + filter: "category/2160p-4k/", }, ]; -export const driveGenresList = [ +export const genres = [ { - title: 'Action', - filter: '/category/action', + title: "Action", + filter: "/category/action", }, { - title: 'Crime', - filter: '/category/crime', + title: "Crime", + filter: "/category/crime", }, { - title: 'Comedy', - filter: '/category/comedy', + title: "Comedy", + filter: "/category/comedy", }, { - title: 'Drama', - filter: '/category/drama', + title: "Drama", + filter: "/category/drama", }, { - title: 'Horror', - filter: '/category/horror', + title: "Horror", + filter: "/category/horror", }, { - title: 'Family', - filter: '/category/family', + title: "Family", + filter: "/category/family", }, { - title: 'Sci-Fi', - filter: '/category/sifi', + title: "Sci-Fi", + filter: "/category/sifi", }, { - title: 'Thriller', - filter: '/category/triller', + title: "Thriller", + filter: "/category/triller", }, { - title: 'Romance', - filter: '/category/romance', + title: "Romance", + filter: "/category/romance", }, { - title: 'Fight', - filter: '/category/fight', + title: "Fight", + filter: "/category/fight", }, ]; diff --git a/providers/drive/driveGetEpisodesList.ts b/providers/drive/episodes.ts similarity index 60% rename from providers/drive/driveGetEpisodesList.ts rename to providers/drive/episodes.ts index 92f6a7e..130ae7a 100644 --- a/providers/drive/driveGetEpisodesList.ts +++ b/providers/drive/episodes.ts @@ -1,6 +1,6 @@ -import {EpisodeLink, ProviderContext} from '../types'; +import { EpisodeLink, ProviderContext } from "../types"; -export const driveGetEpisodeLinks = async function ({ +export const getEpisodes = async function ({ url, providerContext, }: { @@ -8,7 +8,7 @@ export const driveGetEpisodeLinks = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const res = await axios.get(url); const html = res.data; let $ = cheerio.load(html); @@ -16,10 +16,10 @@ export const driveGetEpisodeLinks = async function ({ const episodeLinks: EpisodeLink[] = []; $('a:contains("HubCloud")').map((i, element) => { const title = $(element).parent().prev().text(); - const link = $(element).attr('href'); - if (link && (title.includes('Ep') || title.includes('Download'))) { + const link = $(element).attr("href"); + if (link && (title.includes("Ep") || title.includes("Download"))) { episodeLinks.push({ - title: title.includes('Download') ? 'Play' : title, + title: title.includes("Download") ? "Play" : title, link, }); } @@ -31,7 +31,7 @@ export const driveGetEpisodeLinks = async function ({ console.error(err); return [ { - title: 'Server 1', + title: "Server 1", link: url, }, ]; diff --git a/providers/drive/index.ts b/providers/drive/index.ts deleted file mode 100644 index 802cd4d..0000000 --- a/providers/drive/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {ProviderType} from '../../Manifest'; -import {driveCatalog, driveGenresList} from './catalog'; -import {driveGetEpisodeLinks} from './driveGetEpisodesList'; -import {driveGetInfo} from './driveGetInfo'; -import {driveGetPosts, driveGetSearchPost} from './driveGetPosts'; -import {driveGetStream} from './driveGetStream'; - -export const moviesDrive: ProviderType = { - catalog: driveCatalog, - genres: driveGenresList, - GetMetaData: driveGetInfo, - GetHomePosts: driveGetPosts, - GetStream: driveGetStream, - GetEpisodeLinks: driveGetEpisodeLinks, - GetSearchPosts: driveGetSearchPost, -}; diff --git a/providers/drive/driveGetInfo.ts b/providers/drive/meta.ts similarity index 55% rename from providers/drive/driveGetInfo.ts rename to providers/drive/meta.ts index 1a6b583..3561e7c 100644 --- a/providers/drive/driveGetInfo.ts +++ b/providers/drive/meta.ts @@ -1,6 +1,6 @@ -import {Info, Link} from '../types'; +import { Info, Link } from "../types"; -export const driveGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -12,56 +12,56 @@ export const driveGetInfo = async function ({ }; }): Promise { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const url = link; const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); - const type = $('.left-wrapper') + const type = $(".left-wrapper") .text() .toLocaleLowerCase() - .includes('movie name') - ? 'movie' - : 'series'; - const imdbId = $('a:contains("IMDb")').attr('href')?.split('/')[4] || ''; + .includes("movie name") + ? "movie" + : "series"; + const imdbId = $('a:contains("IMDb")').attr("href")?.split("/")[4] || ""; const title = - $('.left-wrapper').find('strong:contains("Name")').next().text() || - $('.left-wrapper') + $(".left-wrapper").find('strong:contains("Name")').next().text() || + $(".left-wrapper") .find('strong:contains("Name"),h5:contains("Name")') - .find('span:first') + .find("span:first") .text(); const synopsis = - $('.left-wrapper') + $(".left-wrapper") .find( - 'h2:contains("Storyline"),h3:contains("Storyline"),h5:contains("Storyline"),h4:contains("Storyline"),h4:contains("STORYLINE")', + 'h2:contains("Storyline"),h3:contains("Storyline"),h5:contains("Storyline"),h4:contains("Storyline"),h4:contains("STORYLINE")' ) .next() .text() || - $('.ipc-html-content-inner-div').text() || - ''; + $(".ipc-html-content-inner-div").text() || + ""; const image = - $('img.entered.lazyloaded,img.entered,img.litespeed-loaded').attr( - 'src', + $("img.entered.lazyloaded,img.entered,img.litespeed-loaded").attr( + "src" ) || - $('img.aligncenter').attr('src') || - ''; + $("img.aligncenter").attr("src") || + ""; // Links const links: Link[] = []; $( - 'a:contains("1080")a:not(:contains("Zip")),a:contains("720")a:not(:contains("Zip")),a:contains("480")a:not(:contains("Zip")),a:contains("2160")a:not(:contains("Zip")),a:contains("4k")a:not(:contains("Zip"))', + 'a:contains("1080")a:not(:contains("Zip")),a:contains("720")a:not(:contains("Zip")),a:contains("480")a:not(:contains("Zip")),a:contains("2160")a:not(:contains("Zip")),a:contains("4k")a:not(:contains("Zip"))' ).map((i: number, element: any) => { - const title = $(element).parent('h5').prev().text(); - const episodesLink = $(element).attr('href'); - const quality = title.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ''; + const title = $(element).parent("h5").prev().text(); + const episodesLink = $(element).attr("href"); + const quality = title.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ""; if (episodesLink && title) { links.push({ title, - episodesLink: type === 'series' ? episodesLink : '', + episodesLink: type === "series" ? episodesLink : "", directLinks: - type === 'movie' - ? [{title: 'Movie', link: episodesLink, type: 'movie'}] + type === "movie" + ? [{ title: "Movie", link: episodesLink, type: "movie" }] : [], quality: quality, }); @@ -69,7 +69,7 @@ export const driveGetInfo = async function ({ }); // console.log('drive meta', title, synopsis, image, imdbId, type, links); - console.log('drive meta', links, type); + console.log("drive meta", links, type); return { title, synopsis, @@ -81,11 +81,11 @@ export const driveGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/drive/driveGetPosts.ts b/providers/drive/posts.ts similarity index 53% rename from providers/drive/driveGetPosts.ts rename to providers/drive/posts.ts index ba336d1..d3af9e4 100644 --- a/providers/drive/driveGetPosts.ts +++ b/providers/drive/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const driveGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -12,13 +12,13 @@ export const driveGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('drive'); + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("drive"); const url = `${baseUrl + filter}/page/${page}/`; - return posts({url, signal, providerContext}); + return posts({ url, signal, providerContext }); }; -export const driveGetSearchPost = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -30,10 +30,10 @@ export const driveGetSearchPost = async function ({ providerContext: ProviderContext; signal: AbortSignal; }): Promise { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('drive'); + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("drive"); const url = `${baseUrl}page/${page}/?s=${searchQuery}`; - return posts({url, signal, providerContext}); + return posts({ url, signal, providerContext }); }; async function posts({ @@ -46,20 +46,20 @@ async function posts({ providerContext: ProviderContext; }): Promise { try { - const {cheerio} = providerContext; - const res = await fetch(url, {signal}); + const { cheerio } = providerContext; + const res = await fetch(url, { signal }); const data = await res.text(); const $ = cheerio.load(data); const catalog: Post[] = []; - $('.recent-movies') + $(".recent-movies") .children() .map((i, element) => { - const title = $(element).find('figure').find('img').attr('alt'); - const link = $(element).find('a').attr('href'); - const image = $(element).find('figure').find('img').attr('src'); + const title = $(element).find("figure").find("img").attr("alt"); + const link = $(element).find("a").attr("href"); + const image = $(element).find("figure").find("img").attr("src"); if (title && link && image) { catalog.push({ - title: title.replace('Download', '').trim(), + title: title.replace("Download", "").trim(), link: link, image: image, }); @@ -67,7 +67,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('drive error ', err); + console.error("drive error ", err); return []; } } diff --git a/providers/drive/driveGetStream.ts b/providers/drive/stream.ts similarity index 52% rename from providers/drive/driveGetStream.ts rename to providers/drive/stream.ts index d163123..0f83e4d 100644 --- a/providers/drive/driveGetStream.ts +++ b/providers/drive/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext} from '../types'; +import { Stream, ProviderContext } from "../types"; -export const driveGetStream = async function ({ +export const getStream = async function ({ link: url, type, signal, @@ -13,35 +13,35 @@ export const driveGetStream = async function ({ }): Promise { const headers = providerContext.commonHeaders; try { - if (type === 'movie') { - const res = await providerContext.axios.get(url, {headers}); + if (type === "movie") { + const res = await providerContext.axios.get(url, { headers }); const html = res.data; const $ = providerContext.cheerio.load(html); - const link = $('a:contains("HubCloud")').attr('href'); + const link = $('a:contains("HubCloud")').attr("href"); url = link || url; } - const res = await providerContext.axios.get(url, {headers}); + const res = await providerContext.axios.get(url, { headers }); let redirectUrl = res.data.match( - //i, + //i )?.[1]; - if (url.includes('/archives/')) { + if (url.includes("/archives/")) { redirectUrl = res.data.match( - /]*href="(https:\/\/hubcloud\.[^\/]+\/[^"]+)"/i, + /]*href="(https:\/\/hubcloud\.[^\/]+\/[^"]+)"/i )?.[1]; } if (!redirectUrl) { return await providerContext.extractors.hubcloudExtracter(url, signal); } - const res2 = await providerContext.axios.get(redirectUrl, {headers}); + const res2 = await providerContext.axios.get(redirectUrl, { headers }); const data = res2.data; const $ = providerContext.cheerio.load(data); - const hubcloudLink = $('.fa-file-download').parent().attr('href'); + const hubcloudLink = $(".fa-file-download").parent().attr("href"); return await providerContext.extractors.hubcloudExtracter( - hubcloudLink?.includes('https://hubcloud') ? hubcloudLink : redirectUrl, - signal, + hubcloudLink?.includes("https://hubcloud") ? hubcloudLink : redirectUrl, + signal ); } catch (err) { - console.error('Movies Drive err', err); + console.error("Movies Drive err", err); return []; } }; diff --git a/providers/filmyfly/catalog.ts b/providers/filmyfly/catalog.ts new file mode 100644 index 0000000..96f9de0 --- /dev/null +++ b/providers/filmyfly/catalog.ts @@ -0,0 +1,16 @@ +export const catalog = [ + { + title: "Home", + filter: "", + }, + { + title: "Web Series", + filter: "/page-cat/42/Web-Series.html", + }, + { + title: "Hollywood", + filter: "/page-cat/9/New-Hollywood-Hindi-Dubbed-Movie-2016-2025.html", + }, +]; + +export const genres = []; diff --git a/providers/filmyfly/ffGetEpisodes.ts b/providers/filmyfly/episodes.ts similarity index 54% rename from providers/filmyfly/ffGetEpisodes.ts rename to providers/filmyfly/episodes.ts index 6a537a0..8a5eb04 100644 --- a/providers/filmyfly/ffGetEpisodes.ts +++ b/providers/filmyfly/episodes.ts @@ -1,6 +1,6 @@ -import {EpisodeLink, ProviderContext} from '../types'; +import { EpisodeLink, ProviderContext } from "../types"; -export const ffEpisodeLinks = async function ({ +export const getEpisodes = async function ({ url, providerContext, }: { @@ -9,19 +9,19 @@ export const ffEpisodeLinks = async function ({ }): Promise { try { const headers = providerContext.commonHeaders; - const {axios, cheerio} = providerContext; - const res = await axios.get(url, {headers}); + const { axios, cheerio } = providerContext; + const res = await axios.get(url, { headers }); const data = res.data; const $ = cheerio.load(data); const episodeLinks: EpisodeLink[] = []; - $('.dlink.dl').map((i, element) => { + $(".dlink.dl").map((i, element) => { const title = $(element) - .find('a') + .find("a") .text() - ?.replace('Download', '') + ?.replace("Download", "") ?.trim(); - const link = $(element).find('a').attr('href'); + const link = $(element).find("a").attr("href"); if (title && link) { episodeLinks.push({ @@ -32,7 +32,7 @@ export const ffEpisodeLinks = async function ({ }); return episodeLinks; } catch (err) { - console.error('cl episode links', err); + console.error("cl episode links", err); return []; } }; diff --git a/providers/filmyfly/ffCatalog.ts b/providers/filmyfly/ffCatalog.ts deleted file mode 100644 index b3c6929..0000000 --- a/providers/filmyfly/ffCatalog.ts +++ /dev/null @@ -1,16 +0,0 @@ -export const ffCatalog = [ - { - title: 'Home', - filter: '', - }, - { - title: 'Web Series', - filter: '/page-cat/42/Web-Series.html', - }, - { - title: 'Hollywood', - filter: '/page-cat/9/New-Hollywood-Hindi-Dubbed-Movie-2016-2025.html', - }, -]; - -export const ffGenresList = []; diff --git a/providers/filmyfly/ffGetMeta.ts b/providers/filmyfly/ffGetMeta.ts deleted file mode 100644 index 616ee57..0000000 --- a/providers/filmyfly/ffGetMeta.ts +++ /dev/null @@ -1,56 +0,0 @@ -import {Info, Link, ProviderContext} from '../types'; - -export const ffGetInfo = async function ({ - link, - providerContext, -}: { - link: string; - providerContext: ProviderContext; -}): Promise { - try { - const {axios, cheerio, commonHeaders: headers} = providerContext; - const url = link; - const res = await axios.get(url, {headers}); - const data = res.data; - const $ = cheerio.load(data); - const type = url.includes('tvshows') ? 'series' : 'movie'; - const imdbId = ''; - const title = $('.fname:contains("Name")').find('.colora').text().trim(); - const image = $('.ss').find('img').attr('src') || ''; - const synopsis = $('.fname:contains("Description")') - .find('.colorg') - .text() - .trim(); - const tags = - $('.fname:contains("Genre")').find('.colorb').text().split(',') || []; - const rating = ''; - const links: Link[] = []; - const downloadLink = $('.dlbtn').find('a').attr('href'); - if (downloadLink) { - links.push({ - title: title, - episodesLink: downloadLink, - }); - } - return { - title, - tags, - rating, - synopsis, - image, - imdbId, - type, - linkList: links, - }; - } catch (err) { - console.error(err); - return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', - linkList: [], - }; - } -}; diff --git a/providers/filmyfly/index.ts b/providers/filmyfly/index.ts deleted file mode 100644 index 255652d..0000000 --- a/providers/filmyfly/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {ProviderType} from '../types'; -import {ffCatalog, ffGenresList} from './ffCatalog'; -import {ffEpisodeLinks} from './ffGetEpisodes'; -import {ffGetInfo} from './ffGetMeta'; -import {ffGetPosts, ffGetPostsSearch} from './ffGetPosts'; -import {ffGetStream} from './ffGetStream'; - -export const filmyfly: ProviderType = { - catalog: ffCatalog, - genres: ffGenresList, - GetHomePosts: ffGetPosts, - GetMetaData: ffGetInfo, - GetSearchPosts: ffGetPostsSearch, - GetEpisodeLinks: ffEpisodeLinks, - GetStream: ffGetStream, -}; diff --git a/providers/filmyfly/meta.ts b/providers/filmyfly/meta.ts new file mode 100644 index 0000000..421d18b --- /dev/null +++ b/providers/filmyfly/meta.ts @@ -0,0 +1,56 @@ +import { Info, Link, ProviderContext } from "../types"; + +export const getMeta = async function ({ + link, + providerContext, +}: { + link: string; + providerContext: ProviderContext; +}): Promise { + try { + const { axios, cheerio, commonHeaders: headers } = providerContext; + const url = link; + const res = await axios.get(url, { headers }); + const data = res.data; + const $ = cheerio.load(data); + const type = url.includes("tvshows") ? "series" : "movie"; + const imdbId = ""; + const title = $('.fname:contains("Name")').find(".colora").text().trim(); + const image = $(".ss").find("img").attr("src") || ""; + const synopsis = $('.fname:contains("Description")') + .find(".colorg") + .text() + .trim(); + const tags = + $('.fname:contains("Genre")').find(".colorb").text().split(",") || []; + const rating = ""; + const links: Link[] = []; + const downloadLink = $(".dlbtn").find("a").attr("href"); + if (downloadLink) { + links.push({ + title: title, + episodesLink: downloadLink, + }); + } + return { + title, + tags, + rating, + synopsis, + image, + imdbId, + type, + linkList: links, + }; + } catch (err) { + console.error(err); + return { + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", + linkList: [], + }; + } +}; diff --git a/providers/filmyfly/ffGetPosts.ts b/providers/filmyfly/posts.ts similarity index 55% rename from providers/filmyfly/ffGetPosts.ts rename to providers/filmyfly/posts.ts index db7cfd6..680a802 100644 --- a/providers/filmyfly/ffGetPosts.ts +++ b/providers/filmyfly/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const ffGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -12,13 +12,13 @@ export const ffGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('filmyfly'); + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("filmyfly"); const url = `${baseUrl + filter}/${page}`; - return posts({url, signal, baseUrl, providerContext}); + return posts({ url, signal, baseUrl, providerContext }); }; -export const ffGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -30,13 +30,13 @@ export const ffGetPostsSearch = async function ({ providerContext: ProviderContext; signal: AbortSignal; }): Promise { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('filmyfly'); + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("filmyfly"); const url = `${baseUrl}/site-1.html?to-search=${searchQuery}`; if (page > 1) { return []; } - return posts({url, signal, baseUrl, providerContext}); + return posts({ url, signal, baseUrl, providerContext }); }; async function posts({ @@ -51,16 +51,16 @@ async function posts({ providerContext: ProviderContext; }): Promise { try { - const {cheerio, commonHeaders: headers} = providerContext; - const res = await fetch(url, {headers, signal}); + const { cheerio, commonHeaders: headers } = providerContext; + const res = await fetch(url, { headers, signal }); const data = await res.text(); const $ = cheerio.load(data); const catalog: Post[] = []; - $('.A2,.A10,.fl').map((i, element) => { + $(".A2,.A10,.fl").map((i, element) => { const title = - $(element).find('a').eq(1).text() || $(element).find('b').text(); - const link = $(element).find('a').attr('href'); - const image = $(element).find('img').attr('src'); + $(element).find("a").eq(1).text() || $(element).find("b").text(); + const link = $(element).find("a").attr("href"); + const image = $(element).find("img").attr("src"); if (title && link && image) { catalog.push({ title: title, @@ -71,7 +71,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('ff error ', err); + console.error("ff error ", err); return []; } } diff --git a/providers/filmyfly/ffGetStream.ts b/providers/filmyfly/stream.ts similarity index 53% rename from providers/filmyfly/ffGetStream.ts rename to providers/filmyfly/stream.ts index 8176a44..57464df 100644 --- a/providers/filmyfly/ffGetStream.ts +++ b/providers/filmyfly/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext} from '../types'; +import { Stream, ProviderContext } from "../types"; -export const ffGetStream = async function ({ +export const getStream = async function ({ link, signal, providerContext, @@ -11,34 +11,34 @@ export const ffGetStream = async function ({ providerContext: ProviderContext; }): Promise { try { - const res = await providerContext.axios.get(link, {signal}); + const res = await providerContext.axios.get(link, { signal }); const data = res.data; const $ = providerContext.cheerio.load(data); const streams: Stream[] = []; - const elements = $('.button2,.button1,.button3,.button4,.button').toArray(); - const promises = elements.map(async element => { + const elements = $(".button2,.button1,.button3,.button4,.button").toArray(); + const promises = elements.map(async (element) => { const title = $(element).text(); - let link = $(element).attr('href'); - if (title.includes('GDFLIX') && link) { + let link = $(element).attr("href"); + if (title.includes("GDFLIX") && link) { const gdLinks = await providerContext.extractors.gdFlixExtracter( link, - signal, + signal ); streams.push(...gdLinks); } - const alreadyAdded = streams.find(s => s.link === link); + const alreadyAdded = streams.find((s) => s.link === link); if ( title && link && - !title.includes('Watch') && - !title.includes('Login') && - !title.includes('GoFile') && + !title.includes("Watch") && + !title.includes("Login") && + !title.includes("GoFile") && !alreadyAdded ) { streams.push({ server: title, link: link, - type: 'mkv', + type: "mkv", }); } }); diff --git a/providers/flixhq/catalog.ts b/providers/flixhq/catalog.ts new file mode 100644 index 0000000..fbde61c --- /dev/null +++ b/providers/flixhq/catalog.ts @@ -0,0 +1,16 @@ +export const catalog = [ + { + title: "Trending", + filter: "/trending", + }, + { + title: "Movies", + filter: "/recent-movies", + }, + { + title: "TV Shows", + filter: "/recent-shows", + }, +]; + +export const genres = []; diff --git a/providers/flixhq/flixhqCatalog.ts b/providers/flixhq/flixhqCatalog.ts deleted file mode 100644 index 1f92cf0..0000000 --- a/providers/flixhq/flixhqCatalog.ts +++ /dev/null @@ -1,16 +0,0 @@ -export const flixhqCatalog = [ - { - title: 'Trending', - filter: '/trending', - }, - { - title: 'Movies', - filter: '/recent-movies', - }, - { - title: 'TV Shows', - filter: '/recent-shows', - }, -]; - -export const flixhqGenresList = []; diff --git a/providers/flixhq/index.ts b/providers/flixhq/index.ts deleted file mode 100644 index d6e95bf..0000000 --- a/providers/flixhq/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {ProviderType} from '../types'; -import {flixhqCatalog, flixhqGenresList} from './flixhqCatalog'; -import {flixhqGetInfo} from './flixhqGetInfo'; -import {flixhqGetPosts, flixhqGetSearchPost} from './flixhqGetPosts'; -import {flixhqGetStream} from './flixhqGetStream'; - -export const flixhq: ProviderType = { - catalog: flixhqCatalog, - genres: flixhqGenresList, - GetMetaData: flixhqGetInfo, - GetHomePosts: flixhqGetPosts, - GetStream: flixhqGetStream, - GetSearchPosts: flixhqGetSearchPost, - nonDownloadableServer: ['upcloud-MultiQuality', 'vidcloud-MultiQuality'], - nonStreamableServer: [ - 'upcloud-1080', - 'upcloud-720', - 'upcloud-480', - 'upcloud-360', - 'vidcloud-1080', - 'vidcloud-720', - 'vidcloud-480', - 'vidcloud-360', - ], -}; diff --git a/providers/flixhq/flixhqGetInfo.ts b/providers/flixhq/meta.ts similarity index 57% rename from providers/flixhq/flixhqGetInfo.ts rename to providers/flixhq/meta.ts index 816e089..a0bba46 100644 --- a/providers/flixhq/flixhqGetInfo.ts +++ b/providers/flixhq/meta.ts @@ -1,6 +1,6 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; -export const flixhqGetInfo = async function ({ +export const getMeta = async function ({ link: id, providerContext, }: { @@ -8,28 +8,28 @@ export const flixhqGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('consumet'); + const { axios, getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("consumet"); const url = `${baseUrl}/movies/flixhq/info?id=` + id; const res = await axios.get(url); const data = res.data; const meta = { title: data.title, - synopsis: data.description.replace(/<[^>]*>?/gm, '').trim(), + synopsis: data.description.replace(/<[^>]*>?/gm, "").trim(), image: data.cover, cast: data.casts, rating: data.rating, - tags: [data?.type, data?.duration, data.releaseDate.split('-')[0]], - imdbId: '', - type: data.episodes.length > 1 ? 'series' : 'movie', + tags: [data?.type, data?.duration, data.releaseDate.split("-")[0]], + imdbId: "", + type: data.episodes.length > 1 ? "series" : "movie", }; - const links: Link['directLinks'] = []; + const links: Link["directLinks"] = []; data.episodes.forEach((episode: any) => { const title = episode?.number - ? 'Season-' + episode?.season + ' Ep-' + episode.number + ? "Season-" + episode?.season + " Ep-" + episode.number : episode.title; - const link = episode.id + '*' + data.id; + const link = episode.id + "*" + data.id; if (link && title) { links.push({ title, @@ -50,11 +50,11 @@ export const flixhqGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/flixhq/flixhqGetPosts.ts b/providers/flixhq/posts.ts similarity index 60% rename from providers/flixhq/flixhqGetPosts.ts rename to providers/flixhq/posts.ts index 3fa438c..a215192 100644 --- a/providers/flixhq/flixhqGetPosts.ts +++ b/providers/flixhq/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const flixhqGetPosts = async function ({ +export const getPosts = async function ({ filter, signal, providerContext, @@ -11,14 +11,14 @@ export const flixhqGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl} = providerContext; - const urlRes = await getBaseUrl('consumet'); - const baseUrl = urlRes + '/movies/flixhq'; + const { getBaseUrl } = providerContext; + const urlRes = await getBaseUrl("consumet"); + const baseUrl = urlRes + "/movies/flixhq"; const url = `${baseUrl + filter}`; - return posts({url, signal, providerContext}); + return posts({ url, signal, providerContext }); }; -export const flixhqGetSearchPost = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -30,11 +30,11 @@ export const flixhqGetSearchPost = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl} = providerContext; - const urlRes = await getBaseUrl('consumet'); - const baseUrl = urlRes + '/movies/flixhq'; + const { getBaseUrl } = providerContext; + const urlRes = await getBaseUrl("consumet"); + const baseUrl = urlRes + "/movies/flixhq"; const url = `${baseUrl}/${searchQuery}?page=${page}`; - return posts({url, signal, providerContext}); + return posts({ url, signal, providerContext }); }; async function posts({ @@ -47,8 +47,8 @@ async function posts({ providerContext: ProviderContext; }): Promise { try { - const {axios} = providerContext; - const res = await axios.get(url, {signal}); + const { axios } = providerContext; + const res = await axios.get(url, { signal }); const data = res.data?.results || res.data; const catalog: Post[] = []; data?.map((element: any) => { @@ -65,7 +65,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('flixhq error ', err); + console.error("flixhq error ", err); return []; } } diff --git a/providers/flixhq/flixhqGetStream.ts b/providers/flixhq/stream.ts similarity index 65% rename from providers/flixhq/flixhqGetStream.ts rename to providers/flixhq/stream.ts index 2f925e1..3b1c713 100644 --- a/providers/flixhq/flixhqGetStream.ts +++ b/providers/flixhq/stream.ts @@ -1,6 +1,6 @@ -import {ProviderContext, Stream, TextTrackType} from '../types'; +import { ProviderContext, Stream, TextTrackType } from "../types"; -export const flixhqGetStream = async function ({ +export const getStream = async function ({ link: id, providerContext, }: { @@ -8,10 +8,10 @@ export const flixhqGetStream = async function ({ providerContext: ProviderContext; }): Promise { try { - const {getBaseUrl} = providerContext; - const episodeId = id.split('*')[0]; - const mediaId = id.split('*')[1]; - const baseUrl = await getBaseUrl('consumet'); + const { getBaseUrl } = providerContext; + const episodeId = id.split("*")[0]; + const mediaId = id.split("*")[1]; + const baseUrl = await getBaseUrl("consumet"); const serverUrl = `${baseUrl}/movies/flixhq/servers?episodeId=${episodeId}&mediaId=${mediaId}`; const res = await fetch(serverUrl); const servers = await res.json(); @@ -20,16 +20,16 @@ export const flixhqGetStream = async function ({ const streamUrl = `${baseUrl}/movies/flixhq/watch?server=` + server.name + - '&episodeId=' + + "&episodeId=" + episodeId + - '&mediaId=' + + "&mediaId=" + mediaId; const streamRes = await fetch(streamUrl); const streamData = await streamRes.json(); - const subtitles: Stream['subtitles'] = []; + const subtitles: Stream["subtitles"] = []; if (streamData?.sources?.length > 0) { if (streamData.subtitles) { - streamData.subtitles.forEach((sub: {lang: string; url: string}) => { + streamData.subtitles.forEach((sub: { lang: string; url: string }) => { subtitles.push({ language: sub?.lang?.slice(0, 2) as any, uri: sub?.url, @@ -42,10 +42,10 @@ export const flixhqGetStream = async function ({ streamLinks.push({ server: server?.name + - '-' + - source?.quality?.replace('auto', 'MultiQuality'), + "-" + + source?.quality?.replace("auto", "MultiQuality"), link: source.url, - type: source.isM3U8 ? 'm3u8' : 'mp4', + type: source.isM3U8 ? "m3u8" : "mp4", subtitles: subtitles, }); }); diff --git a/providers/guardahd/catalog.ts b/providers/guardahd/catalog.ts new file mode 100644 index 0000000..fa11d5f --- /dev/null +++ b/providers/guardahd/catalog.ts @@ -0,0 +1,12 @@ +export const catalog = [ + { + title: "Popular Movies", + filter: "/top/catalog/movie/top.json", + }, + { + title: "Featured Movies", + filter: "/imdbRating/catalog/movie/imdbRating.json", + }, +]; + +export const genres = []; diff --git a/providers/guardahd/guardahdCatalog.ts b/providers/guardahd/guardahdCatalog.ts deleted file mode 100644 index 07454a5..0000000 --- a/providers/guardahd/guardahdCatalog.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const guardahdCatalog = [ - { - title: 'Popular Movies', - filter: '/top/catalog/movie/top.json', - }, - { - title: 'Featured Movies', - filter: '/imdbRating/catalog/movie/imdbRating.json', - }, -]; - -export const guardahdGenresList = []; diff --git a/providers/guardahd/guardahdGetPosts.ts b/providers/guardahd/guardahdGetPosts.ts deleted file mode 100644 index 1788965..0000000 --- a/providers/guardahd/guardahdGetPosts.ts +++ /dev/null @@ -1,44 +0,0 @@ -import {Post, ProviderContext} from '../types'; - -export const guardahdGetSearchPosts = async function ({ - searchQuery, - page, - signal, - providerContext, -}: { - searchQuery: string; - page: number; - providerValue: string; - providerContext: ProviderContext; - signal: AbortSignal; -}): Promise { - try { - const {axios, commonHeaders: headers} = providerContext; - if (page > 1) { - return []; - } - const catalog: Post[] = []; - const url2 = `https://v3-cinemeta.strem.io/catalog/movie/top/search=${encodeURI( - searchQuery, - )}.json`; - const res2 = await axios.get(url2, {headers, signal}); - const data2 = res2.data; - data2?.metas.map((result: any) => { - const title = result?.name || ''; - const id = result?.imdb_id || result?.id; - const image = result?.poster; - const type = result?.type; - if (id) { - catalog.push({ - title: title, - link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`, - image: image, - }); - } - }); - return catalog; - } catch (err) { - console.error('AutoEmbed error ', err); - return []; - } -}; diff --git a/providers/guardahd/index.ts b/providers/guardahd/index.ts deleted file mode 100644 index 1a16b2d..0000000 --- a/providers/guardahd/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {guardahdCatalog, guardahdGenresList} from './guardahdCatalog'; -import {allGetInfo} from '../autoEmbed/allGetInfo'; -import {allGetPost} from '../autoEmbed/allGetPost'; -import {guardahdGetSearchPosts} from './guardahdGetPosts'; -import {ProviderType} from '../types'; -import {GuardahdGetStream} from './GetGuardahdStream'; - -export const guardahd: ProviderType = { - catalog: guardahdCatalog, - genres: guardahdGenresList, - GetMetaData: allGetInfo, - GetHomePosts: allGetPost, - GetStream: GuardahdGetStream, - GetSearchPosts: guardahdGetSearchPosts, -}; diff --git a/providers/guardahd/meta.ts b/providers/guardahd/meta.ts new file mode 100644 index 0000000..72a6032 --- /dev/null +++ b/providers/guardahd/meta.ts @@ -0,0 +1,91 @@ +import { EpisodeLink, Info, Link, ProviderContext } from "../types"; + +export const getMeta = async function ({ + link, + providerContext, +}: { + link: string; + providerContext: ProviderContext; +}): Promise { + const axios = providerContext.axios; + try { + console.log("all", link); + const res = await axios.get(link); + const data = res.data; + const meta = { + title: "", + synopsis: "", + image: "", + imdbId: data?.meta?.imdb_id || "", + type: data?.meta?.type || "movie", + }; + + const links: Link[] = []; + let directLinks: EpisodeLink[] = []; + let season = new Map(); + if (meta.type === "series") { + data?.meta?.videos?.map((video: any) => { + if (video?.season <= 0) return; + if (!season.has(video?.season)) { + season.set(video?.season, []); + } + season.get(video?.season).push({ + title: "Episode " + video?.episode, + type: "series", + link: JSON.stringify({ + title: data?.meta?.name as string, + imdbId: data?.meta?.imdb_id, + season: video?.id?.split(":")[1], + episode: video?.id?.split(":")[2], + type: data?.meta?.type, + tmdbId: data?.meta?.moviedb_id?.toString() || "", + year: data?.meta?.year, + }), + }); + }); + const keys = Array.from(season.keys()); + keys.sort(); + keys.map((key) => { + directLinks = season.get(key); + links.push({ + title: `Season ${key}`, + directLinks: directLinks, + }); + }); + } else { + console.log("all meta Mv🔥🔥", meta); + links.push({ + title: data?.meta?.name as string, + directLinks: [ + { + title: "Movie", + type: "movie", + link: JSON.stringify({ + title: data?.meta?.name as string, + imdbId: data?.meta?.imdb_id, + season: "", + episode: "", + type: data?.meta?.type, + tmdbId: data?.meta?.moviedb_id?.toString() || "", + year: data?.meta?.year, + }), + }, + ], + }); + } + return { + ...meta, + linkList: links, + }; + } catch (err) { + console.error(err); + return { + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", + linkList: [], + }; + } +}; diff --git a/providers/guardahd/posts.ts b/providers/guardahd/posts.ts new file mode 100644 index 0000000..7c86345 --- /dev/null +++ b/providers/guardahd/posts.ts @@ -0,0 +1,85 @@ +import { Post, ProviderContext } from "../types"; + +export const getPosts = async function ({ + filter, + signal, + providerContext, +}: { + filter: string; + page: number; + providerValue: string; + signal: AbortSignal; + providerContext: ProviderContext; +}): Promise { + try { + const catalog: Post[] = []; + const url = "https://cinemeta-catalogs.strem.io" + filter; + console.log("allGetPostUrl", url); + const res = await providerContext.axios.get(url, { + headers: providerContext.commonHeaders, + signal, + }); + const data = res.data; + data?.metas.map((result: any) => { + const title = result?.name; + const id = result?.imdb_id || result?.id; + const type = result?.type; + const image = result?.poster; + if (id) { + catalog.push({ + title: title, + link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`, + image: image, + }); + } + }); + console.log("catalog", catalog.length); + return catalog; + } catch (err) { + console.error("AutoEmbed error ", err); + return []; + } +}; + +export const getSearchPosts = async function ({ + searchQuery, + page, + signal, + providerContext, +}: { + searchQuery: string; + page: number; + providerValue: string; + providerContext: ProviderContext; + signal: AbortSignal; +}): Promise { + try { + const { axios, commonHeaders: headers } = providerContext; + if (page > 1) { + return []; + } + const catalog: Post[] = []; + const url2 = `https://v3-cinemeta.strem.io/catalog/movie/top/search=${encodeURI( + searchQuery + )}.json`; + const res2 = await axios.get(url2, { headers, signal }); + const data2 = res2.data; + data2?.metas.map((result: any) => { + const title = result?.name || ""; + const id = result?.imdb_id || result?.id; + const image = result?.poster; + const type = result?.type; + if (id) { + catalog.push({ + title: title, + link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`, + image: image, + }); + } + }); + return catalog; + } catch (err) { + console.error("AutoEmbed error ", err); + return []; + } +}; diff --git a/providers/guardahd/GetGuardahdStream.ts b/providers/guardahd/stream.ts similarity index 64% rename from providers/guardahd/GetGuardahdStream.ts rename to providers/guardahd/stream.ts index 43df469..7fd25d7 100644 --- a/providers/guardahd/GetGuardahdStream.ts +++ b/providers/guardahd/stream.ts @@ -1,6 +1,6 @@ -import {ProviderContext, Stream} from '../types'; +import { ProviderContext, Stream } from "../types"; -export const GuardahdGetStream = async function ({ +export const getStream = async function ({ link: id, type, providerContext, @@ -10,29 +10,28 @@ export const GuardahdGetStream = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio, extractors} = providerContext; - const {superVideoExtractor} = extractors; + const { axios, cheerio, extractors } = providerContext; + const { superVideoExtractor } = extractors; async function ExtractGuardahd({ - imdb, // type, - // episode, - } // season, - : { + imdb, // type, // season, + }: // episode, + { imdb: string; type: string; season: string; episode: string; }) { try { - const baseUrl = 'https://guardahd.stream'; - const path = '/set-movie-a/' + imdb; + const baseUrl = "https://guardahd.stream"; + const path = "/set-movie-a/" + imdb; const url = baseUrl + path; - console.log('url:', url); - const res = await axios.get(url, {timeout: 4000}); + console.log("url:", url); + const res = await axios.get(url, { timeout: 4000 }); const html = res.data; const $ = cheerio.load(html); - const superVideoUrl = $('li:contains("supervideo")').attr('data-link'); - console.log('superVideoUrl:', superVideoUrl); + const superVideoUrl = $('li:contains("supervideo")').attr("data-link"); + console.log("superVideoUrl:", superVideoUrl); if (!superVideoUrl) { return null; @@ -40,13 +39,13 @@ export const GuardahdGetStream = async function ({ const controller2 = new AbortController(); const signal2 = controller2.signal; setTimeout(() => controller2.abort(), 4000); - const res2 = await fetch('https:' + superVideoUrl, {signal: signal2}); + const res2 = await fetch("https:" + superVideoUrl, { signal: signal2 }); const data = await res2.text(); // console.log('mostraguarda data:', data); const streamUrl = await superVideoExtractor(data); return streamUrl; } catch (err) { - console.error('Error in GetMostraguardaStram:', err); + console.error("Error in GetMostraguardaStram:", err); } } async function GetMostraguardaStream({ @@ -61,20 +60,20 @@ export const GuardahdGetStream = async function ({ episode: string; }) { try { - const baseUrl = 'https://mostraguarda.stream'; + const baseUrl = "https://mostraguarda.stream"; const path = - type === 'tv' + type === "tv" ? `/serie/${imdb}/${season}/${episode}` : `/movie/${imdb}`; const url = baseUrl + path; - console.log('url:', url); + console.log("url:", url); - const res = await axios(url, {timeout: 4000}); + const res = await axios(url, { timeout: 4000 }); const html = res.data; const $ = cheerio.load(html); - const superVideoUrl = $('li:contains("supervideo")').attr('data-link'); - console.log('superVideoUrl:', superVideoUrl); + const superVideoUrl = $('li:contains("supervideo")').attr("data-link"); + console.log("superVideoUrl:", superVideoUrl); if (!superVideoUrl) { return null; @@ -82,18 +81,18 @@ export const GuardahdGetStream = async function ({ const controller2 = new AbortController(); const signal2 = controller2.signal; setTimeout(() => controller2.abort(), 4000); - const res2 = await fetch('https:' + superVideoUrl, {signal: signal2}); + const res2 = await fetch("https:" + superVideoUrl, { signal: signal2 }); const data = await res2.text(); // console.log('mostraguarda data:', data); const streamUrl = await superVideoExtractor(data); return streamUrl; } catch (err) { - console.error('Error in GetMostraguardaStram:', err); + console.error("Error in GetMostraguardaStram:", err); } } console.log(id); const streams: Stream[] = []; - const {imdbId, season, episode} = JSON.parse(id); + const { imdbId, season, episode } = JSON.parse(id); ///// mostraguarda const mostraguardaStream = await GetMostraguardaStream({ @@ -104,9 +103,9 @@ export const GuardahdGetStream = async function ({ }); if (mostraguardaStream) { streams.push({ - server: 'Supervideo 1', + server: "Supervideo 1", link: mostraguardaStream, - type: 'm3u8', + type: "m3u8", }); } @@ -119,9 +118,9 @@ export const GuardahdGetStream = async function ({ if (guardahdStream) { streams.push({ - server: 'Supervideo 2', + server: "Supervideo 2", link: guardahdStream, - type: 'm3u8', + type: "m3u8", }); } diff --git a/providers/hdhub4u/catalog.ts b/providers/hdhub4u/catalog.ts new file mode 100644 index 0000000..5accf4f --- /dev/null +++ b/providers/hdhub4u/catalog.ts @@ -0,0 +1,61 @@ +export const catalog = [ + { + title: "Latest", + filter: "", + }, + { + title: "Web Series", + filter: "/category/web-series", + }, + { + title: "Hollywood ", + filter: "/category/hollywood-movies", + }, + { + title: "South Movies", + filter: "/category/south-hindi-movies", + }, +]; + +export const genres = [ + { + title: "Action", + filter: "/category/action", + }, + { + title: "Crime", + filter: "/category/crime", + }, + { + title: "Comedy", + filter: "/category/comedy", + }, + { + title: "Drama", + filter: "/category/drama", + }, + { + title: "Horror", + filter: "/category/horror", + }, + { + title: "Family", + filter: "/category/family", + }, + { + title: "Sci-Fi", + filter: "/category/sifi", + }, + { + title: "Thriller", + filter: "/category/triller", + }, + { + title: "Romance", + filter: "/category/romance", + }, + { + title: "Fight", + filter: "/category/fight", + }, +]; diff --git a/providers/hdhub4u/hdhubCatalog.ts b/providers/hdhub4u/hdhubCatalog.ts deleted file mode 100644 index d4488cf..0000000 --- a/providers/hdhub4u/hdhubCatalog.ts +++ /dev/null @@ -1,61 +0,0 @@ -export const hdhub4uCatalog = [ - { - title: 'Latest', - filter: '', - }, - { - title: 'Web Series', - filter: '/category/web-series', - }, - { - title: 'Hollywood ', - filter: '/category/hollywood-movies', - }, - { - title: 'South Movies', - filter: '/category/south-hindi-movies', - }, -]; - -export const hdhub4uGenresList = [ - { - title: 'Action', - filter: '/category/action', - }, - { - title: 'Crime', - filter: '/category/crime', - }, - { - title: 'Comedy', - filter: '/category/comedy', - }, - { - title: 'Drama', - filter: '/category/drama', - }, - { - title: 'Horror', - filter: '/category/horror', - }, - { - title: 'Family', - filter: '/category/family', - }, - { - title: 'Sci-Fi', - filter: '/category/sifi', - }, - { - title: 'Thriller', - filter: '/category/triller', - }, - { - title: 'Romance', - filter: '/category/romance', - }, - { - title: 'Fight', - filter: '/category/fight', - }, -]; diff --git a/providers/hdhub4u/index.ts b/providers/hdhub4u/index.ts deleted file mode 100644 index 547a4fd..0000000 --- a/providers/hdhub4u/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {hdhub4uCatalog, hdhub4uGenresList} from './hdhubCatalog'; -import {hdhub4uGetInfo} from './hdhubGetInfo'; -import {hdhub4uGetStream} from './hdhub4uGetSteam'; -import {hdhubGetPosts, hdhubGetPostsSearch} from './hdhubGetPosts'; -import {ProviderType} from '../types'; - -export const hdhub4uProvider: ProviderType = { - catalog: hdhub4uCatalog, - genres: hdhub4uGenresList, - GetMetaData: hdhub4uGetInfo, - GetStream: hdhub4uGetStream, - GetHomePosts: hdhubGetPosts, - GetSearchPosts: hdhubGetPostsSearch, -}; diff --git a/providers/hdhub4u/hdhubGetInfo.ts b/providers/hdhub4u/meta.ts similarity index 62% rename from providers/hdhub4u/hdhubGetInfo.ts rename to providers/hdhub4u/meta.ts index 1670867..f215805 100644 --- a/providers/hdhub4u/hdhubGetInfo.ts +++ b/providers/hdhub4u/meta.ts @@ -1,12 +1,12 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; const hdbHeaders = { - Cookie: 'xla=s4t', - Referer: 'https://google.com', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0', + Cookie: "xla=s4t", + Referer: "https://google.com", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0", }; -export const hdhub4uGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -14,35 +14,35 @@ export const hdhub4uGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const url = link; - const res = await axios.get(url, {headers: hdbHeaders}); + const res = await axios.get(url, { headers: hdbHeaders }); const data = res.data; const $ = cheerio.load(data); - const container = $('.page-body'); + const container = $(".page-body"); const imdbId = container .find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])') - .attr('href') - ?.split('/')[4] || ''; + .attr("href") + ?.split("/")[4] || ""; const title = container .find( - 'h2[data-ved="2ahUKEwjL0NrBk4vnAhWlH7cAHRCeAlwQ3B0oATAfegQIFBAM"],h2[data-ved="2ahUKEwiP0pGdlermAhUFYVAKHV8tAmgQ3B0oATAZegQIDhAM"]', + 'h2[data-ved="2ahUKEwjL0NrBk4vnAhWlH7cAHRCeAlwQ3B0oATAfegQIFBAM"],h2[data-ved="2ahUKEwiP0pGdlermAhUFYVAKHV8tAmgQ3B0oATAZegQIDhAM"]' ) .text(); - const type = title.toLocaleLowerCase().includes('season') - ? 'series' - : 'movie'; + const type = title.toLocaleLowerCase().includes("season") + ? "series" + : "movie"; const synopsis = container .find('strong:contains("DESCRIPTION")') .parent() .text() - .replace('DESCRIPTION:', ''); - const image = container.find('img[decoding="async"]').attr('src') || ''; + .replace("DESCRIPTION:", ""); + const image = container.find('img[decoding="async"]').attr("src") || ""; // Links const links: Link[] = []; - const directLink: Link['directLinks'] = []; + const directLink: Link["directLinks"] = []; // direct link type $('strong:contains("EPiSODE")').map((i, element) => { @@ -54,9 +54,9 @@ export const hdhub4uGetInfo = async function ({ .parent() .next() .next() - .find('a') - .attr('href') || - $(element).parent().parent().parent().next().find('a').attr('href'); + .find("a") + .attr("href") || + $(element).parent().parent().parent().next().find("a").attr("href"); if (episodesLink && episodesLink) { directLink.push({ @@ -69,7 +69,7 @@ export const hdhub4uGetInfo = async function ({ if (directLink.length === 0) { container.find('a:contains("EPiSODE")').map((i, element) => { const epTitle = $(element).text(); - const episodesLink = $(element).attr('href'); + const episodesLink = $(element).attr("href"); if (episodesLink) { directLink.push({ title: epTitle.toLocaleUpperCase(), @@ -87,18 +87,20 @@ export const hdhub4uGetInfo = async function ({ if (directLink.length === 0) { container .find( - 'a:contains("480"),a:contains("720"),a:contains("1080"),a:contains("2160"),a:contains("4K")', + 'a:contains("480"),a:contains("720"),a:contains("1080"),a:contains("2160"),a:contains("4K")' ) .map((i, element) => { const quality = $(element) .text() - .match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ''; - const movieLinks = $(element).attr('href'); + .match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ""; + const movieLinks = $(element).attr("href"); const title = $(element).text(); if (movieLinks) { links.push({ - directLinks: [{link: movieLinks, title: 'Movie', type: 'movie'}], + directLinks: [ + { link: movieLinks, title: "Movie", type: "movie" }, + ], quality: quality, title: title, }); @@ -118,11 +120,11 @@ export const hdhub4uGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/hdhub4u/hdhubGetPosts.ts b/providers/hdhub4u/posts.ts similarity index 54% rename from providers/hdhub4u/hdhubGetPosts.ts rename to providers/hdhub4u/posts.ts index 52b8392..4d2561c 100644 --- a/providers/hdhub4u/hdhubGetPosts.ts +++ b/providers/hdhub4u/posts.ts @@ -1,13 +1,13 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; const hdbHeaders = { - Cookie: 'xla=s4t', - Referer: 'https://google.com', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0', + Cookie: "xla=s4t", + Referer: "https://google.com", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0", }; -export const hdhubGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -19,13 +19,13 @@ export const hdhubGetPosts = async function ({ providerContext: ProviderContext; signal: AbortSignal; }): Promise { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('hdhub'); + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("hdhub"); const url = `${baseUrl + filter}/page/${page}/`; - return posts({url, signal, providerContext}); + return posts({ url, signal, providerContext }); }; -export const hdhubGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -37,10 +37,10 @@ export const hdhubGetPostsSearch = async function ({ providerContext: ProviderContext; signal: AbortSignal; }): Promise { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('hdhub'); + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("hdhub"); const url = `${baseUrl}/page/${page}/?s=${searchQuery}`; - return posts({url, signal, providerContext}); + return posts({ url, signal, providerContext }); }; async function posts({ @@ -52,7 +52,7 @@ async function posts({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {cheerio} = providerContext; + const { cheerio } = providerContext; try { const res = await fetch(url, { headers: hdbHeaders, @@ -61,16 +61,16 @@ async function posts({ const data = await res.text(); const $ = cheerio.load(data); const catalog: Post[] = []; - $('.recent-movies') + $(".recent-movies") .children() .map((i, element) => { - const title = $(element).find('figure').find('img').attr('alt'); - const link = $(element).find('a').attr('href'); - const image = $(element).find('figure').find('img').attr('src'); + const title = $(element).find("figure").find("img").attr("alt"); + const link = $(element).find("a").attr("href"); + const image = $(element).find("figure").find("img").attr("src"); if (title && link && image) { catalog.push({ - title: title.replace('Download', '').trim(), + title: title.replace("Download", "").trim(), link: link, image: image, }); @@ -78,7 +78,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('hdhubGetPosts error ', err); + console.error("hdhubGetPosts error ", err); return []; } } diff --git a/providers/hdhub4u/hdhub4uGetSteam.ts b/providers/hdhub4u/stream.ts similarity index 61% rename from providers/hdhub4u/hdhub4uGetSteam.ts rename to providers/hdhub4u/stream.ts index 8ebb144..62f2503 100644 --- a/providers/hdhub4u/hdhub4uGetSteam.ts +++ b/providers/hdhub4u/stream.ts @@ -1,6 +1,6 @@ -import {ProviderContext} from '../types'; +import { ProviderContext } from "../types"; -export async function hdhub4uGetStream({ +export async function getStream({ link, signal, providerContext, @@ -10,49 +10,54 @@ export async function hdhub4uGetStream({ signal: AbortSignal; providerContext: ProviderContext; }) { - const {axios, cheerio, extractors, commonHeaders: headers} = providerContext; - const {hubcloudExtracter} = extractors; - let hubdriveLink = ''; - if (link.includes('hubdrive')) { - const hubdriveRes = await axios.get(link, {headers, signal}); + const { + axios, + cheerio, + extractors, + commonHeaders: headers, + } = providerContext; + const { hubcloudExtracter } = extractors; + let hubdriveLink = ""; + if (link.includes("hubdrive")) { + const hubdriveRes = await axios.get(link, { headers, signal }); const hubdriveText = hubdriveRes.data; const $ = cheerio.load(hubdriveText); hubdriveLink = - $('.btn.btn-primary.btn-user.btn-success1.m-1').attr('href') || link; + $(".btn.btn-primary.btn-user.btn-success1.m-1").attr("href") || link; } else { - const res = await axios.get(link, {headers, signal}); + const res = await axios.get(link, { headers, signal }); const text = res.data; const encryptedString = text.split("s('o','")?.[1]?.split("',180")?.[0]; const decodedString: any = decodeString(encryptedString); link = atob(decodedString?.o); const redirectLink = await getRedirectLinks(link, signal, headers); - const redirectLinkRes = await axios.get(redirectLink, {headers, signal}); + const redirectLinkRes = await axios.get(redirectLink, { headers, signal }); const redirectLinkText = redirectLinkRes.data; const $ = cheerio.load(redirectLinkText); hubdriveLink = - $('h3:contains("1080p")').find('a').attr('href') || + $('h3:contains("1080p")').find("a").attr("href") || redirectLinkText.match( - /href="(https:\/\/hubcloud\.[^\/]+\/drive\/[^"]+)"/, + /href="(https:\/\/hubcloud\.[^\/]+\/drive\/[^"]+)"/ )[1]; - if (hubdriveLink.includes('hubdrive')) { - const hubdriveRes = await axios.get(hubdriveLink, {headers, signal}); + if (hubdriveLink.includes("hubdrive")) { + const hubdriveRes = await axios.get(hubdriveLink, { headers, signal }); const hubdriveText = hubdriveRes.data; const $$ = cheerio.load(hubdriveText); hubdriveLink = - $$('.btn.btn-primary.btn-user.btn-success1.m-1').attr('href') || + $$(".btn.btn-primary.btn-user.btn-success1.m-1").attr("href") || hubdriveLink; } } - const hubdriveLinkRes = await axios.get(hubdriveLink, {headers, signal}); + const hubdriveLinkRes = await axios.get(hubdriveLink, { headers, signal }); const hubcloudText = hubdriveLinkRes.data; const hubcloudLink = hubcloudText.match( - //i, + //i )?.[1] || hubdriveLink; try { return await hubcloudExtracter(hubcloudLink, signal); } catch (error: any) { - console.log('hd hub 4 getStream error: ', error); + console.log("hd hub 4 getStream error: ", error); return []; } } @@ -62,36 +67,36 @@ const encode = function (value: string) { }; const decode = function (value: string) { if (value === undefined) { - return ''; + return ""; } return atob(value.toString()); }; const pen = function (value: string) { return value.replace(/[a-zA-Z]/g, function (_0x1a470e: any) { return String.fromCharCode( - (_0x1a470e <= 'Z' ? 90 : 122) >= + (_0x1a470e <= "Z" ? 90 : 122) >= (_0x1a470e = _0x1a470e.charCodeAt(0) + 13) ? _0x1a470e - : _0x1a470e - 26, + : _0x1a470e - 26 ); }); }; const abortableTimeout = ( ms: number, - {signal}: {signal?: AbortSignal} = {}, + { signal }: { signal?: AbortSignal } = {} ) => { return new Promise((resolve, reject) => { if (signal && signal.aborted) { - return reject(new Error('Aborted')); + return reject(new Error("Aborted")); } const timer = setTimeout(resolve, ms); if (signal) { - signal.addEventListener('abort', () => { + signal.addEventListener("abort", () => { clearTimeout(timer); - reject(new Error('Aborted')); + reject(new Error("Aborted")); }); } }); @@ -100,14 +105,14 @@ const abortableTimeout = ( export async function getRedirectLinks( link: string, signal: AbortSignal, - headers: any, + headers: any ) { try { - const res = await fetch(link, {headers, signal}); + const res = await fetch(link, { headers, signal }); const resText = await res.text(); var regex = /ck\('_wp_http_\d+','([^']+)'/g; - var combinedString = ''; + var combinedString = ""; var match; while ((match = regex.exec(resText)) !== null) { @@ -120,23 +125,23 @@ export async function getRedirectLinks( const data = JSON.parse(decodedString); console.log(data); const token = encode(data?.data); - const blogLink = data?.wp_http1 + '?re=' + token; + const blogLink = data?.wp_http1 + "?re=" + token; // abort timeout on signal let wait = abortableTimeout((Number(data?.total_time) + 3) * 1000, { signal, }); await wait; - console.log('blogLink', blogLink); + console.log("blogLink", blogLink); - let vcloudLink = 'Invalid Request'; - while (vcloudLink.includes('Invalid Request')) { - const blogRes = await fetch(blogLink, {headers, signal}); + let vcloudLink = "Invalid Request"; + while (vcloudLink.includes("Invalid Request")) { + const blogRes = await fetch(blogLink, { headers, signal }); const blogResText = (await blogRes.text()) as any; - if (blogResText.includes('Invalid Request')) { + if (blogResText.includes("Invalid Request")) { console.log(blogResText); } else { - vcloudLink = blogResText.match(/var reurl = "([^"]+)"/) || ''; + vcloudLink = blogResText.match(/var reurl = "([^"]+)"/) || ""; break; } } @@ -144,7 +149,7 @@ export async function getRedirectLinks( // console.log('vcloudLink', vcloudLink?.[1]); return blogLink || link; } catch (err) { - console.log('Error in getRedirectLinks', err); + console.log("Error in getRedirectLinks", err); return link; } } @@ -152,10 +157,10 @@ export async function getRedirectLinks( function rot13(str: string) { return str.replace(/[a-zA-Z]/g, function (char) { const charCode = char.charCodeAt(0); - const isUpperCase = char <= 'Z'; + const isUpperCase = char <= "Z"; const baseCharCode = isUpperCase ? 65 : 97; return String.fromCharCode( - ((charCode - baseCharCode + 13) % 26) + baseCharCode, + ((charCode - baseCharCode + 13) % 26) + baseCharCode ); }); } @@ -177,7 +182,7 @@ export function decodeString(encryptedString: string) { // Parse JSON return JSON.parse(decoded); } catch (error) { - console.error('Error decoding string:', error); + console.error("Error decoding string:", error); return null; } } diff --git a/providers/hiAnime/catalog.ts b/providers/hiAnime/catalog.ts new file mode 100644 index 0000000..6b4bf90 --- /dev/null +++ b/providers/hiAnime/catalog.ts @@ -0,0 +1,20 @@ +export const catalogs = [ + { + title: "Recent", + filter: "/anime/zoro/recent-episodes", + }, + { + title: "Top Airing", + filter: "/anime/zoro/top-airing", + }, + { + title: "Most Popular", + filter: "/anime/zoro/most-popular", + }, + { + title: "Most Favorited", + filter: "/anime/zoro/most-favorite", + }, +]; + +export const genres = []; diff --git a/providers/hiAnime/hiCatalog.ts b/providers/hiAnime/hiCatalog.ts deleted file mode 100644 index 555f5f7..0000000 --- a/providers/hiAnime/hiCatalog.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const hiCatalog = [ - { - title: 'Recent', - filter: '/anime/zoro/recent-episodes', - }, - { - title: 'Top Airing', - filter: '/anime/zoro/top-airing', - }, - { - title: 'Most Popular', - filter: '/anime/zoro/most-popular', - }, - { - title: 'Most Favorited', - filter: '/anime/zoro/most-favorite', - }, -]; - -export const hiGenresList = []; diff --git a/providers/hiAnime/index.ts b/providers/hiAnime/index.ts deleted file mode 100644 index 181be5b..0000000 --- a/providers/hiAnime/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {hiGetInfo} from './hiGetInfo'; -import {hiCatalog, hiGenresList} from './hiCatalog'; -import {hiGetStream} from './HiGetSteam'; -import {hiGetPosts, hiGetPostsSearch} from './hiGetPosts'; -import {ProviderType} from '../types'; - -export const HiAnime: ProviderType = { - catalog: hiCatalog, - genres: hiGenresList, - GetMetaData: hiGetInfo, - GetHomePosts: hiGetPosts, - GetStream: hiGetStream, - GetSearchPosts: hiGetPostsSearch, -}; diff --git a/providers/hiAnime/hiGetInfo.ts b/providers/hiAnime/meta.ts similarity index 55% rename from providers/hiAnime/hiGetInfo.ts rename to providers/hiAnime/meta.ts index a29a74c..431b4c2 100644 --- a/providers/hiAnime/hiGetInfo.ts +++ b/providers/hiAnime/meta.ts @@ -1,6 +1,6 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; -export const hiGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -8,8 +8,8 @@ export const hiGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {getBaseUrl, axios} = providerContext; - const baseUrl = await getBaseUrl('consumet'); + const { getBaseUrl, axios } = providerContext; + const baseUrl = await getBaseUrl("consumet"); const url = `${baseUrl}/anime/zoro/info?id=` + link; const res = await axios.get(url); const data = res.data; @@ -19,20 +19,20 @@ export const hiGetInfo = async function ({ image: data.image, tags: [ data?.type, - data?.subOrDub === 'both' ? 'Sub And Dub' : data?.subOrDub, + data?.subOrDub === "both" ? "Sub And Dub" : data?.subOrDub, ], - imdbId: '', - type: data.episodes.length > 0 ? 'series' : 'movie', + imdbId: "", + type: data.episodes.length > 0 ? "series" : "movie", }; const linkList: Link[] = []; - const subLinks: Link['directLinks'] = []; + const subLinks: Link["directLinks"] = []; data.episodes.forEach((episode: any) => { if (!episode?.isSubbed) { return; } const title = - 'Episode ' + episode.number + (episode?.isFiller ? ' (Filler)' : ''); - const link = episode.id + '$sub'; + "Episode " + episode.number + (episode?.isFiller ? " (Filler)" : ""); + const link = episode.id + "$sub"; if (link && title) { subLinks.push({ title, @@ -41,18 +41,18 @@ export const hiGetInfo = async function ({ } }); linkList.push({ - title: meta.title + ' (Sub)', + title: meta.title + " (Sub)", directLinks: subLinks, }); - if (data?.subOrDub === 'both') { - const dubLinks: Link['directLinks'] = []; + if (data?.subOrDub === "both") { + const dubLinks: Link["directLinks"] = []; data.episodes.forEach((episode: any) => { if (!episode?.isDubbed) { return; } const title = - 'Episode ' + episode.number + (episode?.isFiller ? ' (Filler)' : ''); - const link = episode.id + '$dub'; + "Episode " + episode.number + (episode?.isFiller ? " (Filler)" : ""); + const link = episode.id + "$dub"; if (link && title) { dubLinks.push({ title, @@ -61,7 +61,7 @@ export const hiGetInfo = async function ({ } }); linkList.push({ - title: meta.title + ' (Dub)', + title: meta.title + " (Dub)", directLinks: dubLinks, }); } @@ -72,11 +72,11 @@ export const hiGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/hiAnime/hiGetPosts.ts b/providers/hiAnime/posts.ts similarity index 63% rename from providers/hiAnime/hiGetPosts.ts rename to providers/hiAnime/posts.ts index 746c3ab..c1c2bac 100644 --- a/providers/hiAnime/hiGetPosts.ts +++ b/providers/hiAnime/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const hiGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -12,13 +12,13 @@ export const hiGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios} = providerContext; - const baseUrl = await getBaseUrl('consumet'); + const { getBaseUrl, axios } = providerContext; + const baseUrl = await getBaseUrl("consumet"); const url = `${baseUrl + filter}?page=${page}`; - return posts({url, signal, axios}); + return posts({ url, signal, axios }); }; -export const hiGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -30,10 +30,10 @@ export const hiGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios} = providerContext; - const baseUrl = await getBaseUrl('consumet'); + const { getBaseUrl, axios } = providerContext; + const baseUrl = await getBaseUrl("consumet"); const url = `${baseUrl}/anime/zoro/${searchQuery}?page=${page}`; - return posts({url, signal, axios}); + return posts({ url, signal, axios }); }; async function posts({ @@ -43,10 +43,10 @@ async function posts({ }: { url: string; signal: AbortSignal; - axios: ProviderContext['axios']; + axios: ProviderContext["axios"]; }): Promise { try { - const res = await axios.get(url, {signal}); + const res = await axios.get(url, { signal }); const data = res.data?.results; const catalog: Post[] = []; data?.map((element: any) => { @@ -63,7 +63,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('zoro error ', err); + console.error("zoro error ", err); return []; } } diff --git a/providers/hiAnime/HiGetSteam.ts b/providers/hiAnime/stream.ts similarity index 58% rename from providers/hiAnime/HiGetSteam.ts rename to providers/hiAnime/stream.ts index 6127a21..01e38a5 100644 --- a/providers/hiAnime/HiGetSteam.ts +++ b/providers/hiAnime/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext, TextTracks, TextTrackType} from '../types'; +import { Stream, ProviderContext, TextTracks, TextTrackType } from "../types"; -export const hiGetStream = async function ({ +export const getStream = async function ({ link: id, providerContext, }: { @@ -8,24 +8,24 @@ export const hiGetStream = async function ({ providerContext: ProviderContext; }): Promise { try { - const {getBaseUrl, axios} = providerContext; - const baseUrl = await getBaseUrl('consumet'); - const servers = ['vidcloud', 'vidstreaming']; + const { getBaseUrl, axios } = providerContext; + const baseUrl = await getBaseUrl("consumet"); + const servers = ["vidcloud", "vidstreaming"]; const url = `${baseUrl}/anime/zoro/watch?episodeId=${id}&server=`; const streamLinks: Stream[] = []; await Promise.all( - servers.map(async server => { + servers.map(async (server) => { try { const res = await axios.get(url + server); if (res.data) { const subtitles: TextTracks = []; res.data?.subtitles.forEach((sub: any) => { - if (sub?.lang === 'Thumbnails') return; + if (sub?.lang === "Thumbnails") return; subtitles.push({ - language: sub?.lang?.slice(0, 2) || 'Und', + language: sub?.lang?.slice(0, 2) || "Und", uri: sub?.url, - title: sub?.lang || 'Undefined', - type: sub?.url?.endsWith('.vtt') + title: sub?.lang || "Undefined", + type: sub?.url?.endsWith(".vtt") ? TextTrackType.VTT : TextTrackType.SUBRIP, }); @@ -34,10 +34,10 @@ export const hiGetStream = async function ({ streamLinks.push({ server: server, link: source?.url, - type: source?.isM3U8 ? 'm3u8' : 'mp4', + type: source?.isM3U8 ? "m3u8" : "mp4", headers: { - Referer: 'https://megacloud.club/', - Origin: 'https://megacloud.club', + Referer: "https://megacloud.club/", + Origin: "https://megacloud.club", }, subtitles: subtitles, }); @@ -46,7 +46,7 @@ export const hiGetStream = async function ({ } catch (e) { console.log(e); } - }), + }) ); return streamLinks; } catch (err) { diff --git a/providers/katmovies/katCatalog.ts b/providers/katmovies/catalog.ts similarity index 100% rename from providers/katmovies/katCatalog.ts rename to providers/katmovies/catalog.ts diff --git a/providers/katmovies/katGetEpsodes.ts b/providers/katmovies/episodes.ts similarity index 61% rename from providers/katmovies/katGetEpsodes.ts rename to providers/katmovies/episodes.ts index 932200f..1f2f24e 100644 --- a/providers/katmovies/katGetEpsodes.ts +++ b/providers/katmovies/episodes.ts @@ -1,53 +1,53 @@ -import {EpisodeLink, ProviderContext} from '../types'; +import { EpisodeLink, ProviderContext } from "../types"; -export const katEpisodeLinks = async function ({ +export const getEpisodes = async function ({ url, providerContext, }: { url: string; providerContext: ProviderContext; }): Promise { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const episodesLink: EpisodeLink[] = []; try { - if (url.includes('gdflix')) { - const baseUrl = url.split('/pack')?.[0]; + if (url.includes("gdflix")) { + const baseUrl = url.split("/pack")?.[0]; const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); - const links = $('.list-group-item'); + const links = $(".list-group-item"); links?.map((i, link) => { episodesLink.push({ - title: $(link).text() || '', - link: baseUrl + $(link).find('a').attr('href') || '', + title: $(link).text() || "", + link: baseUrl + $(link).find("a").attr("href") || "", }); }); if (episodesLink.length > 0) { return episodesLink; } } - if (url.includes('/pack')) { + if (url.includes("/pack")) { const epIds = await extractKmhdEpisodes(url, providerContext); epIds?.forEach((id: string, index: number) => { episodesLink.push({ title: `Episode ${index + 1}`, - link: url.split('/pack')[0] + '/file/' + id, + link: url.split("/pack")[0] + "/file/" + id, }); }); } const res = await axios.get(url, { headers: { Cookie: - '_ga_GNR438JY8N=GS1.1.1722240350.5.0.1722240350.0.0.0; _ga=GA1.1.372196696.1722150754; unlocked=true', + "_ga_GNR438JY8N=GS1.1.1722240350.5.0.1722240350.0.0.0; _ga=GA1.1.372196696.1722150754; unlocked=true", }, }); const episodeData = res.data; const $ = cheerio.load(episodeData); - const links = $('.autohyperlink'); + const links = $(".autohyperlink"); links?.map((i, link) => { episodesLink.push({ - title: $(link).parent().children().remove().end().text() || '', - link: $(link).attr('href') || '', + title: $(link).parent().children().remove().end().text() || "", + link: $(link).attr("href") || "", }); }); @@ -60,23 +60,23 @@ export const katEpisodeLinks = async function ({ export async function extractKmhdLink( katlink: string, - providerContext: ProviderContext, + providerContext: ProviderContext ) { - const {axios} = providerContext; + const { axios } = providerContext; const res = await axios.get(katlink); const data = res.data; const hubDriveRes = data.match(/hubdrive_res:\s*"([^"]+)"/)[1]; const hubDriveLink = data.match( - /hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/, + /hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/ )[1]; return hubDriveLink + hubDriveRes; } async function extractKmhdEpisodes( katlink: string, - providerContext: ProviderContext, + providerContext: ProviderContext ) { - const {axios} = providerContext; + const { axios } = providerContext; const res = await axios.get(katlink); const data = res.data; const ids = data.match(/[\w]+_[a-f0-9]{8}/g); diff --git a/providers/katmovies/index.ts b/providers/katmovies/index.ts deleted file mode 100644 index 1fef967..0000000 --- a/providers/katmovies/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {katCatalog, katGenresList} from './katCatalog'; -import {katEpisodeLinks} from './katGetEpsodes'; -import {katGetInfo} from './katGetInfo'; -import {katGetPosts, katGetPostsSearch} from './katGetPosts'; -import {katGetStream} from './katGetSteam'; -import {ProviderType} from '../types'; - -export const katMoviesHd: ProviderType = { - catalog: katCatalog, - genres: katGenresList, - GetMetaData: katGetInfo, - GetHomePosts: katGetPosts, - GetStream: katGetStream, - GetEpisodeLinks: katEpisodeLinks, - GetSearchPosts: katGetPostsSearch, -}; diff --git a/providers/katmovies/katGetInfo.ts b/providers/katmovies/meta.ts similarity index 54% rename from providers/katmovies/katGetInfo.ts rename to providers/katmovies/meta.ts index 35b9f80..a75b931 100644 --- a/providers/katmovies/katGetInfo.ts +++ b/providers/katmovies/meta.ts @@ -1,6 +1,6 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; -export const katGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -8,49 +8,49 @@ export const katGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const url = link; const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); - const container = $('.yQ8hqd.ksSzJd.LoQAYe').html() - ? $('.yQ8hqd.ksSzJd.LoQAYe') - : $('.FxvUNb'); + const container = $(".yQ8hqd.ksSzJd.LoQAYe").html() + ? $(".yQ8hqd.ksSzJd.LoQAYe") + : $(".FxvUNb"); const imdbId = container .find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])') - .attr('href') - ?.split('/')[4] || ''; + .attr("href") + ?.split("/")[4] || ""; const title = container .find('li:contains("Name")') .children() .remove() .end() .text(); - const type = $('.yQ8hqd.ksSzJd.LoQAYe').html() ? 'series' : 'movie'; + const type = $(".yQ8hqd.ksSzJd.LoQAYe").html() ? "series" : "movie"; const synopsis = container.find('li:contains("Stars")').text(); const image = - $('h4:contains("SCREENSHOTS")').next().find('img').attr('src') || ''; + $('h4:contains("SCREENSHOTS")').next().find("img").attr("src") || ""; - console.log('katGetInfo', title, synopsis, image, imdbId, type); + console.log("katGetInfo", title, synopsis, image, imdbId, type); // Links const links: Link[] = []; - const directLink: Link['directLinks'] = []; + const directLink: Link["directLinks"] = []; // direct links - $('.entry-content') + $(".entry-content") .find('p:contains("Episode")') .each((i, element) => { const dlLink = $(element) - .nextAll('h3,h2') + .nextAll("h3,h2") .first() .find('a:contains("1080"),a:contains("720"),a:contains("480")') - .attr('href') || ''; - const dlTitle = $(element).find('span').text(); + .attr("href") || ""; + const dlTitle = $(element).find("span").text(); - if (link.trim().length > 0 && dlTitle.includes('Episode ')) { + if (link.trim().length > 0 && dlTitle.includes("Episode ")) { directLink.push({ title: dlTitle, link: dlLink, @@ -60,24 +60,24 @@ export const katGetInfo = async function ({ if (directLink.length > 0) { links.push({ - quality: '', + quality: "", title: title, directLinks: directLink, }); } - $('.entry-content') - .find('pre') - .nextUntil('div') - .filter('h2') + $(".entry-content") + .find("pre") + .nextUntil("div") + .filter("h2") .each((i, element) => { - const link = $(element).find('a').attr('href'); + const link = $(element).find("a").attr("href"); const quality = $(element) .text() - .match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ''; + .match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ""; const title = $(element).text(); - if (link && title.includes('')) { + if (link && title.includes("")) { links.push({ quality, title, @@ -86,23 +86,23 @@ export const katGetInfo = async function ({ } }); - if (links.length === 0 && type === 'movie') { - $('.entry-content') + if (links.length === 0 && type === "movie") { + $(".entry-content") .find('h2:contains("DOWNLOAD"),h3:contains("DOWNLOAD")') - .nextUntil('pre,div') - .filter('h2') + .nextUntil("pre,div") + .filter("h2") .each((i, element) => { - const link = $(element).find('a').attr('href'); + const link = $(element).find("a").attr("href"); const quality = $(element) .text() - .match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ''; + .match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ""; const title = $(element).text(); - if (link && !title.includes('Online')) { + if (link && !title.includes("Online")) { links.push({ quality, title, - directLinks: [{link, title, type: 'movie'}], + directLinks: [{ link, title, type: "movie" }], }); } }); @@ -120,11 +120,11 @@ export const katGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/katmovies/katGetPosts.ts b/providers/katmovies/posts.ts similarity index 53% rename from providers/katmovies/katGetPosts.ts rename to providers/katmovies/posts.ts index d0974a2..7bac76e 100644 --- a/providers/katmovies/katGetPosts.ts +++ b/providers/katmovies/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const katGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -12,13 +12,13 @@ export const katGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, cheerio} = providerContext; - const baseUrl = await getBaseUrl('kat'); + const { getBaseUrl, cheerio } = providerContext; + const baseUrl = await getBaseUrl("kat"); const url = `${baseUrl + filter}/page/${page}/`; - return posts({url, signal, cheerio}); + return posts({ url, signal, cheerio }); }; -export const katGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -30,10 +30,10 @@ export const katGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, cheerio} = providerContext; - const baseUrl = await getBaseUrl('kat'); + const { getBaseUrl, cheerio } = providerContext; + const baseUrl = await getBaseUrl("kat"); const url = `${baseUrl}/page/${page}/?s=${searchQuery}`; - return posts({url, signal, cheerio}); + return posts({ url, signal, cheerio }); }; async function posts({ @@ -43,22 +43,22 @@ async function posts({ }: { url: string; signal: AbortSignal; - cheerio: ProviderContext['cheerio']; + cheerio: ProviderContext["cheerio"]; }): Promise { try { - const res = await fetch(url, {signal}); + const res = await fetch(url, { signal }); const data = await res.text(); const $ = cheerio.load(data); const catalog: Post[] = []; - $('.recent-posts') + $(".recent-posts") .children() .map((i, element) => { - const title = $(element).find('img').attr('alt'); - const link = $(element).find('a').attr('href'); - const image = $(element).find('img').attr('src'); + const title = $(element).find("img").attr("alt"); + const link = $(element).find("a").attr("href"); + const image = $(element).find("img").attr("src"); if (title && link && image) { catalog.push({ - title: title.replace('Download', '').trim(), + title: title.replace("Download", "").trim(), link: link, image: image, }); @@ -66,7 +66,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('katmovies error ', err); + console.error("katmovies error ", err); return []; } } diff --git a/providers/katmovies/katGetSteam.ts b/providers/katmovies/stream.ts similarity index 55% rename from providers/katmovies/katGetSteam.ts rename to providers/katmovies/stream.ts index ec4f0bf..acaa3dc 100644 --- a/providers/katmovies/katGetSteam.ts +++ b/providers/katmovies/stream.ts @@ -1,19 +1,19 @@ -import {Stream, ProviderContext} from '../types'; +import { Stream, ProviderContext } from "../types"; async function extractKmhdLink( katlink: string, - providerContext: ProviderContext, + providerContext: ProviderContext ) { - const {axios} = providerContext; + const { axios } = providerContext; const res = await axios.get(katlink); const data = res.data; const hubDriveRes = data.match(/hubdrive_res:\s*"([^"]+)"/)[1]; const hubDriveLink = data.match( - /hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/, + /hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/ )[1]; return hubDriveLink + hubDriveRes; } -export async function katGetStream({ +export const getStream = async function ({ link, signal, providerContext, @@ -23,77 +23,77 @@ export async function katGetStream({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {axios, cheerio, extractors} = providerContext; - const {hubcloudExtracter, gdFlixExtracter} = extractors; + const { axios, cheerio, extractors } = providerContext; + const { hubcloudExtracter, gdFlixExtracter } = extractors; const streamLinks: Stream[] = []; - console.log('katGetStream', link); + console.log("katGetStream", link); try { - if (link.includes('gdflix')) { + if (link.includes("gdflix")) { return await gdFlixExtracter(link, signal); } - if (link.includes('kmhd')) { + if (link.includes("kmhd")) { const hubcloudLink = await extractKmhdLink(link, providerContext); return await hubcloudExtracter(hubcloudLink, signal); } - if (link.includes('gdflix')) { + if (link.includes("gdflix")) { // resume link try { - const resumeDrive = link.replace('/file', '/zfile'); + const resumeDrive = link.replace("/file", "/zfile"); // console.log('resumeDrive', resumeDrive); const resumeDriveRes = await axios.get(resumeDrive); const resumeDriveHtml = resumeDriveRes.data; const $resumeDrive = cheerio.load(resumeDriveHtml); - const resumeLink = $resumeDrive('.btn-success').attr('href'); - console.log('resumeLink', resumeLink); + const resumeLink = $resumeDrive(".btn-success").attr("href"); + console.log("resumeLink", resumeLink); if (resumeLink) { streamLinks.push({ - server: 'ResumeCloud', + server: "ResumeCloud", link: resumeLink, - type: 'mkv', + type: "mkv", }); } } catch (err) { - console.log('Resume link not found'); + console.log("Resume link not found"); } //instant link try { - const driveres = await axios.get(link, {timeout: 10000}); + const driveres = await axios.get(link, { timeout: 10000 }); const $drive = cheerio.load(driveres.data); - const seed = $drive('.btn-danger').attr('href') || ''; - const instantToken = seed.split('=')[1]; + const seed = $drive(".btn-danger").attr("href") || ""; + const instantToken = seed.split("=")[1]; // console.log('InstantToken', instantToken); const InstantFromData = new FormData(); - InstantFromData.append('keys', instantToken); - const videoSeedUrl = seed.split('/').slice(0, 3).join('/') + '/api'; + InstantFromData.append("keys", instantToken); + const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api"; // console.log('videoSeedUrl', videoSeedUrl); const instantLinkRes = await fetch(videoSeedUrl, { - method: 'POST', + method: "POST", body: InstantFromData, headers: { - 'x-token': videoSeedUrl, + "x-token": videoSeedUrl, }, }); const instantLinkData = await instantLinkRes.json(); - console.log('instantLinkData', instantLinkData); + console.log("instantLinkData", instantLinkData); if (instantLinkData.error === false) { const instantLink = instantLinkData.url; streamLinks.push({ - server: 'Gdrive-Instant', + server: "Gdrive-Instant", link: instantLink, - type: 'mkv', + type: "mkv", }); } else { - console.log('Instant link not found', instantLinkData); + console.log("Instant link not found", instantLinkData); } } catch (err) { - console.log('Instant link not found', err); + console.log("Instant link not found", err); } return streamLinks; } const stereams = await hubcloudExtracter(link, signal); return stereams; } catch (error: any) { - console.log('katgetStream error: ', error); + console.log("katgetStream error: ", error); return []; } -} +}; diff --git a/providers/kissKh/catalog.ts b/providers/kissKh/catalog.ts new file mode 100644 index 0000000..95e591b --- /dev/null +++ b/providers/kissKh/catalog.ts @@ -0,0 +1,20 @@ +export const catalog = [ + { + title: "Latest", + filter: "/api/DramaList/List?type=0&sub=0&country=0&status=0&order=2", + }, + { + title: "Hollywood", + filter: "/api/DramaList/List?type=4&sub=0&country=0&status=0&order=2", + }, + { + title: "Anime", + filter: "/api/DramaList/List?type=3&sub=0&country=0&status=0&order=2", + }, + { + title: "K Drama", + filter: "/api/DramaList/List?type=0&sub=0&country=0&status=0&order=2", + }, +]; + +export const genres = []; diff --git a/providers/kissKh/index.ts b/providers/kissKh/index.ts deleted file mode 100644 index 135e588..0000000 --- a/providers/kissKh/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {kisskhCatalog, kisskhGenresList} from './kissKhCatalog'; -import {kissKhGetInfo} from './kissKhGetInfo'; -import {kissKhGetPosts, kissKhGetPostsSearch} from './kissKhGetPosts'; -import {kissKhGetStream} from './kissKhGetStream'; -import {ProviderType} from '../types'; - -export const kissKhProvider: ProviderType = { - catalog: kisskhCatalog, - genres: kisskhGenresList, - GetHomePosts: kissKhGetPosts, - GetMetaData: kissKhGetInfo, - GetStream: kissKhGetStream, - GetSearchPosts: kissKhGetPostsSearch, -}; diff --git a/providers/kissKh/kissKhCatalog.ts b/providers/kissKh/kissKhCatalog.ts deleted file mode 100644 index bf71a02..0000000 --- a/providers/kissKh/kissKhCatalog.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const kisskhCatalog = [ - { - title: 'Latest', - filter: '/api/DramaList/List?type=0&sub=0&country=0&status=0&order=2', - }, - { - title: 'Hollywood', - filter: '/api/DramaList/List?type=4&sub=0&country=0&status=0&order=2', - }, - { - title: 'Anime', - filter: '/api/DramaList/List?type=3&sub=0&country=0&status=0&order=2', - }, - { - title: 'K Drama', - filter: '/api/DramaList/List?type=0&sub=0&country=0&status=0&order=2', - }, -]; - -export const kisskhGenresList = []; diff --git a/providers/kissKh/kissKhGetInfo.ts b/providers/kissKh/meta.ts similarity index 59% rename from providers/kissKh/kissKhGetInfo.ts rename to providers/kissKh/meta.ts index 677b08a..dbe2f1f 100644 --- a/providers/kissKh/kissKhGetInfo.ts +++ b/providers/kissKh/meta.ts @@ -1,6 +1,6 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; -export const kissKhGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -8,23 +8,23 @@ export const kissKhGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios} = providerContext; + const { axios } = providerContext; const res = await axios.get(link); const data = res.data; const meta = { title: data.title, synopsis: data.description, image: data.thumbnail, - tags: [data?.releaseDate?.split('-')[0], data?.status, data?.type], - imdbId: '', - type: data.episodesCount > 1 ? 'series' : 'movie', + tags: [data?.releaseDate?.split("-")[0], data?.status, data?.type], + imdbId: "", + type: data.episodesCount > 1 ? "series" : "movie", }; const linkList: Link[] = []; - const subLinks: Link['directLinks'] = []; + const subLinks: Link["directLinks"] = []; data?.episodes?.reverse().map((episode: any) => { - const title = 'Episode ' + episode?.number; + const title = "Episode " + episode?.number; const link = episode?.id?.toString(); if (link && title) { subLinks.push({ @@ -46,11 +46,11 @@ export const kissKhGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/kissKh/kissKhGetPosts.ts b/providers/kissKh/posts.ts similarity index 71% rename from providers/kissKh/kissKhGetPosts.ts rename to providers/kissKh/posts.ts index c0da383..fb57302 100644 --- a/providers/kissKh/kissKhGetPosts.ts +++ b/providers/kissKh/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const kissKhGetPosts = async function ({ +export const getPosts = async function ({ filter, signal, providerContext, @@ -11,11 +11,11 @@ export const kissKhGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios} = providerContext; - const baseUrl = await getBaseUrl('kissKh'); + const { getBaseUrl, axios } = providerContext; + const baseUrl = await getBaseUrl("kissKh"); const url = `${baseUrl + filter}&type=0`; try { - const res = await axios.get(url, {signal}); + const res = await axios.get(url, { signal }); const data = res.data?.data; const catalog: Post[] = []; data?.map((element: any) => { @@ -32,12 +32,12 @@ export const kissKhGetPosts = async function ({ }); return catalog; } catch (err) { - console.error('kiss error ', err); + console.error("kiss error ", err); return []; } }; -export const kissKhGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, signal, providerContext, @@ -48,11 +48,11 @@ export const kissKhGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios} = providerContext; - const baseUrl = await getBaseUrl('kissKh'); + const { getBaseUrl, axios } = providerContext; + const baseUrl = await getBaseUrl("kissKh"); const url = `${baseUrl}/api/DramaList/Search?q=${searchQuery}&type=0`; try { - const res = await axios.get(url, {signal}); + const res = await axios.get(url, { signal }); const data = res.data; const catalog: Post[] = []; data?.map((element: any) => { @@ -69,7 +69,7 @@ export const kissKhGetPostsSearch = async function ({ }); return catalog; } catch (err) { - console.error('kiss error ', err); + console.error("kiss error ", err); return []; } }; diff --git a/providers/kissKh/kissKhGetStream.ts b/providers/kissKh/stream.ts similarity index 64% rename from providers/kissKh/kissKhGetStream.ts rename to providers/kissKh/stream.ts index f64ea38..4fe59b1 100644 --- a/providers/kissKh/kissKhGetStream.ts +++ b/providers/kissKh/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext, TextTrackType, TextTracks} from '../types'; +import { Stream, ProviderContext, TextTrackType, TextTracks } from "../types"; -export const kissKhGetStream = async function ({ +export const getStream = async function ({ link: id, providerContext, }: { @@ -8,12 +8,12 @@ export const kissKhGetStream = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, getBaseUrl} = providerContext; + const { axios, getBaseUrl } = providerContext; const streamLinks: Stream[] = []; const subtitles: TextTracks = []; - const baseUrl = await getBaseUrl('kissKh'); + const baseUrl = await getBaseUrl("kissKh"); const streamUrl = - 'https://adorable-salamander-ecbb21.netlify.app/api/kisskh/video?id=' + + "https://adorable-salamander-ecbb21.netlify.app/api/kisskh/video?id=" + id; const res = await axios.get(streamUrl); const stream = res.data?.source?.Video; @@ -22,16 +22,16 @@ export const kissKhGetStream = async function ({ subtitles.push({ title: sub?.label, language: sub?.land, - type: sub?.src?.includes('.vtt') + type: sub?.src?.includes(".vtt") ? TextTrackType.VTT : TextTrackType.SUBRIP, uri: sub?.src, }); }); streamLinks.push({ - server: 'kissKh', + server: "kissKh", link: stream, - type: 'm3u8', + type: "m3u8", subtitles, headers: { referer: baseUrl, diff --git a/providers/luxMovies/catalog.ts b/providers/luxMovies/catalog.ts new file mode 100644 index 0000000..3dc965f --- /dev/null +++ b/providers/luxMovies/catalog.ts @@ -0,0 +1,101 @@ +export const catalog = [ + { + title: "New", + filter: "", + }, + { + title: "Netflix", + filter: "category/web-series/netflix", + }, + { + title: "Amazon Prime", + filter: "category/web-series/amazon-prime-video", + }, + { + title: "4K Movies", + filter: "category/movies-by-quality/2160p", + }, +]; + +export const genres = [ + { + title: "Action", + filter: "category/movies-by-genres/action/", + }, + { + title: "Adventure", + filter: "category/movies-by-genres/adventure/", + }, + { + title: "Animation", + filter: "category/movies-by-genres/animation/", + }, + { + title: "Biography", + filter: "category/movies-by-genres/biography/", + }, + { + title: "Comedy", + filter: "category/movies-by-genres/comedy/", + }, + { + title: "Crime", + filter: "category/movies-by-genres/crime/", + }, + { + title: "Documentary", + filter: "category/movies-by-genres/documentary/", + }, + { + title: "Drama", + filter: "category/movies-by-genres/drama/", + }, + { + title: "Family", + filter: "category/movies-by-genres/family/", + }, + { + title: "Fantasy", + filter: "category/movies-by-genres/fantasy/", + }, + { + title: "History", + filter: "category/movies-by-genres/history/", + }, + { + title: "Horror", + filter: "category/movies-by-genres/horror/", + }, + { + title: "Music", + filter: "category/movies-by-genres/music/", + }, + { + title: "Mystery", + filter: "category/movies-by-genres/mystery/", + }, + { + title: "Romance", + filter: "category/movies-by-genres/romance/", + }, + { + title: "Sci-Fi", + filter: "category/movies-by-genres/sci-fi/", + }, + { + title: "Sport", + filter: "category/movies-by-genres/sport/", + }, + { + title: "Thriller", + filter: "category/movies-by-genres/thriller/", + }, + { + title: "War", + filter: "category/movies-by-genres/war/", + }, + { + title: "Western", + filter: "category/movies-by-genres/western/", + }, +]; diff --git a/providers/luxMovies/episodes.ts b/providers/luxMovies/episodes.ts new file mode 100644 index 0000000..256e9d9 --- /dev/null +++ b/providers/luxMovies/episodes.ts @@ -0,0 +1,39 @@ +import { EpisodeLink, ProviderContext } from "../types"; + +export const getEpisodes = async function ({ + url, + providerContext, +}: { + url: string; + providerContext: ProviderContext; +}): Promise { + const { axios, cheerio, commonHeaders: headers } = providerContext; + console.log("getEpisodeLinks", url); + try { + const res = await axios.get(url, { headers }); + const $ = cheerio.load(res.data); + const container = $(".entry-content,.entry-inner"); + $(".unili-content,.code-block-1").remove(); + const episodes: EpisodeLink[] = []; + container.find("h4").each((index, element) => { + const el = $(element); + const title = el.text().replaceAll("-", "").replaceAll(":", ""); + const link = el + .next("p") + .find( + '.btn-outline[style="background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;"]' + ) + .parent() + .attr("href"); + if (title && link) { + episodes.push({ title, link }); + } + }); + // console.log(episodes); + return episodes; + } catch (err) { + console.log("getEpisodeLinks error: "); + // console.error(err); + return []; + } +}; diff --git a/providers/luxMovies/index.ts b/providers/luxMovies/index.ts deleted file mode 100644 index 789306c..0000000 --- a/providers/luxMovies/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {luxGetPosts, luxGetPostsSearch} from './luxGetPosts'; -import {vegaGetInfo} from '../vega/getInfo'; -import {vegaGetStream} from '../vega/getStream'; -import {vegaGetEpisodeLinks} from '../vega/getEpisodesLink'; -import {homeList, genresList} from './luxCatalog'; -import {ProviderType} from '../types'; - -export const luxMovies: ProviderType = { - catalog: homeList, - genres: genresList, - GetMetaData: vegaGetInfo, - GetHomePosts: luxGetPosts, - GetStream: vegaGetStream, - nonStreamableServer: ['filepress'], - GetEpisodeLinks: vegaGetEpisodeLinks, - GetSearchPosts: luxGetPostsSearch, -}; diff --git a/providers/luxMovies/luxCatalog.ts b/providers/luxMovies/luxCatalog.ts deleted file mode 100644 index c2cf425..0000000 --- a/providers/luxMovies/luxCatalog.ts +++ /dev/null @@ -1,101 +0,0 @@ -export const homeList = [ - { - title: 'New', - filter: '', - }, - { - title: 'Netflix', - filter: 'category/web-series/netflix', - }, - { - title: 'Amazon Prime', - filter: 'category/web-series/amazon-prime-video', - }, - { - title: '4K Movies', - filter: 'category/movies-by-quality/2160p', - }, -]; - -export const genresList = [ - { - title: 'Action', - filter: 'category/movies-by-genres/action/', - }, - { - title: 'Adventure', - filter: 'category/movies-by-genres/adventure/', - }, - { - title: 'Animation', - filter: 'category/movies-by-genres/animation/', - }, - { - title: 'Biography', - filter: 'category/movies-by-genres/biography/', - }, - { - title: 'Comedy', - filter: 'category/movies-by-genres/comedy/', - }, - { - title: 'Crime', - filter: 'category/movies-by-genres/crime/', - }, - { - title: 'Documentary', - filter: 'category/movies-by-genres/documentary/', - }, - { - title: 'Drama', - filter: 'category/movies-by-genres/drama/', - }, - { - title: 'Family', - filter: 'category/movies-by-genres/family/', - }, - { - title: 'Fantasy', - filter: 'category/movies-by-genres/fantasy/', - }, - { - title: 'History', - filter: 'category/movies-by-genres/history/', - }, - { - title: 'Horror', - filter: 'category/movies-by-genres/horror/', - }, - { - title: 'Music', - filter: 'category/movies-by-genres/music/', - }, - { - title: 'Mystery', - filter: 'category/movies-by-genres/mystery/', - }, - { - title: 'Romance', - filter: 'category/movies-by-genres/romance/', - }, - { - title: 'Sci-Fi', - filter: 'category/movies-by-genres/sci-fi/', - }, - { - title: 'Sport', - filter: 'category/movies-by-genres/sport/', - }, - { - title: 'Thriller', - filter: 'category/movies-by-genres/thriller/', - }, - { - title: 'War', - filter: 'category/movies-by-genres/war/', - }, - { - title: 'Western', - filter: 'category/movies-by-genres/western/', - }, -]; diff --git a/providers/luxMovies/luxGetPosts.ts b/providers/luxMovies/luxGetPosts.ts deleted file mode 100644 index fb949bd..0000000 --- a/providers/luxMovies/luxGetPosts.ts +++ /dev/null @@ -1,111 +0,0 @@ -import {Post, ProviderContext} from '../types'; - -const headers = { - Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Cache-Control': 'no-store', - 'Accept-Language': 'en-US,en;q=0.9', - DNT: '1', - 'sec-ch-ua': - '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', - Cookie: - 'ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=gaIhTNzqSvp27JCVf7qiEUfYRfwyj0Jx9rcsn774BbE-1732694853-1.2.1.1-QKgYJvmrEz08gM9qbAp70diztE2.hseO2NNi.0imIUk_gkuWUcr7U8t5Zn_z4Ov30sIGPBES1PBgMUEa.s8e8QTkQoZjgziFmoC7YdX7s2Jnt.tYCxE_s5mMLQQBYbz_94A89IYe93Y6kyLQm_L.dvUKPPiGjn_sH3qRD0g4p9oOl0SPvH0T2W_EaD0r6mVBasbgro9dAROt_6CxshXOEGeMOnoWR.ID699FKldjMUhbXJbATAffdOY6kf2sD_iwrSl4bcetTlDHd4gusTVfxSS1pL5qNjyTU9wa38soPl1wZoqFHkEGOPWz6S7FD5ikHxX0bArFem9hiDeJXctYfWz5e_Lkc6lH7nW0Rm2XS3gxCadQSg21RkSReN6kDAEecqjgJSE4zUomkWAxFZ98TSShgGWC0ridPTpdQizPDZQ; _lscache_vary=c1d682536aea2d88fbb2574666e1f0aa', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0', -}; - -export const luxGetPosts = async ({ - filter, - page, - providerValue, - signal, - providerContext, -}: { - filter: string; - page: number; - providerValue: string; - signal: AbortSignal; - providerContext: ProviderContext; -}): Promise => { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('lux'); - - console.log('vegaGetPosts baseUrl:', providerValue, baseUrl); - const url = `${baseUrl}/${filter}/page/${page}/`; - console.log('lux url:', url); - return posts(url, signal, providerContext); -}; - -export const luxGetPostsSearch = async ({ - searchQuery, - page, - providerValue, - signal, - providerContext, -}: { - searchQuery: string; - page: number; - providerValue: string; - signal: AbortSignal; - providerContext: ProviderContext; -}): Promise => { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('lux'); - - console.log('vegaGetPosts baseUrl:', providerValue, baseUrl); - const url = `${baseUrl}/page/${page}/?s=${searchQuery}`; - console.log('lux url:', url); - - return posts(url, signal, providerContext); -}; - -async function posts( - url: string, - signal: AbortSignal, - providerContext: ProviderContext, -): Promise { - try { - const {axios, cheerio} = providerContext; - const urlRes = await axios.get(url, {headers, signal}); - const $ = cheerio.load(urlRes.data); - const posts: Post[] = []; - $('.blog-items') - ?.children('article') - ?.each((index, element) => { - const post = { - title: - $(element) - ?.find('a') - ?.attr('title') - ?.replace('Download', '') - ?.match(/^(.*?)\s*\((\d{4})\)|^(.*?)\s*\((Season \d+)\)/)?.[0] || - $(element)?.find('a')?.attr('title')?.replace('Download', '') || - '', - - link: $(element)?.find('a')?.attr('href') || '', - image: - $(element).find('a').find('img').attr('data-lazy-src') || - $(element).find('a').find('img').attr('data-src') || - $(element).find('a').find('img').attr('src') || - '', - }; - if (post.image.startsWith('//')) { - post.image = 'https:' + post.image; - } - posts.push(post); - }); - - // console.log(posts); - return posts; - } catch (error) { - console.error('vegaGetPosts error:', error); - return []; - } -} diff --git a/providers/vega/getInfo.ts b/providers/luxMovies/meta.ts similarity index 53% rename from providers/vega/getInfo.ts rename to providers/luxMovies/meta.ts index a9e4919..fc0190e 100644 --- a/providers/vega/getInfo.ts +++ b/providers/luxMovies/meta.ts @@ -1,27 +1,27 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; const headers = { Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Cache-Control': 'no-store', - 'Accept-Language': 'en-US,en;q=0.9', - DNT: '1', - 'sec-ch-ua': + "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", Cookie: - '_lscache_vary=62abf8b96599676eb8ec211cffaeb8ff; ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=n4Y1XTKZ5TfIMBNQuAXzerwKpx0U35KoOm3imfT0GpU-1732097818-1.2.1.1-ZeAnEu.8D9TSZHYDoj7vwo1A1rpdKl304ZpaBn_QbAQOr211JFAb7.JRQU3EL2eIy1Dfl8HhYvH7_259.22lUz8gbchHcQ8hvfuQXMtFMCbqDBLzjNUZa9stuk.39l28IcPhH9Z2szsf3SGtNI1sAfo66Djt7sOReLK3lHw9UkJp7BdGqt6a2X9qAc8EsAI3lE480Tmt0fkHv14Oc30LSbPB_WwFmiqAki2W.Gv9hV7TN_QBFESleTDlXd.6KGflfd4.KwWF7rpSRo_cgoc9ALLLIafpxHVbe7_g5r7zvpml_Pj8fEL75fw.1GBuy16bciHBuB8s_kahuJYUnhtQFFgfTQl8_Gn6KeovBWx.PJ7nFv5sklHUfAyBVq3t30xKe8ZDydsQ_G.yipfj_In5GmmWcXGb6E4.bioDOwW_sKLtxwdTQt7Nu.RkILX_mKvXNpyLqflIVj8G7X5E8I.unw', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0', + "_lscache_vary=62abf8b96599676eb8ec211cffaeb8ff; ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=n4Y1XTKZ5TfIMBNQuAXzerwKpx0U35KoOm3imfT0GpU-1732097818-1.2.1.1-ZeAnEu.8D9TSZHYDoj7vwo1A1rpdKl304ZpaBn_QbAQOr211JFAb7.JRQU3EL2eIy1Dfl8HhYvH7_259.22lUz8gbchHcQ8hvfuQXMtFMCbqDBLzjNUZa9stuk.39l28IcPhH9Z2szsf3SGtNI1sAfo66Djt7sOReLK3lHw9UkJp7BdGqt6a2X9qAc8EsAI3lE480Tmt0fkHv14Oc30LSbPB_WwFmiqAki2W.Gv9hV7TN_QBFESleTDlXd.6KGflfd4.KwWF7rpSRo_cgoc9ALLLIafpxHVbe7_g5r7zvpml_Pj8fEL75fw.1GBuy16bciHBuB8s_kahuJYUnhtQFFgfTQl8_Gn6KeovBWx.PJ7nFv5sklHUfAyBVq3t30xKe8ZDydsQ_G.yipfj_In5GmmWcXGb6E4.bioDOwW_sKLtxwdTQt7Nu.RkILX_mKvXNpyLqflIVj8G7X5E8I.unw", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0", }; -export const vegaGetInfo = async ({ +export const getMeta = async ({ link, providerContext, }: { @@ -29,10 +29,10 @@ export const vegaGetInfo = async ({ providerContext: ProviderContext; }): Promise => { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const url = link; - console.log('url', url); - const baseUrl = url.split('/').slice(0, 3).join('/'); + console.log("url", url); + const baseUrl = url.split("/").slice(0, 3).join("/"); const response = await axios.get(url, { headers: { ...headers, @@ -40,92 +40,93 @@ export const vegaGetInfo = async ({ }, }); const $ = cheerio.load(response.data); - const infoContainer = $('.entry-content,.post-inner'); - const heading = infoContainer?.find('h3'); + const infoContainer = $(".entry-content,.post-inner"); + const heading = infoContainer?.find("h3"); const imdbId = - heading?.next('p')?.find('a')?.[0]?.attribs?.href?.match(/tt\d+/g)?.[0] || + //@ts-ignore + heading?.next("p")?.find("a")?.[0]?.attribs?.href?.match(/tt\d+/g)?.[0] || infoContainer.text().match(/tt\d+/g)?.[0] || - ''; + ""; // console.log(imdbId) - const type = heading?.next('p')?.text()?.includes('Series Name') - ? 'series' - : 'movie'; + const type = heading?.next("p")?.text()?.includes("Series Name") + ? "series" + : "movie"; // console.log(type); // title const titleRegex = /Name: (.+)/; - const title = heading?.next('p')?.text()?.match(titleRegex)?.[1] || ''; + const title = heading?.next("p")?.text()?.match(titleRegex)?.[1] || ""; // console.log(title); // synopsis - const synopsisNode = infoContainer?.find('p')?.next('h3,h4')?.next('p')?.[0] - ?.children?.[0]; + const synopsisNode = //@ts-ignore + infoContainer?.find("p")?.next("h3,h4")?.next("p")?.[0]?.children?.[0]; const synopsis = - synopsisNode && 'data' in synopsisNode ? synopsisNode.data : ''; + synopsisNode && "data" in synopsisNode ? synopsisNode.data : ""; // console.log(synopsis); // image let image = - infoContainer?.find('img[data-lazy-src]')?.attr('data-lazy-src') || ''; - if (image.startsWith('//')) { - image = 'https:' + image; + infoContainer?.find("img[data-lazy-src]")?.attr("data-lazy-src") || ""; + if (image.startsWith("//")) { + image = "https:" + image; } // console.log(image); // console.log({title, synopsis, image, imdbId, type}); /// Links - const hr = infoContainer?.first()?.find('hr'); - const list = hr?.nextUntil('hr'); + const hr = infoContainer?.first()?.find("hr"); + const list = hr?.nextUntil("hr"); const links: Link[] = []; list.each((index, element: any) => { element = $(element); // title - const title = element?.text() || ''; + const title = element?.text() || ""; - const quality = element?.text().match(/\d+p\b/)?.[0] || ''; + const quality = element?.text().match(/\d+p\b/)?.[0] || ""; // console.log(title); // movieLinks const movieLinks = element ?.next() - .find('.dwd-button') + .find(".dwd-button") .text() .toLowerCase() - .includes('download') - ? element?.next().find('.dwd-button')?.parent()?.attr('href') - : ''; + .includes("download") + ? element?.next().find(".dwd-button")?.parent()?.attr("href") + : ""; // episode links const vcloudLinks = element ?.next() .find( - ".btn-outline[style='background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;'],.btn-outline[style='background:linear-gradient(135deg,#ed0b0b,#f2d152); color: #fdf8f2;']", + ".btn-outline[style='background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;'],.btn-outline[style='background:linear-gradient(135deg,#ed0b0b,#f2d152); color: #fdf8f2;']" ) ?.parent() - ?.attr('href'); + ?.attr("href"); console.log(title); const episodesLink = (vcloudLinks ? vcloudLinks : element ?.next() - .find('.dwd-button') + .find(".dwd-button") .text() .toLowerCase() - .includes('episode') - ? element?.next().find('.dwd-button')?.parent()?.attr('href') - : '') || + .includes("episode") + ? element?.next().find(".dwd-button")?.parent()?.attr("href") + : "") || element ?.next() .find( - ".btn-outline[style='background:linear-gradient(135deg,#0ebac3,#09d261); color: white;']", + ".btn-outline[style='background:linear-gradient(135deg,#0ebac3,#09d261); color: white;']" ) ?.parent() - ?.attr('href'); + ?.attr("href"); if (movieLinks || episodesLink) { links.push({ title, directLinks: movieLinks - ? [{title: 'Movie', link: movieLinks, type: 'movie'}] + ? [{ title: "Movie", link: movieLinks, type: "movie" }] : [], episodesLink, quality, @@ -142,15 +143,15 @@ export const vegaGetInfo = async ({ linkList: links, }; } catch (error) { - console.log('getInfo error'); + console.log("getInfo error"); console.error(error); // ToastAndroid.show('No response', ToastAndroid.SHORT); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: '', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "", linkList: [], }; } diff --git a/providers/luxMovies/posts.ts b/providers/luxMovies/posts.ts new file mode 100644 index 0000000..ea764c3 --- /dev/null +++ b/providers/luxMovies/posts.ts @@ -0,0 +1,111 @@ +import { Post, ProviderContext } from "../types"; + +const headers = { + Accept: + "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": + '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + Cookie: + "ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=gaIhTNzqSvp27JCVf7qiEUfYRfwyj0Jx9rcsn774BbE-1732694853-1.2.1.1-QKgYJvmrEz08gM9qbAp70diztE2.hseO2NNi.0imIUk_gkuWUcr7U8t5Zn_z4Ov30sIGPBES1PBgMUEa.s8e8QTkQoZjgziFmoC7YdX7s2Jnt.tYCxE_s5mMLQQBYbz_94A89IYe93Y6kyLQm_L.dvUKPPiGjn_sH3qRD0g4p9oOl0SPvH0T2W_EaD0r6mVBasbgro9dAROt_6CxshXOEGeMOnoWR.ID699FKldjMUhbXJbATAffdOY6kf2sD_iwrSl4bcetTlDHd4gusTVfxSS1pL5qNjyTU9wa38soPl1wZoqFHkEGOPWz6S7FD5ikHxX0bArFem9hiDeJXctYfWz5e_Lkc6lH7nW0Rm2XS3gxCadQSg21RkSReN6kDAEecqjgJSE4zUomkWAxFZ98TSShgGWC0ridPTpdQizPDZQ; _lscache_vary=c1d682536aea2d88fbb2574666e1f0aa", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", +}; + +export const getPosts = async ({ + filter, + page, + providerValue, + signal, + providerContext, +}: { + filter: string; + page: number; + providerValue: string; + signal: AbortSignal; + providerContext: ProviderContext; +}): Promise => { + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("lux"); + + console.log("vegaGetPosts baseUrl:", providerValue, baseUrl); + const url = `${baseUrl}/${filter}/page/${page}/`; + console.log("lux url:", url); + return posts(url, signal, providerContext); +}; + +export const getSearchPosts = async ({ + searchQuery, + page, + providerValue, + signal, + providerContext, +}: { + searchQuery: string; + page: number; + providerValue: string; + signal: AbortSignal; + providerContext: ProviderContext; +}): Promise => { + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("lux"); + + console.log("vegaGetPosts baseUrl:", providerValue, baseUrl); + const url = `${baseUrl}/page/${page}/?s=${searchQuery}`; + console.log("lux url:", url); + + return posts(url, signal, providerContext); +}; + +async function posts( + url: string, + signal: AbortSignal, + providerContext: ProviderContext +): Promise { + try { + const { axios, cheerio } = providerContext; + const urlRes = await axios.get(url, { headers, signal }); + const $ = cheerio.load(urlRes.data); + const posts: Post[] = []; + $(".blog-items") + ?.children("article") + ?.each((index, element) => { + const post = { + title: + $(element) + ?.find("a") + ?.attr("title") + ?.replace("Download", "") + ?.match(/^(.*?)\s*\((\d{4})\)|^(.*?)\s*\((Season \d+)\)/)?.[0] || + $(element)?.find("a")?.attr("title")?.replace("Download", "") || + "", + + link: $(element)?.find("a")?.attr("href") || "", + image: + $(element).find("a").find("img").attr("data-lazy-src") || + $(element).find("a").find("img").attr("data-src") || + $(element).find("a").find("img").attr("src") || + "", + }; + if (post.image.startsWith("//")) { + post.image = "https:" + post.image; + } + posts.push(post); + }); + + // console.log(posts); + return posts; + } catch (error) { + console.error("vegaGetPosts error:", error); + return []; + } +} diff --git a/providers/vega/getStream.ts b/providers/luxMovies/stream.ts similarity index 62% rename from providers/vega/getStream.ts rename to providers/luxMovies/stream.ts index e009fdc..8de5b5a 100644 --- a/providers/vega/getStream.ts +++ b/providers/luxMovies/stream.ts @@ -1,27 +1,27 @@ -import {ProviderContext, Stream} from '../types'; +import { ProviderContext, Stream } from "../types"; const headers = { Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Cache-Control': 'no-store', - 'Accept-Language': 'en-US,en;q=0.9', - DNT: '1', - 'sec-ch-ua': + "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", Cookie: - '_lscache_vary=62abf8b96599676eb8ec211cffaeb8ff; ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=n4Y1XTKZ5TfIMBNQuAXzerwKpx0U35KoOm3imfT0GpU-1732097818-1.2.1.1-ZeAnEu.8D9TSZHYDoj7vwo1A1rpdKl304ZpaBn_QbAQOr211JFAb7.JRQU3EL2eIy1Dfl8HhYvH7_259.22lUz8gbchHcQ8hvfuQXMtFMCbqDBLzjNUZa9stuk.39l28IcPhH9Z2szsf3SGtNI1sAfo66Djt7sOReLK3lHw9UkJp7BdGqt6a2X9qAc8EsAI3lE480Tmt0fkHv14Oc30LSbPB_WwFmiqAki2W.Gv9hV7TN_QBFESleTDlXd.6KGflfd4.KwWF7rpSRo_cgoc9ALLLIafpxHVbe7_g5r7zvpml_Pj8fEL75fw.1GBuy16bciHBuB8s_kahuJYUnhtQFFgfTQl8_Gn6KeovBWx.PJ7nFv5sklHUfAyBVq3t30xKe8ZDydsQ_G.yipfj_In5GmmWcXGb6E4.bioDOwW_sKLtxwdTQt7Nu.RkILX_mKvXNpyLqflIVj8G7X5E8I.unw', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0', + "_lscache_vary=62abf8b96599676eb8ec211cffaeb8ff; ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=n4Y1XTKZ5TfIMBNQuAXzerwKpx0U35KoOm3imfT0GpU-1732097818-1.2.1.1-ZeAnEu.8D9TSZHYDoj7vwo1A1rpdKl304ZpaBn_QbAQOr211JFAb7.JRQU3EL2eIy1Dfl8HhYvH7_259.22lUz8gbchHcQ8hvfuQXMtFMCbqDBLzjNUZa9stuk.39l28IcPhH9Z2szsf3SGtNI1sAfo66Djt7sOReLK3lHw9UkJp7BdGqt6a2X9qAc8EsAI3lE480Tmt0fkHv14Oc30LSbPB_WwFmiqAki2W.Gv9hV7TN_QBFESleTDlXd.6KGflfd4.KwWF7rpSRo_cgoc9ALLLIafpxHVbe7_g5r7zvpml_Pj8fEL75fw.1GBuy16bciHBuB8s_kahuJYUnhtQFFgfTQl8_Gn6KeovBWx.PJ7nFv5sklHUfAyBVq3t30xKe8ZDydsQ_G.yipfj_In5GmmWcXGb6E4.bioDOwW_sKLtxwdTQt7Nu.RkILX_mKvXNpyLqflIVj8G7X5E8I.unw", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0", }; -export async function vegaGetStream({ +export async function getStream({ link, type, signal, @@ -32,14 +32,14 @@ export async function vegaGetStream({ signal: AbortSignal; providerContext: ProviderContext; }) { - const {axios, cheerio, extractors} = providerContext; - const {hubcloudExtracter} = extractors; + const { axios, cheerio, extractors } = providerContext; + const { hubcloudExtracter } = extractors; try { const streamLinks: Stream[] = []; - console.log('dotlink', link); - if (type === 'movie') { + console.log("dotlink", link); + if (type === "movie") { // vlink - const dotlinkRes = await axios(`${link}`, {headers}); + const dotlinkRes = await axios(`${link}`, { headers }); const dotlinkText = dotlinkRes.data; // console.log('dotlinkText', dotlinkText); const vlink = dotlinkText.match(/ { + const { axios, cheerio } = providerContext; + try { + if (url.includes("url=")) { + url = atob(url.split("url=")[1]); + } + const res = await axios.get(url); + const html = res.data; + let $ = cheerio.load(html); + if (url.includes("url=")) { + const newUrl = $("meta[http-equiv='refresh']") + .attr("content") + ?.split("url=")[1]; + const res2 = await axios.get(newUrl || url); + const html2 = res2.data; + $ = cheerio.load(html2); + } + const episodeLinks: EpisodeLink[] = []; + $("h3,h4").map((i, element) => { + const seriesTitle = $(element).text(); + const episodesLink = $(element).find("a").attr("href"); + if (episodesLink && episodesLink !== "#") { + episodeLinks.push({ + title: seriesTitle.trim() || "No title found", + link: episodesLink || "", + }); + } + }); + $("a.maxbutton").map((i, element) => { + const seriesTitle = $(element).children("span").text(); + const episodesLink = $(element).attr("href"); + if (episodesLink && episodesLink !== "#") { + episodeLinks.push({ + title: seriesTitle.trim() || "No title found", + link: episodesLink || "", + }); + } + }); + return episodeLinks; + } catch (err) { + console.error(err); + return []; + } +}; diff --git a/providers/mod/index.ts b/providers/mod/index.ts deleted file mode 100644 index d7acc76..0000000 --- a/providers/mod/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {modGenresList, catalogList} from './catalog'; -import {modGetInfo} from './modGetInfo'; -import {modGetEpisodeLinks} from './modGetEpisodesList'; -import {modGetPosts, modGetPostsSearch} from './modGetPosts'; -import {modGetStream} from './modGetStream'; -import {ProviderType} from '../types'; - -export const modMovies: ProviderType = { - catalog: catalogList, - genres: modGenresList, - GetMetaData: modGetInfo, - GetHomePosts: modGetPosts, - GetStream: modGetStream, - GetEpisodeLinks: modGetEpisodeLinks, - // nonStreamableServer: ['Gdrive-Instant'], - GetSearchPosts: modGetPostsSearch, -}; diff --git a/providers/mod/meta.ts b/providers/mod/meta.ts new file mode 100644 index 0000000..bd7b972 --- /dev/null +++ b/providers/mod/meta.ts @@ -0,0 +1,71 @@ +import { Info, Link, ProviderContext } from "../types"; + +export const getMeta = async function ({ + link, + providerContext, +}: { + link: string; + providerContext: ProviderContext; +}): Promise { + try { + const { axios, cheerio } = providerContext; + const url = link; + const res = await axios.get(url); + const data = res.data; + const $ = cheerio.load(data); + const meta = { + title: $(".imdbwp__title").text(), + synopsis: $(".imdbwp__teaser").text(), + image: $(".imdbwp__thumb").find("img").attr("src") || "", + imdbId: $(".imdbwp__link").attr("href")?.split("/")[4] || "", + type: $(".thecontent").text().toLocaleLowerCase().includes("season") + ? "series" + : "movie", + }; + const links: Link[] = []; + + $("h3,h4").map((i, element) => { + const seriesTitle = $(element).text(); + // const batchZipLink = $(element) + // .next("p") + // .find(".maxbutton-batch-zip,.maxbutton-zip-download") + // .attr("href"); + const episodesLink = $(element) + .next("p") + .find( + ".maxbutton-episode-links,.maxbutton-g-drive,.maxbutton-af-download" + ) + .attr("href"); + const movieLink = $(element) + .next("p") + .find(".maxbutton-download-links") + .attr("href"); + + if ( + movieLink || + (episodesLink && episodesLink !== "javascript:void(0);") + ) { + links.push({ + title: seriesTitle.replace("Download ", "").trim() || "Download", + episodesLink: episodesLink || "", + directLinks: movieLink + ? [{ link: movieLink, title: "Movie", type: "movie" }] + : [], + quality: seriesTitle?.match(/\d+p\b/)?.[0] || "", + }); + } + }); + // console.log('mod meta', links); + return { ...meta, linkList: links }; + } catch (err) { + console.error(err); + return { + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", + linkList: [], + }; + } +}; diff --git a/providers/mod/modGetEpisodesList.ts b/providers/mod/modGetEpisodesList.ts deleted file mode 100644 index 8272d7a..0000000 --- a/providers/mod/modGetEpisodesList.ts +++ /dev/null @@ -1,52 +0,0 @@ -import {EpisodeLink, ProviderContext} from '../types'; - -export const modGetEpisodeLinks = async function ({ - url, - providerContext, -}: { - url: string; - providerContext: ProviderContext; -}): Promise { - const {axios, cheerio} = providerContext; - try { - if (url.includes('url=')) { - url = atob(url.split('url=')[1]); - } - const res = await axios.get(url); - const html = res.data; - let $ = cheerio.load(html); - if (url.includes('url=')) { - const newUrl = $("meta[http-equiv='refresh']") - .attr('content') - ?.split('url=')[1]; - const res2 = await axios.get(newUrl || url); - const html2 = res2.data; - $ = cheerio.load(html2); - } - const episodeLinks: EpisodeLink[] = []; - $('h3,h4').map((i, element) => { - const seriesTitle = $(element).text(); - const episodesLink = $(element).find('a').attr('href'); - if (episodesLink && episodesLink !== '#') { - episodeLinks.push({ - title: seriesTitle.trim() || 'No title found', - link: episodesLink || '', - }); - } - }); - $('a.maxbutton').map((i, element) => { - const seriesTitle = $(element).children('span').text(); - const episodesLink = $(element).attr('href'); - if (episodesLink && episodesLink !== '#') { - episodeLinks.push({ - title: seriesTitle.trim() || 'No title found', - link: episodesLink || '', - }); - } - }); - return episodeLinks; - } catch (err) { - console.error(err); - return []; - } -}; diff --git a/providers/mod/modGetInfo.ts b/providers/mod/modGetInfo.ts deleted file mode 100644 index 1331cf4..0000000 --- a/providers/mod/modGetInfo.ts +++ /dev/null @@ -1,71 +0,0 @@ -import {Info, Link, ProviderContext} from '../types'; - -export const modGetInfo = async function ({ - link, - providerContext, -}: { - link: string; - providerContext: ProviderContext; -}): Promise { - try { - const {axios, cheerio} = providerContext; - const url = link; - const res = await axios.get(url); - const data = res.data; - const $ = cheerio.load(data); - const meta = { - title: $('.imdbwp__title').text(), - synopsis: $('.imdbwp__teaser').text(), - image: $('.imdbwp__thumb').find('img').attr('src') || '', - imdbId: $('.imdbwp__link').attr('href')?.split('/')[4] || '', - type: $('.thecontent').text().toLocaleLowerCase().includes('season') - ? 'series' - : 'movie', - }; - const links: Link[] = []; - - $('h3,h4').map((i, element) => { - const seriesTitle = $(element).text(); - // const batchZipLink = $(element) - // .next("p") - // .find(".maxbutton-batch-zip,.maxbutton-zip-download") - // .attr("href"); - const episodesLink = $(element) - .next('p') - .find( - '.maxbutton-episode-links,.maxbutton-g-drive,.maxbutton-af-download', - ) - .attr('href'); - const movieLink = $(element) - .next('p') - .find('.maxbutton-download-links') - .attr('href'); - - if ( - movieLink || - (episodesLink && episodesLink !== 'javascript:void(0);') - ) { - links.push({ - title: seriesTitle.replace('Download ', '').trim() || 'Download', - episodesLink: episodesLink || '', - directLinks: movieLink - ? [{link: movieLink, title: 'Movie', type: 'movie'}] - : [], - quality: seriesTitle?.match(/\d+p\b/)?.[0] || '', - }); - } - }); - // console.log('mod meta', links); - return {...meta, linkList: links}; - } catch (err) { - console.error(err); - return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', - linkList: [], - }; - } -}; diff --git a/providers/mod/modGetPosts.ts b/providers/mod/posts.ts similarity index 52% rename from providers/mod/modGetPosts.ts rename to providers/mod/posts.ts index ff69425..fa9a6c4 100644 --- a/providers/mod/modGetPosts.ts +++ b/providers/mod/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const modGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -12,13 +12,13 @@ export const modGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('Moviesmod'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("Moviesmod"); const url = `${baseUrl + filter}/page/${page}/`; - return posts({url, signal, axios, cheerio}); + return posts({ url, signal, axios, cheerio }); }; -export const modGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -30,10 +30,10 @@ export const modGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('Moviesmod'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("Moviesmod"); const url = `${baseUrl}/search/${searchQuery}/page/${page}/`; - return posts({url, signal, axios, cheerio}); + return posts({ url, signal, axios, cheerio }); }; async function posts({ @@ -44,20 +44,20 @@ async function posts({ }: { url: string; signal: AbortSignal; - axios: ProviderContext['axios']; - cheerio: ProviderContext['cheerio']; + axios: ProviderContext["axios"]; + cheerio: ProviderContext["cheerio"]; }): Promise { try { - const res = await axios.get(url, {signal}); + const res = await axios.get(url, { signal }); const data = res.data; const $ = cheerio.load(data); const catalog: Post[] = []; - $('.post-cards') - .find('article') + $(".post-cards") + .find("article") .map((i, element) => { - const title = $(element).find('a').attr('title'); - const link = $(element).find('a').attr('href'); - const image = $(element).find('img').attr('src'); + const title = $(element).find("a").attr("title"); + const link = $(element).find("a").attr("href"); + const image = $(element).find("img").attr("src"); if (title && link && image) { catalog.push({ title: title, @@ -68,7 +68,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('modGetPosts error ', err); + console.error("modGetPosts error ", err); return []; } } diff --git a/providers/mod/modGetStream.ts b/providers/mod/stream.ts similarity index 51% rename from providers/mod/modGetStream.ts rename to providers/mod/stream.ts index 0f84824..adf9f82 100644 --- a/providers/mod/modGetStream.ts +++ b/providers/mod/stream.ts @@ -1,26 +1,26 @@ -import {Stream, ProviderContext, EpisodeLink} from '../types'; +import { Stream, ProviderContext, EpisodeLink } from "../types"; const headers = { Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Cache-Control': 'no-store', - 'Accept-Language': 'en-US,en;q=0.9', - DNT: '1', - 'sec-ch-ua': + "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - Cookie: 'popads_user_id=6ba8fe60a481387a3249f05aa058822d', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + Cookie: "popads_user_id=6ba8fe60a481387a3249f05aa058822d", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", }; -export const modGetStream = async function ({ +export const getStream = async function ({ link: url, type, providerContext, @@ -29,7 +29,7 @@ export const modGetStream = async function ({ type: string; providerContext: ProviderContext; }): Promise { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; try { const modGetEpisodeLinks = async function ({ url, @@ -38,40 +38,40 @@ export const modGetStream = async function ({ url: string; providerContext: ProviderContext; }): Promise { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; try { - if (url.includes('url=')) { - url = atob(url.split('url=')[1]); + if (url.includes("url=")) { + url = atob(url.split("url=")[1]); } const res = await axios.get(url); const html = res.data; let $ = cheerio.load(html); - if (url.includes('url=')) { + if (url.includes("url=")) { const newUrl = $("meta[http-equiv='refresh']") - .attr('content') - ?.split('url=')[1]; + .attr("content") + ?.split("url=")[1]; const res2 = await axios.get(newUrl || url); const html2 = res2.data; $ = cheerio.load(html2); } const episodeLinks: EpisodeLink[] = []; - $('h3,h4').map((i, element) => { + $("h3,h4").map((i, element) => { const seriesTitle = $(element).text(); - const episodesLink = $(element).find('a').attr('href'); - if (episodesLink && episodesLink !== '#') { + const episodesLink = $(element).find("a").attr("href"); + if (episodesLink && episodesLink !== "#") { episodeLinks.push({ - title: seriesTitle.trim() || 'No title found', - link: episodesLink || '', + title: seriesTitle.trim() || "No title found", + link: episodesLink || "", }); } }); - $('a.maxbutton').map((i, element) => { - const seriesTitle = $(element).children('span').text(); - const episodesLink = $(element).attr('href'); - if (episodesLink && episodesLink !== '#') { + $("a.maxbutton").map((i, element) => { + const seriesTitle = $(element).children("span").text(); + const episodesLink = $(element).attr("href"); + if (episodesLink && episodesLink !== "#") { episodeLinks.push({ - title: seriesTitle.trim() || 'No title found', - link: episodesLink || '', + title: seriesTitle.trim() || "No title found", + link: episodesLink || "", }); } }); @@ -81,9 +81,9 @@ export const modGetStream = async function ({ return []; } }; - console.log('modGetStream', type, url); - if (type === 'movie') { - const servers = await modGetEpisodeLinks({url, providerContext}); + console.log("modGetStream", type, url); + if (type === "movie") { + const servers = await modGetEpisodeLinks({ url, providerContext }); url = servers[0].link || url; } @@ -98,22 +98,22 @@ export const modGetStream = async function ({ // console.log(ddl); const servers: Stream[] = []; const driveLink = await isDriveLink(ddl); - const driveRes = await axios.get(driveLink, {headers}); + const driveRes = await axios.get(driveLink, { headers }); const driveHtml = driveRes.data; const $drive = cheerio.load(driveHtml); try { - const resumeBot = $drive('.btn.btn-light').attr('href') || ''; - const resumeBotRes = await axios.get(resumeBot, {headers}); + const resumeBot = $drive(".btn.btn-light").attr("href") || ""; + const resumeBotRes = await axios.get(resumeBot, { headers }); const resumeBotToken = resumeBotRes.data.match( - /formData\.append\('token', '([a-f0-9]+)'\)/, + /formData\.append\('token', '([a-f0-9]+)'\)/ )[1]; const resumeBotBody = new FormData(); - resumeBotBody.append('token', resumeBotToken); + resumeBotBody.append("token", resumeBotToken); const resumeBotPath = resumeBotRes.data.match( - /fetch\('\/download\?id=([a-zA-Z0-9\/+]+)'/, + /fetch\('\/download\?id=([a-zA-Z0-9\/+]+)'/ )[1]; - const resumeBotBaseUrl = resumeBot.split('/download')[0]; + const resumeBotBaseUrl = resumeBot.split("/download")[0]; // console.log( // 'resumeBotPath', // resumeBotBaseUrl + '/download?id=' + resumeBotPath, @@ -121,84 +121,84 @@ export const modGetStream = async function ({ // console.log('resumeBotBody', resumeBotToken); const resumeBotDownload = await fetch( - resumeBotBaseUrl + '/download?id=' + resumeBotPath, + resumeBotBaseUrl + "/download?id=" + resumeBotPath, { - method: 'POST', + method: "POST", body: resumeBotBody, headers: { Referer: resumeBot, - Cookie: 'PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308', + Cookie: "PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308", }, - }, + } ); const resumeBotDownloadData = await resumeBotDownload.json(); - console.log('resumeBotDownloadData', resumeBotDownloadData.url); + console.log("resumeBotDownloadData", resumeBotDownloadData.url); servers.push({ - server: 'ResumeBot', + server: "ResumeBot", link: resumeBotDownloadData.url, - type: 'mkv', + type: "mkv", }); } catch (err) { - console.log('ResumeBot link not found', err); + console.log("ResumeBot link not found", err); } // CF workers type 1 try { - const cfWorkersLink = driveLink.replace('/file', '/wfile') + '?type=1'; - const cfWorkersRes = await axios.get(cfWorkersLink, {headers}); + const cfWorkersLink = driveLink.replace("/file", "/wfile") + "?type=1"; + const cfWorkersRes = await axios.get(cfWorkersLink, { headers }); const cfWorkersHtml = cfWorkersRes.data; const $cfWorkers = cheerio.load(cfWorkersHtml); - const cfWorkersStream = $cfWorkers('.btn-success'); + const cfWorkersStream = $cfWorkers(".btn-success"); cfWorkersStream.each((i, el) => { - const link = el.attribs.href; + const link = (el as any).attribs?.href; if (link) { servers.push({ - server: 'Cf Worker 1.' + i, + server: "Cf Worker 1." + i, link: link, - type: 'mkv', + type: "mkv", }); } }); } catch (err) { - console.log('CF workers link not found', err); + console.log("CF workers link not found", err); } // CF workers type 2 try { - const cfWorkersLink = driveLink.replace('/file', '/wfile') + '?type=2'; - const cfWorkersRes = await axios.get(cfWorkersLink, {headers}); + const cfWorkersLink = driveLink.replace("/file", "/wfile") + "?type=2"; + const cfWorkersRes = await axios.get(cfWorkersLink, { headers }); const cfWorkersHtml = cfWorkersRes.data; const $cfWorkers = cheerio.load(cfWorkersHtml); - const cfWorkersStream = $cfWorkers('.btn-success'); + const cfWorkersStream = $cfWorkers(".btn-success"); cfWorkersStream.each((i, el) => { - const link = el.attribs.href; + const link = (el as any).attribs?.href; if (link) { servers.push({ - server: 'Cf Worker 2.' + i, + server: "Cf Worker 2." + i, link: link, - type: 'mkv', + type: "mkv", }); } }); } catch (err) { - console.log('CF workers link not found', err); + console.log("CF workers link not found", err); } // gdrive //instant link try { - const seed = $drive('.btn-danger').attr('href') || ''; - const instantToken = seed.split('=')[1]; + const seed = $drive(".btn-danger").attr("href") || ""; + const instantToken = seed.split("=")[1]; // console.log('InstantToken', instantToken); const InstantFromData = new FormData(); - InstantFromData.append('keys', instantToken); - const videoSeedUrl = seed.split('/').slice(0, 3).join('/') + '/api'; + InstantFromData.append("keys", instantToken); + const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api"; // console.log('videoSeedUrl', videoSeedUrl); const instantLinkRes = await fetch(videoSeedUrl, { - method: 'POST', + method: "POST", body: InstantFromData, headers: { - 'x-token': videoSeedUrl, + "x-token": videoSeedUrl, }, }); const instantLinkData = await instantLinkRes.json(); @@ -206,32 +206,32 @@ export const modGetStream = async function ({ if (instantLinkData.error === false) { const instantLink = instantLinkData.url; servers.push({ - server: 'Gdrive-Instant', + server: "Gdrive-Instant", link: instantLink, - type: 'mkv', + type: "mkv", }); } else { - console.log('Instant link not found', instantLinkData); + console.log("Instant link not found", instantLinkData); } } catch (err) { - console.log('Instant link not found', err); + console.log("Instant link not found", err); } return servers; } catch (err) { - console.log('getStream error', err); + console.log("getStream error", err); return []; } }; const isDriveLink = async (ddl: string) => { - if (ddl.includes('drive')) { + if (ddl.includes("drive")) { const driveLeach = await fetch(ddl); const driveLeachData = await driveLeach.text(); const pathMatch = driveLeachData.match( - /window\.location\.replace\("([^"]+)"\)/, + /window\.location\.replace\("([^"]+)"\)/ ); const path = pathMatch?.[1]; - const mainUrl = ddl.split('/')[2]; + const mainUrl = ddl.split("/")[2]; console.log(`driveUrl = https://${mainUrl}${path}`); return `https://${mainUrl}${path}`; } else { @@ -240,13 +240,13 @@ const isDriveLink = async (ddl: string) => { }; async function modExtractor(url: string, providerContext: ProviderContext) { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; try { - const wpHttp = url.split('sid=')[1]; + const wpHttp = url.split("sid=")[1]; var bodyFormData0 = new FormData(); - bodyFormData0.append('_wp_http', wpHttp); - const res = await fetch(url.split('?')[0], { - method: 'POST', + bodyFormData0.append("_wp_http", wpHttp); + const res = await fetch(url.split("?")[0], { + method: "POST", body: bodyFormData0, }); const data = await res.text(); @@ -255,25 +255,25 @@ async function modExtractor(url: string, providerContext: ProviderContext) { const $ = cheerio.load(html); // find input with name="_wp_http2" - const wpHttp2 = $('input').attr('name', '_wp_http2').val(); + const wpHttp2 = $("input").attr("name", "_wp_http2").val(); // console.log('wpHttp2', wpHttp2); // form data var bodyFormData = new FormData(); - bodyFormData.append('_wp_http2', wpHttp2); - const formUrl1 = $('form').attr('action'); - const formUrl = formUrl1 || url.split('?')[0]; + bodyFormData.append("_wp_http2", wpHttp2); + const formUrl1 = $("form").attr("action"); + const formUrl = formUrl1 || url.split("?")[0]; const res2 = await fetch(formUrl, { - method: 'POST', + method: "POST", body: bodyFormData, }); const html2: any = await res2.text(); const link = html2.match(/setAttribute\("href",\s*"(.*?)"/)[1]; console.log(link); - const cookie = link.split('=')[1]; - console.log('cookie', cookie); + const cookie = link.split("=")[1]; + console.log("cookie", cookie); const downloadLink = await axios.get(link, { headers: { @@ -283,6 +283,6 @@ async function modExtractor(url: string, providerContext: ProviderContext) { }); return downloadLink; } catch (err) { - console.log('modGetStream error', err); + console.log("modGetStream error", err); } } diff --git a/providers/moviesApi/index.ts b/providers/moviesApi/index.ts index 3d1e234..7ba51be 100644 --- a/providers/moviesApi/index.ts +++ b/providers/moviesApi/index.ts @@ -1,8 +1,8 @@ -import {allCatalog, allGenresList} from '../autoEmbed/allCatalog'; -import {allGetInfo} from '../autoEmbed/allGetInfo'; -import {allGetPost, allGetSearchPosts} from '../autoEmbed/allGetPost'; -import {ProviderType} from '../types'; -import {mpGetStream} from './mpGetStream'; +import { allCatalog, allGenresList } from "../autoEmbed/catalog"; +import { allGetInfo } from../autoEmbed/metafo"; +import { allGetPost, allGetSearchPosts } from "../autoEmbed/posts"; +import { ProviderType } from "../types"; +import { mpGetStream } from "./stream"; export const moviesApi: ProviderType = { catalog: allCatalog, diff --git a/providers/moviesApi/mpGetStream.ts b/providers/moviesApi/stream.ts similarity index 100% rename from providers/moviesApi/mpGetStream.ts rename to providers/moviesApi/stream.ts diff --git a/providers/multi/catalog.ts b/providers/multi/catalog.ts new file mode 100644 index 0000000..0d1fd9e --- /dev/null +++ b/providers/multi/catalog.ts @@ -0,0 +1,77 @@ +export const catalog = [ + { + title: "Trending", + filter: "/trending/", + }, + { + title: "Netflix", + filter: "/genre/netflix/", + }, + { + title: "Amazon Prime", + filter: "/genre/amazon-prime/", + }, + { + title: "Disney Hotstar", + filter: "/genre/disney-hotstar/", + }, +]; + +export const genres = [ + { + title: "Action", + filter: "/genre/action/", + }, + { + title: "Adventure", + filter: "/genre/adventure/", + }, + { + title: "Animation", + filter: "/genre/animation/", + }, + { + title: "Comedy", + filter: "/genre/comedy/", + }, + { + title: "Crime", + filter: "/genre/crime/", + }, + { + title: "Drama", + filter: "/genre/drama/", + }, + { + title: "Family", + filter: "/genre/family/", + }, + { + title: "Fantasy", + filter: "/genre/fantasy/", + }, + { + title: "History", + filter: "/genre/history/", + }, + { + title: "Horror", + filter: "/genre/horror/", + }, + { + title: "Mystery", + filter: "/genre/mystery/", + }, + { + title: "Romance", + filter: "/genre/romance/", + }, + { + title: "Science Fiction", + filter: "/genre/science-fiction/", + }, + { + title: "Thriller", + filter: "/genre/thriller/", + }, +]; diff --git a/providers/multi/index.ts b/providers/multi/index.ts deleted file mode 100644 index 8266acd..0000000 --- a/providers/multi/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {multiGenresList, multiCatalog} from './multiCatalog'; -import {multiGetInfo} from './multiGetInfo'; -import {multiGetPosts, multiGetPostsSearch} from './multiPosts'; -import {multiGetStream} from './multiGetStream'; -import {ProviderType} from '../types'; - -export const multiMovies: ProviderType = { - catalog: multiCatalog, - genres: multiGenresList, - GetMetaData: multiGetInfo, - GetHomePosts: multiGetPosts, - GetStream: multiGetStream, - GetSearchPosts: multiGetPostsSearch, -}; diff --git a/providers/multi/multiGetInfo.ts b/providers/multi/meta.ts similarity index 51% rename from providers/multi/multiGetInfo.ts rename to providers/multi/meta.ts index fdd2f03..ec890dd 100644 --- a/providers/multi/multiGetInfo.ts +++ b/providers/multi/meta.ts @@ -1,6 +1,6 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; -export const multiGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -8,41 +8,41 @@ export const multiGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const url = link; const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); - const type = url.includes('tvshows') ? 'series' : 'movie'; - const imdbId = ''; - const title = url.split('/')[4].replace(/-/g, ' '); - const image = $('.g-item').find('a').attr('href') || ''; - const synopsis = $('.wp-content').find('p').text() || ''; + const type = url.includes("tvshows") ? "series" : "movie"; + const imdbId = ""; + const title = url.split("/")[4].replace(/-/g, " "); + const image = $(".g-item").find("a").attr("href") || ""; + const synopsis = $(".wp-content").find("p").text() || ""; // Links const links: Link[] = []; - if (type === 'series') { - $('#seasons') + if (type === "series") { + $("#seasons") .children() .map((i, element) => { const title = $(element) - .find('.title') + .find(".title") .children() .remove() .end() .text(); - let episodesList: {title: string; link: string}[] = []; + let episodesList: { title: string; link: string }[] = []; $(element) - .find('.episodios') + .find(".episodios") .children() .map((i, element) => { const title = - 'Episode' + - $(element).find('.numerando').text().trim().split('-')[1]; - const link = $(element).find('a').attr('href'); + "Episode" + + $(element).find(".numerando").text().trim().split("-")[1]; + const link = $(element).find("a").attr("href"); if (title && link) { - episodesList.push({title, link}); + episodesList.push({ title, link }); } }); if (title && episodesList.length > 0) { @@ -55,7 +55,7 @@ export const multiGetInfo = async function ({ } else { links.push({ title: title, - directLinks: [{title: title, link: url.slice(0, -1), type: 'movie'}], + directLinks: [{ title: title, link: url.slice(0, -1), type: "movie" }], }); } // console.log('multi meta', links); @@ -71,11 +71,11 @@ export const multiGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/multi/multiCatalog.ts b/providers/multi/multiCatalog.ts deleted file mode 100644 index 796d006..0000000 --- a/providers/multi/multiCatalog.ts +++ /dev/null @@ -1,77 +0,0 @@ -export const multiCatalog = [ - { - title: 'Trending', - filter: '/trending/', - }, - { - title: 'Netflix', - filter: '/genre/netflix/', - }, - { - title: 'Amazon Prime', - filter: '/genre/amazon-prime/', - }, - { - title: 'Disney Hotstar', - filter: '/genre/disney-hotstar/', - }, -]; - -export const multiGenresList = [ - { - title: 'Action', - filter: '/genre/action/', - }, - { - title: 'Adventure', - filter: '/genre/adventure/', - }, - { - title: 'Animation', - filter: '/genre/animation/', - }, - { - title: 'Comedy', - filter: '/genre/comedy/', - }, - { - title: 'Crime', - filter: '/genre/crime/', - }, - { - title: 'Drama', - filter: '/genre/drama/', - }, - { - title: 'Family', - filter: '/genre/family/', - }, - { - title: 'Fantasy', - filter: '/genre/fantasy/', - }, - { - title: 'History', - filter: '/genre/history/', - }, - { - title: 'Horror', - filter: '/genre/horror/', - }, - { - title: 'Mystery', - filter: '/genre/mystery/', - }, - { - title: 'Romance', - filter: '/genre/romance/', - }, - { - title: 'Science Fiction', - filter: '/genre/science-fiction/', - }, - { - title: 'Thriller', - filter: '/genre/thriller/', - }, -]; diff --git a/providers/multi/multiPosts.ts b/providers/multi/posts.ts similarity index 52% rename from providers/multi/multiPosts.ts rename to providers/multi/posts.ts index 71dff11..38acef6 100644 --- a/providers/multi/multiPosts.ts +++ b/providers/multi/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const multiGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -12,13 +12,13 @@ export const multiGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, cheerio} = providerContext; - const baseUrl = await getBaseUrl('multi'); + const { getBaseUrl, cheerio } = providerContext; + const baseUrl = await getBaseUrl("multi"); const url = `${baseUrl + filter}page/${page}/`; - return posts({url, signal, cheerio}); + return posts({ url, signal, cheerio }); }; -export const multiGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, signal, @@ -30,10 +30,10 @@ export const multiGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, cheerio} = providerContext; - const baseUrl = await getBaseUrl('multi'); + const { getBaseUrl, cheerio } = providerContext; + const baseUrl = await getBaseUrl("multi"); const url = `${baseUrl}/?s=${searchQuery}`; - return posts({url, signal, cheerio}); + return posts({ url, signal, cheerio }); }; async function posts({ @@ -43,21 +43,21 @@ async function posts({ }: { url: string; signal: AbortSignal; - cheerio: ProviderContext['cheerio']; + cheerio: ProviderContext["cheerio"]; }): Promise { try { - const res = await fetch(url, {signal}); + const res = await fetch(url, { signal }); const data = await res.text(); const $ = cheerio.load(data); const catalog: Post[] = []; - $('.items.full') + $(".items.full") .children() .map((i, element) => { - const title = $(element).find('.poster').find('img').attr('alt'); - const link = $(element).find('.poster').find('a').attr('href'); + const title = $(element).find(".poster").find("img").attr("alt"); + const link = $(element).find(".poster").find("a").attr("href"); const image = - $(element).find('.poster').find('img').attr('data-src') || - $(element).find('.poster').find('img').attr('src'); + $(element).find(".poster").find("img").attr("data-src") || + $(element).find(".poster").find("img").attr("src"); if (title && link && image) { catalog.push({ title: title, @@ -68,7 +68,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('multiGetPosts error ', err); + console.error("multiGetPosts error ", err); return []; } } diff --git a/providers/multi/multiGetStream.ts b/providers/multi/stream.ts similarity index 59% rename from providers/multi/multiGetStream.ts rename to providers/multi/stream.ts index afd6418..a4767f2 100644 --- a/providers/multi/multiGetStream.ts +++ b/providers/multi/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext, TextTracks, TextTrackType} from '../types'; +import { Stream, ProviderContext, TextTracks, TextTrackType } from "../types"; -export const multiGetStream = async function ({ +export const getStream = async function ({ link: url, providerContext, }: { @@ -8,70 +8,70 @@ export const multiGetStream = async function ({ type: string; providerContext: ProviderContext; }): Promise { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const headers = { - 'sec-ch-ua': + "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - Referer: 'https://multimovies.online/', - 'Sec-Fetch-User': '?1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + Referer: "https://multimovies.online/", + "Sec-Fetch-User": "?1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", }; try { - const res = await axios.get(url, {headers}); + const res = await axios.get(url, { headers }); const html = res.data; const $ = cheerio.load(html); const streamLinks: Stream[] = []; - const postId = $('#player-option-1').attr('data-post'); - const nume = $('#player-option-1').attr('data-nume'); - const typeValue = $('#player-option-1').attr('data-type'); + const postId = $("#player-option-1").attr("data-post"); + const nume = $("#player-option-1").attr("data-nume"); + const typeValue = $("#player-option-1").attr("data-type"); - const baseUrl = url.split('/').slice(0, 3).join('/'); - console.log('baseUrl', baseUrl); + const baseUrl = url.split("/").slice(0, 3).join("/"); + console.log("baseUrl", baseUrl); const formData = new FormData(); - formData.append('action', 'doo_player_ajax'); - formData.append('post', postId); - formData.append('nume', nume); - formData.append('type', typeValue); + formData.append("action", "doo_player_ajax"); + formData.append("post", postId || ""); + formData.append("nume", nume || ""); + formData.append("type", typeValue || ""); - console.log('formData', formData); + console.log("formData", formData); const playerRes = await fetch(`${baseUrl}/wp-admin/admin-ajax.php`, { headers: headers, body: formData, - method: 'POST', + method: "POST", }); const playerData = await playerRes.json(); - console.log('playerData', playerData); + console.log("playerData", playerData); let ifameUrl = playerData?.embed_url?.match(/]+src="([^"]+)"[^>]*>/i)?.[1] || playerData?.embed_url; - console.log('ifameUrl', ifameUrl); - if (!ifameUrl.includes('multimovies')) { - let playerBaseUrl = ifameUrl.split('/').slice(0, 3).join('/'); - const newPlayerBaseUrl = await axios.head(playerBaseUrl, {headers}); + console.log("ifameUrl", ifameUrl); + if (!ifameUrl.includes("multimovies")) { + let playerBaseUrl = ifameUrl.split("/").slice(0, 3).join("/"); + const newPlayerBaseUrl = await axios.head(playerBaseUrl, { headers }); if (newPlayerBaseUrl) { playerBaseUrl = newPlayerBaseUrl.request?.responseURL - ?.split('/') + ?.split("/") .slice(0, 3) - .join('/'); + .join("/"); } - const playerId = ifameUrl.split('/').pop(); + const playerId = ifameUrl.split("/").pop(); const NewformData = new FormData(); - NewformData.append('sid', playerId); + NewformData.append("sid", playerId); console.log( - 'NewformData', - playerBaseUrl + '/embedhelper.php', - NewformData, + "NewformData", + playerBaseUrl + "/embedhelper.php", + NewformData ); const playerRes = await fetch(`${playerBaseUrl}/embedhelper.php`, { headers: headers, body: NewformData, - method: 'POST', + method: "POST", }); const playerData = await playerRes.json(); // console.log('playerData', playerData); @@ -80,7 +80,7 @@ export const multiGetStream = async function ({ JSON.parse(atob(playerData?.mresult))?.smwh || playerData?.mresult?.smwh; const newIframeUrl = siteUrl + siteId; - console.log('newIframeUrl', newIframeUrl); + console.log("newIframeUrl", newIframeUrl); if (newIframeUrl) { ifameUrl = newIframeUrl; } @@ -97,7 +97,7 @@ export const multiGetStream = async function ({ var functionRegex = /eval\(function\((.*?)\)\{.*?return p\}.*?\('(.*?)'\.split/; var match = functionRegex.exec(iframeData); - let p = ''; + let p = ""; if (match) { // var params = match[1].split(',').map(param => param.trim()); var encodedString = match[2]; @@ -107,19 +107,19 @@ export const multiGetStream = async function ({ p = encodedString.split("',36,")?.[0].trim(); let a = 36; - let c = encodedString.split("',36,")[1].slice(2).split('|').length; - let k = encodedString.split("',36,")[1].slice(2).split('|'); + let c = encodedString.split("',36,")[1].slice(2).split("|").length; + let k = encodedString.split("',36,")[1].slice(2).split("|"); while (c--) { if (k[c]) { - var regex = new RegExp('\\b' + c.toString(a) + '\\b', 'g'); + var regex = new RegExp("\\b" + c.toString(a) + "\\b", "g"); p = p.replace(regex, k[c]); } } // console.log('Decoded String:', p); } else { - console.log('No match found'); + console.log("No match found"); } const streamUrl = p?.match(/https?:\/\/[^"]+?\.m3u8[^"]*/)?.[0]; @@ -138,13 +138,13 @@ export const multiGetStream = async function ({ }); }); } - console.log('streamUrl', streamUrl); - console.log('newUrl', streamUrl?.replace(/&i=\d+,'\.4&/, '&i=0.4&')); + console.log("streamUrl", streamUrl); + console.log("newUrl", streamUrl?.replace(/&i=\d+,'\.4&/, "&i=0.4&")); if (streamUrl) { streamLinks.push({ - server: 'Multi', - link: streamUrl.replace(/&i=\d+,'\.4&/, '&i=0.4&'), - type: 'm3u8', + server: "Multi", + link: streamUrl.replace(/&i=\d+,'\.4&/, "&i=0.4&"), + type: "m3u8", subtitles: subtitles, }); } diff --git a/providers/netflixMirror/catalog.ts b/providers/netflixMirror/catalog.ts new file mode 100644 index 0000000..10c2852 --- /dev/null +++ b/providers/netflixMirror/catalog.ts @@ -0,0 +1,16 @@ +export const catalog = [ + { + title: "Home", + filter: "/mobile/home?app=1", + }, + { + title: "Series", + filter: "/mobile/series", + }, + { + title: "Movies", + filter: "/mobile/movies", + }, +]; + +export const genres = []; diff --git a/providers/netflixMirror/episodes.ts b/providers/netflixMirror/episodes.ts new file mode 100644 index 0000000..0356949 --- /dev/null +++ b/providers/netflixMirror/episodes.ts @@ -0,0 +1,49 @@ +import { EpisodeLink, ProviderContext } from "../types"; + +export const getEpisodes = async function ({ + url: link, + providerContext, +}: { + url: string; + providerContext: ProviderContext; +}): Promise { + const { getBaseUrl, axios } = providerContext; + let providerValue = "netflixMirror"; + try { + const baseUrl = await getBaseUrl("nfMirror"); + const url = + `${baseUrl}${ + providerValue === "netflixMirror" + ? "/episodes.php?s=" + : "/pv/episodes.php?s=" + }` + + link + + "&t=" + + Math.round(new Date().getTime() / 1000); + console.log("nfEpisodesUrl", url); + const res = await axios.get(url, { + headers: { + "Content-Type": "application/json", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36", + "Accept-Language": "en-US,en;q=0.9", + }, + }); + const data = res.data; + console.log("nfEpisodes", data); + + const episodeList: EpisodeLink[] = []; + + data?.episodes?.map((episode: any) => { + episodeList.push({ + title: "Episode " + episode?.ep.replace("E", ""), + link: episode?.id, + }); + }); + + return episodeList; + } catch (err) { + console.error("nfGetEpisodes error", err); + return []; + } +}; diff --git a/providers/netflixMirror/index.ts b/providers/netflixMirror/index.ts deleted file mode 100644 index 9b724d0..0000000 --- a/providers/netflixMirror/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {nfCatalog, nfGenresList} from './nfCatalog'; -import {nfGetInfo} from './nfGetInfo'; -import {nfGetPost, nfGetPostsSearch} from './nfGetPost'; -import {nfGetEpisodes} from './nfGetEpisodes'; -import {nfGetStream} from './nfGetSteam'; -import {ProviderType} from '../types'; - -export const netflixMirror: ProviderType = { - catalog: nfCatalog, - genres: nfGenresList, - GetMetaData: nfGetInfo, - GetHomePosts: nfGetPost, - GetStream: nfGetStream, - GetEpisodeLinks: nfGetEpisodes, - GetSearchPosts: nfGetPostsSearch, -}; diff --git a/providers/netflixMirror/nfGetInfo.ts b/providers/netflixMirror/meta.ts similarity index 56% rename from providers/netflixMirror/nfGetInfo.ts rename to providers/netflixMirror/meta.ts index fc5c356..1519b90 100644 --- a/providers/netflixMirror/nfGetInfo.ts +++ b/providers/netflixMirror/meta.ts @@ -1,46 +1,46 @@ -import {Info, Link} from '../types'; +import { Info, Link } from "../types"; -export const nfGetInfo = async function ({ +export const getMeta = async function ({ link, }: { link: string; }): Promise { - let providerValue = 'netflixMirror'; + let providerValue = "netflixMirror"; try { const isPrime = - providerValue === 'primeMirror' ? 'isPrime=true' : 'isPrime=false'; + providerValue === "primeMirror" ? "isPrime=true" : "isPrime=false"; const url = `https://netmirror.8man.me/api/net-proxy?${isPrime}&url=${encodeURIComponent( - link, + link )}`; - console.log('nfifo', url); + console.log("nfifo", url); const res = await fetch(url, { - credentials: 'omit', + credentials: "omit", }); const data = await res.json(); - const id = link.split('id=')[1]?.split('&')[0]; + const id = link.split("id=")[1]?.split("&")[0]; const meta = { title: data.title, synopsis: data.desc, image: `https://img.nfmirrorcdn.top/poster/h/${id}.jpg`, - cast: data?.short_cast?.split(','), - tags: [data?.year, data?.hdsd, ...data?.thismovieis?.split(',')], - imdbId: '', - type: 'series', + cast: data?.short_cast?.split(","), + tags: [data?.year, data?.hdsd, ...data?.thismovieis?.split(",")], + imdbId: "", + type: "series", }; - console.log('nfinfo', meta); + console.log("nfinfo", meta); const linkList: Link[] = []; if (data?.season?.length > 0) { data.season.map((season: any) => { linkList.push({ - title: 'Season ' + season?.s, + title: "Season " + season?.s, episodesLink: season?.id, }); }); } else { linkList.push({ title: meta.title, - directLinks: [{link: id, title: 'Movie', type: 'movie'}], + directLinks: [{ link: id, title: "Movie", type: "movie" }], }); } @@ -52,11 +52,11 @@ export const nfGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: '', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "", linkList: [], }; } diff --git a/providers/netflixMirror/nfCatalog.ts b/providers/netflixMirror/nfCatalog.ts deleted file mode 100644 index ab75040..0000000 --- a/providers/netflixMirror/nfCatalog.ts +++ /dev/null @@ -1,16 +0,0 @@ -export const nfCatalog = [ - { - title: 'Home', - filter: '/mobile/home?app=1', - }, - { - title: 'Series', - filter: '/mobile/series', - }, - { - title: 'Movies', - filter: '/mobile/movies', - }, -]; - -export const nfGenresList = []; diff --git a/providers/netflixMirror/nfGetEpisodes.ts b/providers/netflixMirror/nfGetEpisodes.ts deleted file mode 100644 index a61ccfa..0000000 --- a/providers/netflixMirror/nfGetEpisodes.ts +++ /dev/null @@ -1,49 +0,0 @@ -import {EpisodeLink, ProviderContext} from '../types'; - -export const nfGetEpisodes = async function ({ - url: link, - providerContext, -}: { - url: string; - providerContext: ProviderContext; -}): Promise { - const {getBaseUrl, axios} = providerContext; - let providerValue = 'netflixMirror'; - try { - const baseUrl = await getBaseUrl('nfMirror'); - const url = - `${baseUrl}${ - providerValue === 'netflixMirror' - ? '/episodes.php?s=' - : '/pv/episodes.php?s=' - }` + - link + - '&t=' + - Math.round(new Date().getTime() / 1000); - console.log('nfEpisodesUrl', url); - const res = await axios.get(url, { - headers: { - 'Content-Type': 'application/json', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36', - 'Accept-Language': 'en-US,en;q=0.9', - }, - }); - const data = res.data; - console.log('nfEpisodes', data); - - const episodeList: EpisodeLink[] = []; - - data?.episodes?.map((episode: any) => { - episodeList.push({ - title: 'Episode ' + episode?.ep.replace('E', ''), - link: episode?.id, - }); - }); - - return episodeList; - } catch (err) { - console.error('nfGetEpisodes error', err); - return []; - } -}; diff --git a/providers/netflixMirror/nfGetPost.ts b/providers/netflixMirror/posts.ts similarity index 58% rename from providers/netflixMirror/nfGetPost.ts rename to providers/netflixMirror/posts.ts index a32e02c..f5962cc 100644 --- a/providers/netflixMirror/nfGetPost.ts +++ b/providers/netflixMirror/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const nfGetPost = async function ({ +export const getPosts = async function ({ filter, page, providerValue, @@ -14,15 +14,15 @@ export const nfGetPost = async function ({ providerContext: ProviderContext; }): Promise { try { - const {getBaseUrl, cheerio} = providerContext; - const baseUrl = await getBaseUrl('nfMirror'); + const { getBaseUrl, cheerio } = providerContext; + const baseUrl = await getBaseUrl("nfMirror"); const catalog: Post[] = []; if (page > 1) { return []; } // console.log(filter); const isPrime = - providerValue === 'primeMirror' ? 'isPrime=true' : 'isPrime=false'; + providerValue === "primeMirror" ? "isPrime=true" : "isPrime=false"; const url = `https://netmirror.8man.me/api/net-proxy?${isPrime}&url=${ baseUrl + filter @@ -30,29 +30,29 @@ export const nfGetPost = async function ({ const res = await fetch(url, { signal: signal, - method: 'GET', - credentials: 'omit', + method: "GET", + credentials: "omit", }); const data = await res.text(); // console.log('nfPost', data); const $ = cheerio.load(data); - $('a.post-data').map((i, element) => { - const title = ''; - const id = $(element).attr('data-post'); + $("a.post-data").map((i, element) => { + const title = ""; + const id = $(element).attr("data-post"); // console.log('id', id); - const image = $(element).find('img').attr('data-src') || ''; + const image = $(element).find("img").attr("data-src") || ""; if (id) { catalog.push({ title: title, link: baseUrl + `${ - providerValue === 'netflixMirror' - ? '/post.php?id=' - : '/pv/post.php?id=' + providerValue === "netflixMirror" + ? "/post.php?id=" + : "/pv/post.php?id=" }` + id + - '&t=' + + "&t=" + Math.round(new Date().getTime() / 1000), image: image, }); @@ -61,12 +61,12 @@ export const nfGetPost = async function ({ // console.log(catalog); return catalog; } catch (err) { - console.error('nf error ', err); + console.error("nf error ", err); return []; } }; -export const nfGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, providerValue, @@ -79,35 +79,35 @@ export const nfGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl} = providerContext; + const { getBaseUrl } = providerContext; try { if (page > 1) { return []; } const catalog: Post[] = []; - const baseUrl = await getBaseUrl('nfMirror'); + const baseUrl = await getBaseUrl("nfMirror"); const isPrime = - providerValue === 'primeMirror' ? 'isPrime=true' : 'isPrime=false'; + providerValue === "primeMirror" ? "isPrime=true" : "isPrime=false"; const url = `https://netmirror.8man.me/api/net-proxy?${isPrime}&url=${baseUrl}${ - providerValue === 'netflixMirror' ? '' : '/pv' + providerValue === "netflixMirror" ? "" : "/pv" }/search.php?s=${encodeURI(searchQuery)}`; const res = await fetch(url, { signal: signal, - method: 'GET', - credentials: 'omit', + method: "GET", + credentials: "omit", }); const data = await res.json(); data?.searchResult?.forEach((result: any) => { - const title = result?.t || ''; + const title = result?.t || ""; const id = result?.id; const image = - providerValue === 'netflixMirror' + providerValue === "netflixMirror" ? `https://imgcdn.media/poster/v/${id}.jpg` - : ''; + : ""; if (id) { catalog.push({ @@ -115,12 +115,12 @@ export const nfGetPostsSearch = async function ({ link: baseUrl + `${ - providerValue === 'netflixMirror' - ? '/mobile/post.php?id=' - : '/mobile/pv/post.php?id=' + providerValue === "netflixMirror" + ? "/mobile/post.php?id=" + : "/mobile/pv/post.php?id=" }` + id + - '&t=' + + "&t=" + Math.round(new Date().getTime() / 1000), image: image, }); @@ -129,7 +129,7 @@ export const nfGetPostsSearch = async function ({ return catalog; } catch (err) { - console.error('Search error:', err); + console.error("Search error:", err); return []; } }; diff --git a/providers/primeMirror/pmGetStream.ts b/providers/netflixMirror/stream.ts similarity index 56% rename from providers/primeMirror/pmGetStream.ts rename to providers/netflixMirror/stream.ts index 4bfb535..40d300a 100644 --- a/providers/primeMirror/pmGetStream.ts +++ b/providers/netflixMirror/stream.ts @@ -1,24 +1,24 @@ -import {ProviderContext, Stream} from '../types'; +import { ProviderContext, Stream } from "../types"; -export const pmGetStream = async ({ +export const getStream = async ({ link: id, providerContext, }: { link: string; providerContext: ProviderContext; }): Promise => { - const {getBaseUrl} = providerContext; + const { getBaseUrl } = providerContext; try { - let providerValue = 'primeMirror'; - const baseUrl = await getBaseUrl('nfMirror'); + let providerValue = "netflixMirror"; + const baseUrl = await getBaseUrl("nfMirror"); const url = `https://netmirror.8man.me/api/net-proxy?url=${baseUrl}${ - providerValue === 'netflixMirror' - ? '/mobile/playlist.php?id=' - : '/pv/playlist.php?id=' + providerValue === "netflixMirror" + ? "/mobile/playlist.php?id=" + : "/pv/playlist.php?id=" }${id}&t=${Math.round(new Date().getTime() / 1000)}`; - console.log('nfGetStream, url:', url); + console.log("nfGetStream, url:", url); const res = await fetch(url, { - credentials: 'omit', + credentials: "omit", }); const resJson = await res.json(); const data = resJson?.[0]; @@ -26,12 +26,12 @@ export const pmGetStream = async ({ data?.sources.forEach((source: any) => { streamLinks.push({ server: source.label, - link: (baseUrl + source.file)?.replace(':su', ':ni'), - type: 'm3u8', + link: (baseUrl + source.file)?.replace(":su", ":ni"), + type: "m3u8", headers: { Referer: baseUrl, origin: baseUrl, - Cookie: 'hd=on', + Cookie: "hd=on", }, }); }); diff --git a/providers/primeMirror/catalog.ts b/providers/primeMirror/catalog.ts new file mode 100644 index 0000000..10c2852 --- /dev/null +++ b/providers/primeMirror/catalog.ts @@ -0,0 +1,16 @@ +export const catalog = [ + { + title: "Home", + filter: "/mobile/home?app=1", + }, + { + title: "Series", + filter: "/mobile/series", + }, + { + title: "Movies", + filter: "/mobile/movies", + }, +]; + +export const genres = []; diff --git a/providers/primeMirror/episodes.ts b/providers/primeMirror/episodes.ts new file mode 100644 index 0000000..def3fce --- /dev/null +++ b/providers/primeMirror/episodes.ts @@ -0,0 +1,49 @@ +import { EpisodeLink, ProviderContext } from "../types"; + +export const getEpisodes = async function ({ + url: link, + providerContext, +}: { + url: string; + providerContext: ProviderContext; +}): Promise { + const { getBaseUrl, axios } = providerContext; + let providerValue = "primeMirror"; + try { + const baseUrl = await getBaseUrl("nfMirror"); + const url = + `${baseUrl}${ + providerValue === "netflixMirror" + ? "/episodes.php?s=" + : "/pv/episodes.php?s=" + }` + + link + + "&t=" + + Math.round(new Date().getTime() / 1000); + console.log("nfEpisodesUrl", url); + const res = await axios.get(url, { + headers: { + "Content-Type": "application/json", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36", + "Accept-Language": "en-US,en;q=0.9", + }, + }); + const data = res.data; + console.log("nfEpisodes", data); + + const episodeList: EpisodeLink[] = []; + + data?.episodes?.map((episode: any) => { + episodeList.push({ + title: "Episode " + episode?.ep.replace("E", ""), + link: episode?.id, + }); + }); + + return episodeList; + } catch (err) { + console.error("nfGetEpisodes error", err); + return []; + } +}; diff --git a/providers/primeMirror/index.ts b/providers/primeMirror/index.ts deleted file mode 100644 index 0abe7c3..0000000 --- a/providers/primeMirror/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {nfCatalog, nfGenresList} from '../netflixMirror/nfCatalog'; -import {nfGetPost, nfGetPostsSearch} from '../netflixMirror/nfGetPost'; -import {ProviderType} from '../types'; -import {pmGetInfo} from './pmGetInfo'; -import {pmGetStream} from './pmGetStream'; -import {pmGetEpisodes} from './pmGetEpisodes'; - -export const primeMirror: ProviderType = { - catalog: nfCatalog, - genres: nfGenresList, - GetMetaData: pmGetInfo, - GetHomePosts: nfGetPost, - GetStream: pmGetStream, - GetEpisodeLinks: pmGetEpisodes, - GetSearchPosts: nfGetPostsSearch, -}; diff --git a/providers/primeMirror/pmGetInfo.ts b/providers/primeMirror/meta.ts similarity index 56% rename from providers/primeMirror/pmGetInfo.ts rename to providers/primeMirror/meta.ts index b30f451..7bcddda 100644 --- a/providers/primeMirror/pmGetInfo.ts +++ b/providers/primeMirror/meta.ts @@ -1,46 +1,46 @@ -import {Info, Link} from '../types'; +import { Info, Link } from "../types"; -export const pmGetInfo = async function ({ +export const getMeta = async function ({ link, }: { link: string; }): Promise { - let providerValue = 'primeMirror'; + let providerValue = "primeMirror"; try { const isPrime = - providerValue === 'primeMirror' ? 'isPrime=true' : 'isPrime=false'; + providerValue === "primeMirror" ? "isPrime=true" : "isPrime=false"; const url = `https://netmirror.8man.me/api/net-proxy?${isPrime}&url=${encodeURIComponent( - link, + link )}`; - console.log('nfifo', url); + console.log("nfifo", url); const res = await fetch(url, { - credentials: 'omit', + credentials: "omit", }); const data = await res.json(); - const id = link.split('id=')[1]?.split('&')[0]; + const id = link.split("id=")[1]?.split("&")[0]; const meta = { title: data.title, synopsis: data.desc, image: `https://img.nfmirrorcdn.top/poster/h/${id}.jpg`, - cast: data?.short_cast?.split(','), - tags: [data?.year, data?.hdsd, ...data?.thismovieis?.split(',')], - imdbId: '', - type: 'series', + cast: data?.short_cast?.split(","), + tags: [data?.year, data?.hdsd, ...data?.thismovieis?.split(",")], + imdbId: "", + type: "series", }; - console.log('nfinfo', meta); + console.log("nfinfo", meta); const linkList: Link[] = []; if (data?.season?.length > 0) { data.season.map((season: any) => { linkList.push({ - title: 'Season ' + season?.s, + title: "Season " + season?.s, episodesLink: season?.id, }); }); } else { linkList.push({ title: meta.title, - directLinks: [{link: id, title: 'Movie', type: 'movie'}], + directLinks: [{ link: id, title: "Movie", type: "movie" }], }); } @@ -52,11 +52,11 @@ export const pmGetInfo = async function ({ } catch (err) { console.error(err); return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: '', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "", linkList: [], }; } diff --git a/providers/primeMirror/pmGetEpisodes.ts b/providers/primeMirror/pmGetEpisodes.ts deleted file mode 100644 index e148e09..0000000 --- a/providers/primeMirror/pmGetEpisodes.ts +++ /dev/null @@ -1,49 +0,0 @@ -import {EpisodeLink, ProviderContext} from '../types'; - -export const pmGetEpisodes = async function ({ - url: link, - providerContext, -}: { - url: string; - providerContext: ProviderContext; -}): Promise { - const {getBaseUrl, axios} = providerContext; - let providerValue = 'primeMirror'; - try { - const baseUrl = await getBaseUrl('nfMirror'); - const url = - `${baseUrl}${ - providerValue === 'netflixMirror' - ? '/episodes.php?s=' - : '/pv/episodes.php?s=' - }` + - link + - '&t=' + - Math.round(new Date().getTime() / 1000); - console.log('nfEpisodesUrl', url); - const res = await axios.get(url, { - headers: { - 'Content-Type': 'application/json', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36', - 'Accept-Language': 'en-US,en;q=0.9', - }, - }); - const data = res.data; - console.log('nfEpisodes', data); - - const episodeList: EpisodeLink[] = []; - - data?.episodes?.map((episode: any) => { - episodeList.push({ - title: 'Episode ' + episode?.ep.replace('E', ''), - link: episode?.id, - }); - }); - - return episodeList; - } catch (err) { - console.error('nfGetEpisodes error', err); - return []; - } -}; diff --git a/providers/primeMirror/posts.ts b/providers/primeMirror/posts.ts new file mode 100644 index 0000000..f5962cc --- /dev/null +++ b/providers/primeMirror/posts.ts @@ -0,0 +1,135 @@ +import { Post, ProviderContext } from "../types"; + +export const getPosts = async function ({ + filter, + page, + providerValue, + signal, + providerContext, +}: { + filter: string; + page: number; + providerValue: string; + signal: AbortSignal; + providerContext: ProviderContext; +}): Promise { + try { + const { getBaseUrl, cheerio } = providerContext; + const baseUrl = await getBaseUrl("nfMirror"); + const catalog: Post[] = []; + if (page > 1) { + return []; + } + // console.log(filter); + const isPrime = + providerValue === "primeMirror" ? "isPrime=true" : "isPrime=false"; + + const url = `https://netmirror.8man.me/api/net-proxy?${isPrime}&url=${ + baseUrl + filter + }`; + + const res = await fetch(url, { + signal: signal, + method: "GET", + credentials: "omit", + }); + const data = await res.text(); + // console.log('nfPost', data); + const $ = cheerio.load(data); + $("a.post-data").map((i, element) => { + const title = ""; + const id = $(element).attr("data-post"); + // console.log('id', id); + const image = $(element).find("img").attr("data-src") || ""; + if (id) { + catalog.push({ + title: title, + link: + baseUrl + + `${ + providerValue === "netflixMirror" + ? "/post.php?id=" + : "/pv/post.php?id=" + }` + + id + + "&t=" + + Math.round(new Date().getTime() / 1000), + image: image, + }); + } + }); + // console.log(catalog); + return catalog; + } catch (err) { + console.error("nf error ", err); + return []; + } +}; + +export const getSearchPosts = async function ({ + searchQuery, + page, + providerValue, + signal, + providerContext, +}: { + searchQuery: string; + page: number; + providerValue: string; + signal: AbortSignal; + providerContext: ProviderContext; +}): Promise { + const { getBaseUrl } = providerContext; + try { + if (page > 1) { + return []; + } + const catalog: Post[] = []; + const baseUrl = await getBaseUrl("nfMirror"); + const isPrime = + providerValue === "primeMirror" ? "isPrime=true" : "isPrime=false"; + + const url = `https://netmirror.8man.me/api/net-proxy?${isPrime}&url=${baseUrl}${ + providerValue === "netflixMirror" ? "" : "/pv" + }/search.php?s=${encodeURI(searchQuery)}`; + + const res = await fetch(url, { + signal: signal, + method: "GET", + credentials: "omit", + }); + + const data = await res.json(); + + data?.searchResult?.forEach((result: any) => { + const title = result?.t || ""; + const id = result?.id; + const image = + providerValue === "netflixMirror" + ? `https://imgcdn.media/poster/v/${id}.jpg` + : ""; + + if (id) { + catalog.push({ + title: title, + link: + baseUrl + + `${ + providerValue === "netflixMirror" + ? "/mobile/post.php?id=" + : "/mobile/pv/post.php?id=" + }` + + id + + "&t=" + + Math.round(new Date().getTime() / 1000), + image: image, + }); + } + }); + + return catalog; + } catch (err) { + console.error("Search error:", err); + return []; + } +}; diff --git a/providers/netflixMirror/nfGetSteam.ts b/providers/primeMirror/stream.ts similarity index 56% rename from providers/netflixMirror/nfGetSteam.ts rename to providers/primeMirror/stream.ts index 516dcc9..8f426e6 100644 --- a/providers/netflixMirror/nfGetSteam.ts +++ b/providers/primeMirror/stream.ts @@ -1,24 +1,24 @@ -import {ProviderContext, Stream} from '../types'; +import { ProviderContext, Stream } from "../types"; -export const nfGetStream = async ({ +export const getStream = async ({ link: id, providerContext, }: { link: string; providerContext: ProviderContext; }): Promise => { - const {getBaseUrl} = providerContext; + const { getBaseUrl } = providerContext; try { - let providerValue = 'netflixMirror'; - const baseUrl = await getBaseUrl('nfMirror'); + let providerValue = "primeMirror"; + const baseUrl = await getBaseUrl("nfMirror"); const url = `https://netmirror.8man.me/api/net-proxy?url=${baseUrl}${ - providerValue === 'netflixMirror' - ? '/mobile/playlist.php?id=' - : '/pv/playlist.php?id=' + providerValue === "netflixMirror" + ? "/mobile/playlist.php?id=" + : "/pv/playlist.php?id=" }${id}&t=${Math.round(new Date().getTime() / 1000)}`; - console.log('nfGetStream, url:', url); + console.log("nfGetStream, url:", url); const res = await fetch(url, { - credentials: 'omit', + credentials: "omit", }); const resJson = await res.json(); const data = resJson?.[0]; @@ -26,12 +26,12 @@ export const nfGetStream = async ({ data?.sources.forEach((source: any) => { streamLinks.push({ server: source.label, - link: (baseUrl + source.file)?.replace(':su', ':ni'), - type: 'm3u8', + link: (baseUrl + source.file)?.replace(":su", ":ni"), + type: "m3u8", headers: { Referer: baseUrl, origin: baseUrl, - Cookie: 'hd=on', + Cookie: "hd=on", }, }); }); diff --git a/providers/primewire/catalog.ts b/providers/primewire/catalog.ts new file mode 100644 index 0000000..3808326 --- /dev/null +++ b/providers/primewire/catalog.ts @@ -0,0 +1,16 @@ +export const catalog = [ + { + title: "Recently Added", + filter: "/filter?sort=Just+Added&free_links=true", + }, + { + title: "TV Shows", + filter: "/filter?sort=Trending+Today&type=tv", + }, + { + title: "Movies", + filter: "/filter?sort=Trending+Today&type=movie", + }, +]; + +export const genres = []; diff --git a/providers/primewire/index.ts b/providers/primewire/index.ts deleted file mode 100644 index a294547..0000000 --- a/providers/primewire/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {pwCatalogList, pwGenresList} from './pwCatalogl'; -import {pwGetPosts, pwGetPostsSearch} from './pwGetPosts'; -import {pwGetInfo} from './pwGetInfo'; -import {pwGetStream} from './pwGetStream'; -import {ProviderType} from '../types'; - -export const primewire: ProviderType = { - catalog: pwCatalogList, - genres: pwGenresList, - GetMetaData: pwGetInfo, - GetHomePosts: pwGetPosts, - GetStream: pwGetStream, - GetSearchPosts: pwGetPostsSearch, -}; diff --git a/providers/primewire/pwGetInfo.ts b/providers/primewire/meta.ts similarity index 54% rename from providers/primewire/pwGetInfo.ts rename to providers/primewire/meta.ts index 9fe7441..06acf67 100644 --- a/providers/primewire/pwGetInfo.ts +++ b/providers/primewire/meta.ts @@ -1,6 +1,6 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; -export const pwGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -8,34 +8,34 @@ export const pwGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const url = link; - const baseUrl = link.split('/').slice(0, 3).join('/'); + const baseUrl = link.split("/").slice(0, 3).join("/"); const res = await axios.get(url); const html = await res.data; const $ = cheerio.load(html); const imdbId = - $('.movie_info') + $(".movie_info") .find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])') - .attr('href') - ?.split('/')[4] || ''; - const type = $('.show_season').html() ? 'series' : 'movie'; + .attr("href") + ?.split("/")[4] || ""; + const type = $(".show_season").html() ? "series" : "movie"; const linkList: Link[] = []; - $('.show_season').each((i, element) => { - const seasonTitle = 'Season ' + $(element).attr('data-id'); - const episodes: Link['directLinks'] = []; + $(".show_season").each((i, element) => { + const seasonTitle = "Season " + $(element).attr("data-id"); + const episodes: Link["directLinks"] = []; $(element) .children() .each((i, element2) => { const episodeTitle = $(element2) - .find('a') + .find("a") .children() .remove() .end() .text() .trim() - .replace('E', 'Epiosode '); - const episodeLink = baseUrl + $(element2).find('a').attr('href'); + .replace("E", "Epiosode "); + const episodeLink = baseUrl + $(element2).find("a").attr("href"); if (episodeTitle && episodeLink) { episodes.push({ title: episodeTitle, @@ -48,35 +48,35 @@ export const pwGetInfo = async function ({ directLinks: episodes, }); }); - if (type === 'movie') { + if (type === "movie") { linkList.push({ - title: 'Movie', + title: "Movie", directLinks: [ { link: link, - title: 'Movie', - type: 'movie', + title: "Movie", + type: "movie", }, ], }); } return { - title: '', - image: '', + title: "", + image: "", imdbId: imdbId, - synopsis: '', + synopsis: "", type: type, linkList: linkList, }; } catch (error) { console.error(error); return { - title: '', - image: '', - imdbId: '', - synopsis: '', + title: "", + image: "", + imdbId: "", + synopsis: "", linkList: [], - type: 'uhd', + type: "uhd", }; } }; diff --git a/providers/primewire/pwGetPosts.ts b/providers/primewire/posts.ts similarity index 51% rename from providers/primewire/pwGetPosts.ts rename to providers/primewire/posts.ts index 0375f4e..12f70f0 100644 --- a/providers/primewire/pwGetPosts.ts +++ b/providers/primewire/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const pwGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -12,14 +12,14 @@ export const pwGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; + const { getBaseUrl, axios, cheerio } = providerContext; - const baseUrl = await getBaseUrl('primewire'); + const baseUrl = await getBaseUrl("primewire"); const url = `${baseUrl + filter}&page=${page}`; - return posts({baseUrl, url, signal, axios, cheerio}); + return posts({ baseUrl, url, signal, axios, cheerio }); }; -export const pwGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -31,17 +31,17 @@ export const pwGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio, Aes} = providerContext; + const { getBaseUrl, axios, cheerio, Aes } = providerContext; const getSHA256ofJSON = async function (input: any) { return await Aes.sha1(input); }; - const baseUrl = await getBaseUrl('primewire'); - const hash = await getSHA256ofJSON(searchQuery + 'JyjId97F9PVqUPuMO0'); + const baseUrl = await getBaseUrl("primewire"); + const hash = await getSHA256ofJSON(searchQuery + "JyjId97F9PVqUPuMO0"); const url = `${baseUrl}/filter?s=${searchQuery}&page=${page}&ds=${hash.slice( 0, - 10, + 10 )}`; - return posts({baseUrl, url, signal, axios, cheerio}); + return posts({ baseUrl, url, signal, axios, cheerio }); }; async function posts({ @@ -54,18 +54,18 @@ async function posts({ baseUrl: string; url: string; signal: AbortSignal; - axios: ProviderContext['axios']; - cheerio: ProviderContext['cheerio']; + axios: ProviderContext["axios"]; + cheerio: ProviderContext["cheerio"]; }): Promise { try { - const res = await axios.get(url, {signal}); + const res = await axios.get(url, { signal }); const data = res.data; const $ = cheerio.load(data); const catalog: Post[] = []; - $('.index_item.index_item_ie').map((i, element) => { - const title = $(element).find('a').attr('title'); - const link = $(element).find('a').attr('href'); - const image = $(element).find('img').attr('src') || ''; + $(".index_item.index_item_ie").map((i, element) => { + const title = $(element).find("a").attr("title"); + const link = $(element).find("a").attr("href"); + const image = $(element).find("img").attr("src") || ""; if (title && link) { catalog.push({ title: title, @@ -76,7 +76,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('primewire error ', err); + console.error("primewire error ", err); return []; } } diff --git a/providers/primewire/pwCatalogl.ts b/providers/primewire/pwCatalogl.ts deleted file mode 100644 index 895eef0..0000000 --- a/providers/primewire/pwCatalogl.ts +++ /dev/null @@ -1,16 +0,0 @@ -export const pwCatalogList = [ - { - title: 'Recently Added', - filter: '/filter?sort=Just+Added&free_links=true', - }, - { - title: 'TV Shows', - filter: '/filter?sort=Trending+Today&type=tv', - }, - { - title: 'Movies', - filter: '/filter?sort=Trending+Today&type=movie', - }, -]; - -export const pwGenresList = []; diff --git a/providers/primewire/pwGetStream.ts b/providers/primewire/stream.ts similarity index 51% rename from providers/primewire/pwGetStream.ts rename to providers/primewire/stream.ts index 5798298..64874de 100644 --- a/providers/primewire/pwGetStream.ts +++ b/providers/primewire/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext} from '../types'; +import { Stream, ProviderContext } from "../types"; -export const pwGetStream = async function ({ +export const getStream = async function ({ link: url, type, providerContext, @@ -9,48 +9,48 @@ export const pwGetStream = async function ({ type: string; providerContext: ProviderContext; }): Promise { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; try { - console.log('pwGetStream', type, url); - const baseUrl = url.split('/').slice(0, 3).join('/'); + console.log("pwGetStream", type, url); + const baseUrl = url.split("/").slice(0, 3).join("/"); const streamLinks: Stream[] = []; - const urls: {id: string; size: string}[] = []; + const urls: { id: string; size: string }[] = []; const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); $('tr:contains("mixdrop")').map((i, element) => { - const id = $(element).find('.wp-menu-btn').attr('data-wp-menu'); - const size = $(element).find('.wp-menu-btn').next().text(); + const id = $(element).find(".wp-menu-btn").attr("data-wp-menu"); + const size = $(element).find(".wp-menu-btn").next().text(); if (id) { - urls.push({id: baseUrl + '/links/go/' + id, size}); + urls.push({ id: baseUrl + "/links/go/" + id, size }); } }); - console.log('urls', urls); + console.log("urls", urls); for (const url of urls) { const res2 = await axios.head(url.id); - const location = res2.request?.responseURL.replace('/f/', '/e/'); + const location = res2.request?.responseURL.replace("/f/", "/e/"); const res3 = await fetch(location, { - credentials: 'include', + credentials: "include", headers: { - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0', + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0", Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', - 'Accept-Language': 'en-US,en;q=0.5', - 'Upgrade-Insecure-Requests': '1', - 'Sec-Fetch-Dest': 'iframe', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-Site': 'same-origin', - Pragma: 'no-cache', - 'Cache-Control': 'no-cache', + "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", + "Accept-Language": "en-US,en;q=0.5", + "Upgrade-Insecure-Requests": "1", + "Sec-Fetch-Dest": "iframe", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "same-origin", + Pragma: "no-cache", + "Cache-Control": "no-cache", referer: res2.request?.responseURL, }, referrer: res2.request?.responseURL, - method: 'GET', - mode: 'cors', + method: "GET", + mode: "cors", }); const data3 = await res3.text(); @@ -59,26 +59,26 @@ export const pwGetStream = async function ({ var functionRegex = /eval\(function\((.*?)\)\{.*?return p\}.*?\('(.*?)'\.split/; var match = functionRegex.exec(data3); - let p = ''; + let p = ""; if (match) { // var params = match[1].split(',').map(param => param.trim()); var encodedString = match[2]; - console.log('Encoded String:', encodedString); + console.log("Encoded String:", encodedString); // console.log('Parameters:', params); // console.log('Encoded String:', encodedString.split("',36,")[0], '🔥🔥'); const base = Number( - encodedString.split(",'|MDCore|")[0].split(',')[ - encodedString.split(",'|MDCore|")[0].split(',').length - 1 - ], + encodedString.split(",'|MDCore|")[0].split(",")[ + encodedString.split(",'|MDCore|")[0].split(",").length - 1 + ] ); - console.log('Base:', base); + console.log("Base:", base); p = encodedString.split(`',${base},`)?.[0].trim(); let a = base; - let c = encodedString.split(`',${base},`)[1].slice(2).split('|').length; - let k = encodedString.split(`',${base},`)[1].slice(2).split('|'); + let c = encodedString.split(`',${base},`)[1].slice(2).split("|").length; + let k = encodedString.split(`',${base},`)[1].slice(2).split("|"); // console.log('p:', p); // console.log('a:', a); @@ -91,12 +91,12 @@ export const pwGetStream = async function ({ c: any, k: any, e: any, - d: any, + d: any ) { e = function (c: any) { return c.toString(36); }; - if (!''.replace(/^/, String)) { + if (!"".replace(/^/, String)) { while (c--) { d[c.toString(a)] = k[c] || c.toString(a); } @@ -106,13 +106,13 @@ export const pwGetStream = async function ({ }, ]; e = function () { - return '\\w+'; + return "\\w+"; }; c = 1; } while (c--) { if (k[c]) { - p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); + p = p.replace(new RegExp("\\b" + e(c) + "\\b", "g"), k[c]); } } return p; @@ -121,30 +121,30 @@ export const pwGetStream = async function ({ const decoded = decode(p, a, c, k, 0, {}); // get MDCore.wurl= const wurl = decoded.match(/MDCore\.wurl="([^"]+)"/)?.[1]; - console.log('wurl:', wurl); - const streamUrl = 'https:' + wurl; - console.log('streamUrl:', streamUrl); + console.log("wurl:", wurl); + const streamUrl = "https:" + wurl; + console.log("streamUrl:", streamUrl); streamLinks.push({ - server: 'Mixdrop ' + url.size, + server: "Mixdrop " + url.size, link: streamUrl, - type: 'mp4', + type: "mp4", headers: { - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0', + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0", Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', - 'Accept-Language': 'en-US,en;q=0.5', - 'Upgrade-Insecure-Requests': '1', - 'Sec-Fetch-Dest': 'iframe', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-Site': 'same-origin', - Pragma: 'no-cache', - 'Cache-Control': 'no-cache', + "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", + "Accept-Language": "en-US,en;q=0.5", + "Upgrade-Insecure-Requests": "1", + "Sec-Fetch-Dest": "iframe", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "same-origin", + Pragma: "no-cache", + "Cache-Control": "no-cache", referer: res2.request?.responseURL, }, }); } else { - console.log('No match found'); + console.log("No match found"); } } return streamLinks; diff --git a/providers/protonMovies/catalog.ts b/providers/protonMovies/catalog.ts new file mode 100644 index 0000000..dbfcac3 --- /dev/null +++ b/providers/protonMovies/catalog.ts @@ -0,0 +1,20 @@ +export const catalog = [ + { + title: "Latest", + filter: "/movies", + }, + { + title: "Netflix", + filter: "/platform/netflix", + }, + { + title: "Disney +", + filter: "/platform/disney-hotstar", + }, + { + title: "Amazon Prime", + filter: "/platform/amazon-prime-video", + }, +]; + +export const genres = []; diff --git a/providers/protonMovies/index.ts b/providers/protonMovies/index.ts deleted file mode 100644 index 299eae8..0000000 --- a/providers/protonMovies/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {protonGenresList, protonCatalogList} from './protonCatalog'; -import {protonGetPosts, protonGetPostsSearch} from './protonGetPosts'; -import {protonGetInfo} from './protonGetMeta'; -import {ProviderType} from '../types'; -import {protonGetStream} from './protonGetStream'; - -export const protonMovies: ProviderType = { - catalog: protonCatalogList, - genres: protonGenresList, - GetMetaData: protonGetInfo, - GetHomePosts: protonGetPosts, - GetStream: protonGetStream, - GetSearchPosts: protonGetPostsSearch, -}; diff --git a/providers/protonMovies/meta.ts b/providers/protonMovies/meta.ts new file mode 100644 index 0000000..ec18fbc --- /dev/null +++ b/providers/protonMovies/meta.ts @@ -0,0 +1,109 @@ +import { EpisodeLink, Info, Link, ProviderContext } from "../types"; + +export const getMeta = async function ({ + link, + providerContext, +}: { + link: string; + providerContext: ProviderContext; +}): Promise { + try { + const { axios, cheerio, getBaseUrl } = providerContext; + console.log("all", link); + const res = await axios.get(link); + const data = res.data; + + function decodeHtml(encodedArray: string[]): string { + // Join array elements into a single string + const joined = encodedArray.join(""); + + // Replace escaped quotes + const unescaped = joined.replace(/\\"/g, '"').replace(/\\'/g, "'"); + + // Remove remaining escape characters + const cleaned = unescaped + .replace(/\\n/g, "\n") + .replace(/\\t/g, "\t") + .replace(/\\r/g, "\r"); + + // Convert literal string representations back to characters + const decoded = cleaned + .replace(/"/g, '"') + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/&/g, "&"); + + return decoded; + } + + const $$ = cheerio.load(data); + const htmlArray = $$('script:contains("decodeURIComponent")') + .text() + .split(" = ")?.[1] + ?.split("protomovies")?.[0] + ?.trim() + ?.slice(0, -1); // remove the last character + // console.log('protonGetInfo', htmlArray); + const html = decodeHtml(JSON.parse(htmlArray)); + // console.log('all', html); + const $ = cheerio.load(html); + + const title = $( + ".trending-text.fw-bold.texture-text.text-uppercase.my-0.fadeInLeft.animated.d-inline-block" + ).text(); + const image = $("#thumbnail").attr("src"); + const type = link.includes("series") ? "series" : "movie"; + const synopsis = + $(".col-12.iq-mb-30.animated.fadeIn").first().text() || + $(".description-content").text(); + const tags = $(".p-0.mt-2.list-inline.d-flex.flex-wrap.movie-tag") + .find("li") + .map((i, el) => $(el).text()) + .slice(0, 3) + .get(); + + const baseUrl = await getBaseUrl("protonMovies"); + const links: Link[] = []; + + if (type === "movie") { + const directLinks: EpisodeLink[] = []; + directLinks.push({ title: "Movie", link: link }); + links.push({ title: "Movie", directLinks: directLinks }); + } else { + $("#episodes") + .children() + .map((i, element) => { + let directLinks: EpisodeLink[] = []; + $(element) + .find(".episode-block") + .map((j, ep) => { + const link = baseUrl + $(ep).find("a").attr("href") || ""; + const title = + "Episode " + $(ep).find(".episode-number").text().split("E")[1]; + directLinks.push({ title, link }); + }); + links.push({ title: "Season " + (i + 1), directLinks: directLinks }); + }); + } + + return { + image: image || "", + imdbId: "", + linkList: links, + title: title || "", + synopsis: synopsis, + tags: tags, + type: type, + }; + } catch (err) { + console.error("prton", err); + return { + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", + linkList: [], + }; + } +}; diff --git a/providers/protonMovies/protonGetPosts.ts b/providers/protonMovies/posts.ts similarity index 59% rename from providers/protonMovies/protonGetPosts.ts rename to providers/protonMovies/posts.ts index 15d1b9d..1afc23b 100644 --- a/providers/protonMovies/protonGetPosts.ts +++ b/providers/protonMovies/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const protonGetPosts = async function ({ +export const getPosts = async function ({ filter, page, signal, @@ -12,13 +12,13 @@ export const protonGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('protonMovies'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("protonMovies"); const url = `${baseUrl + filter}/page/${page}/`; - return posts({url, baseUrl, signal, axios, cheerio}); + return posts({ url, baseUrl, signal, axios, cheerio }); }; -export const protonGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, signal, @@ -30,10 +30,10 @@ export const protonGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('protonMovies'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("protonMovies"); const url = `${baseUrl}/search/${searchQuery}/page/${page}/`; - return posts({url, baseUrl, signal, axios, cheerio}); + return posts({ url, baseUrl, signal, axios, cheerio }); }; async function posts({ @@ -46,28 +46,28 @@ async function posts({ url: string; baseUrl: string; signal: AbortSignal; - axios: ProviderContext['axios']; - cheerio: ProviderContext['cheerio']; + axios: ProviderContext["axios"]; + cheerio: ProviderContext["cheerio"]; }): Promise { function decodeHtml(encodedArray: string[]): string { // Join array elements into a single string - const joined = encodedArray.join(''); + const joined = encodedArray.join(""); // Replace escaped quotes const unescaped = joined.replace(/\\"/g, '"').replace(/\\'/g, "'"); // Remove remaining escape characters const cleaned = unescaped - .replace(/\\n/g, '\n') - .replace(/\\t/g, '\t') - .replace(/\\r/g, '\r'); + .replace(/\\n/g, "\n") + .replace(/\\t/g, "\t") + .replace(/\\r/g, "\r"); // Convert literal string representations back to characters const decoded = cleaned .replace(/"/g, '"') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/&/g, '&'); + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/&/g, "&"); return decoded; } @@ -84,13 +84,13 @@ async function posts({ const html = decodeHtml(JSON.parse(htmlArray[htmlArray.length - 1])); const $ = cheerio.load(html); const catalog: Post[] = []; - $('.col.mb-4').map((i, element) => { - const title = $(element).find('h5').text(); - const link = $(element).find('h5').find('a').attr('href'); + $(".col.mb-4").map((i, element) => { + const title = $(element).find("h5").text(); + const link = $(element).find("h5").find("a").attr("href"); const image = - $(element).find('img').attr('data-src') || - $(element).find('img').attr('src') || - ''; + $(element).find("img").attr("data-src") || + $(element).find("img").attr("src") || + ""; if (title && link && image) { catalog.push({ title: title, @@ -101,7 +101,7 @@ async function posts({ }); return catalog; } catch (err) { - console.error('protonGetPosts error ', err); + console.error("protonGetPosts error ", err); return []; } } diff --git a/providers/protonMovies/protonCatalog.ts b/providers/protonMovies/protonCatalog.ts deleted file mode 100644 index 676b5a0..0000000 --- a/providers/protonMovies/protonCatalog.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const protonCatalogList = [ - { - title: 'Latest', - filter: '/movies', - }, - { - title: 'Netflix', - filter: '/platform/netflix', - }, - { - title: 'Disney +', - filter: '/platform/disney-hotstar', - }, - { - title: 'Amazon Prime', - filter: '/platform/amazon-prime-video', - }, -]; - -export const protonGenresList = []; diff --git a/providers/protonMovies/protonGetMeta.ts b/providers/protonMovies/protonGetMeta.ts deleted file mode 100644 index e7eab11..0000000 --- a/providers/protonMovies/protonGetMeta.ts +++ /dev/null @@ -1,109 +0,0 @@ -import {EpisodeLink, Info, Link, ProviderContext} from '../types'; - -export const protonGetInfo = async function ({ - link, - providerContext, -}: { - link: string; - providerContext: ProviderContext; -}): Promise { - try { - const {axios, cheerio, getBaseUrl} = providerContext; - console.log('all', link); - const res = await axios.get(link); - const data = res.data; - - function decodeHtml(encodedArray: string[]): string { - // Join array elements into a single string - const joined = encodedArray.join(''); - - // Replace escaped quotes - const unescaped = joined.replace(/\\"/g, '"').replace(/\\'/g, "'"); - - // Remove remaining escape characters - const cleaned = unescaped - .replace(/\\n/g, '\n') - .replace(/\\t/g, '\t') - .replace(/\\r/g, '\r'); - - // Convert literal string representations back to characters - const decoded = cleaned - .replace(/"/g, '"') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/&/g, '&'); - - return decoded; - } - - const $$ = cheerio.load(data); - const htmlArray = $$('script:contains("decodeURIComponent")') - .text() - .split(' = ')?.[1] - ?.split('protomovies')?.[0] - ?.trim() - ?.slice(0, -1); // remove the last character - // console.log('protonGetInfo', htmlArray); - const html = decodeHtml(JSON.parse(htmlArray)); - // console.log('all', html); - const $ = cheerio.load(html); - - const title = $( - '.trending-text.fw-bold.texture-text.text-uppercase.my-0.fadeInLeft.animated.d-inline-block', - ).text(); - const image = $('#thumbnail').attr('src'); - const type = link.includes('series') ? 'series' : 'movie'; - const synopsis = - $('.col-12.iq-mb-30.animated.fadeIn').first().text() || - $('.description-content').text(); - const tags = $('.p-0.mt-2.list-inline.d-flex.flex-wrap.movie-tag') - .find('li') - .map((i, el) => $(el).text()) - .slice(0, 3) - .get(); - - const baseUrl = await getBaseUrl('protonMovies'); - const links: Link[] = []; - - if (type === 'movie') { - const directLinks: EpisodeLink[] = []; - directLinks.push({title: 'Movie', link: link}); - links.push({title: 'Movie', directLinks: directLinks}); - } else { - $('#episodes') - .children() - .map((i, element) => { - let directLinks: EpisodeLink[] = []; - $(element) - .find('.episode-block') - .map((j, ep) => { - const link = baseUrl + $(ep).find('a').attr('href') || ''; - const title = - 'Episode ' + $(ep).find('.episode-number').text().split('E')[1]; - directLinks.push({title, link}); - }); - links.push({title: 'Season ' + (i + 1), directLinks: directLinks}); - }); - } - - return { - image: image || '', - imdbId: '', - linkList: links, - title: title || '', - synopsis: synopsis, - tags: tags, - type: type, - }; - } catch (err) { - console.error('prton', err); - return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', - linkList: [], - }; - } -}; diff --git a/providers/protonMovies/protonGetStream.ts b/providers/protonMovies/stream.ts similarity index 77% rename from providers/protonMovies/protonGetStream.ts rename to providers/protonMovies/stream.ts index e8ac52d..48f85b3 100644 --- a/providers/protonMovies/protonGetStream.ts +++ b/providers/protonMovies/stream.ts @@ -1,4 +1,4 @@ -import {Stream, ProviderContext} from '../types'; +import { Stream, ProviderContext } from "../types"; function LALLJLutmoZpvvbikjaWM(str: string): ArrayBuffer { var buf = new ArrayBuffer(str.length * 2); @@ -11,60 +11,65 @@ function LALLJLutmoZpvvbikjaWM(str: string): ArrayBuffer { function getOrCreateUID() { const uid = - 'uid_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9); + "uid_" + Date.now() + "_" + Math.random().toString(36).substr(2, 9); return uid; } -export const protonGetStream = async function ({ +export const getStream = async function ({ link, providerContext, }: { link: string; providerContext: ProviderContext; }): Promise { - const {axios, cheerio, commonHeaders: headers, extractors} = providerContext; - const {gofileExtracter} = extractors; + const { + axios, + cheerio, + commonHeaders: headers, + extractors, + } = providerContext; + const { gofileExtracter } = extractors; function generateMessageToken(baseUrlL: string): string { - const hostname = baseUrlL?.replace(/https?:\/\//, '').split('/')[0]; - console.log('generateMessageToken hostname', hostname); + const hostname = baseUrlL?.replace(/https?:\/\//, "").split("/")[0]; + console.log("generateMessageToken hostname", hostname); const NsmxUftCNibQ = `[hostname=${hostname}][agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36 Edg/137.0.0.0][tmz=India Standard Time][userTimezoneOffset=-330][{"url":"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js","type":"script","duration":253.30000000074506},{"url":"https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback","type":"script","duration":397.19999999925494},{"url":"https://adoto.net/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js","type":"img","duration":225.90000000223517},{"url":"https://code.jquery.com/jquery-3.3.1.slim.min.js","type":"script","duration":65.30000000074506},{"url":"https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015","type":"script","duration":225.89999999850988},{"url":"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js","type":"script","duration":253.30000000074506},{"url":"https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback","type":"script","duration":397.19999999925494},{"url":"https://adoto.net/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js","type":"img","duration":225.90000000223517},{"url":"https://code.jquery.com/jquery-3.3.1.slim.min.js","type":"script","duration":65.30000000074506},{"url":"https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015","type":"script","duration":225.89999999850988},{"url":"https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/turnstile/if/ov2/av0/rcv/b3dhg/0x4AAAAAAAQDru7r64xT2ifD/auto/fbE/new/normal/auto/","type":"iframe","duration":2050.300000000745},{"url":"https://new19.gdtot.dad/favicon.ico","type":"img","duration":1003.6999999992549},{"url":"https://vikingfile.com/assets/favicon-64375c377b5df8304acbdad4f4430694.ico","type":"img","duration":183.19999999925494},{"url":"https://gofile.io/dist/img/favicon32.png","type":"img","duration":19177.199999999255},{"url":"https://pub.clickadu.com/assets/scripts/supported-browsers.js","type":"fetch","duration":18.799999997019768},{"url":"https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/turnstile/if/ov2/av0/rcv/b3dhg/0x4AAAAAAAQDru7r64xT2ifD/auto/fbE/auto_expire/normal/auto/","type":"iframe","duration":1612.5999999977648},{"url":"https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/turnstile/if/ov2/av0/rcv/b3dhg/0x4AAAAAAAQDru7r64xT2ifD/auto/fbE/auto_expire/normal/auto/","type":"iframe","duration":1154.0999999977648},{"url":"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js","type":"script","duration":253.30000000074506},{"url":"https://challenges.cloudflare.com/turnstile/v0/api.js?onload=onloadTurnstileCallback","type":"script","duration":397.19999999925494},{"url":"https://adoto.net/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js","type":"img","duration":225.90000000223517},{"url":"https://code.jquery.com/jquery-3.3.1.slim.min.js","type":"script","duration":65.30000000074506},{"url":"https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015","type":"script","duration":225.89999999850988},{"url":"https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/turnstile/if/ov2/av0/rcv/b3dhg/0x4AAAAAAAQDru7r64xT2ifD/auto/fbE/new/normal/auto/","type":"iframe","duration":2050.300000000745},{"url":"https://new19.gdtot.dad/favicon.ico","type":"img","duration":1003.6999999992549},{"url":"https://vikingfile.com/assets/favicon-64375c377b5df8304acbdad4f4430694.ico","type":"img","duration":183.19999999925494},{"url":"https://gofile.io/dist/img/favicon32.png","type":"img","duration":19177.199999999255},{"url":"https://pub.clickadu.com/assets/scripts/supported-browsers.js","type":"fetch","duration":18.799999997019768},{"url":"https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/turnstile/if/ov2/av0/rcv/b3dhg/0x4AAAAAAAQDru7r64xT2ifD/auto/fbE/auto_expire/normal/auto/","type":"iframe","duration":1612.5999999977648},{"url":"https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/turnstile/if/ov2/av0/rcv/b3dhg/0x4AAAAAAAQDru7r64xT2ifD/auto/fbE/auto_expire/normal/auto/","type":"iframe","duration":1154.0999999977648},{"url":"https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/turnstile/if/ov2/av0/rcv/b3dhg/0x4AAAAAAAQDru7r64xT2ifD/auto/fbE/auto_expire/normal/auto/","type":"iframe","duration":986}][{"elements":{"div":70,"span":68,"img":4,"iframe":0,"script":28,"link":20,"p":5,"a":213,"ul":28,"li":208,"button":9,"input":5},"hidden":{"div":13,"span":60,"img":1,"iframe":0,"script":28,"link":20,"p":0,"a":186,"ul":22,"li":184,"button":6,"input":2},"errors":{"network":0,"js":0},"eventListeners":0}]`; var jRpeP = LALLJLutmoZpvvbikjaWM(NsmxUftCNibQ); var jzKEwqEAcWFMNwHZnCCqJQ = new Uint8Array(jRpeP); var kyMXQUxoFYuZIBlKvlHa = jzKEwqEAcWFMNwHZnCCqJQ.toString(); - var kyMXQUxoFYuZIBlKvlHa = kyMXQUxoFYuZIBlKvlHa.replace(/2/g, '004'); - var kyMXQUxoFYuZIBlKvlHa = kyMXQUxoFYuZIBlKvlHa.replace(/3/g, '005'); - var kyMXQUxoFYuZIBlKvlHa = kyMXQUxoFYuZIBlKvlHa.replace(/7/g, '007'); - var kyMXQUxoFYuZIBlKvlHa = kyMXQUxoFYuZIBlKvlHa.replace(/,0,0,0/g, ''); + var kyMXQUxoFYuZIBlKvlHa = kyMXQUxoFYuZIBlKvlHa.replace(/2/g, "004"); + var kyMXQUxoFYuZIBlKvlHa = kyMXQUxoFYuZIBlKvlHa.replace(/3/g, "005"); + var kyMXQUxoFYuZIBlKvlHa = kyMXQUxoFYuZIBlKvlHa.replace(/7/g, "007"); + var kyMXQUxoFYuZIBlKvlHa = kyMXQUxoFYuZIBlKvlHa.replace(/,0,0,0/g, ""); return kyMXQUxoFYuZIBlKvlHa; } function decodeHtml(encodedArray: string[]): string { // Join array elements into a single string - const joined = encodedArray.join(''); + const joined = encodedArray.join(""); // Replace escaped quotes const unescaped = joined.replace(/\\"/g, '"').replace(/\\'/g, "'"); // Remove remaining escape characters const cleaned = unescaped - .replace(/\\n/g, '\n') - .replace(/\\t/g, '\t') - .replace(/\\r/g, '\r'); + .replace(/\\n/g, "\n") + .replace(/\\t/g, "\t") + .replace(/\\r/g, "\r"); // Convert literal string representations back to characters const decoded = cleaned .replace(/"/g, '"') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/&/g, '&'); + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/&/g, "&"); return decoded; } try { const streamLinks: Stream[] = []; - const res = await axios.get(link, {headers}); + const res = await axios.get(link, { headers }); const data = res.data; // const regex = /\[(?=.*?"
{ + idList.slice(0, 2).map(async (id) => { const formData = new URLSearchParams(); - formData.append('downloadid', id.id); - formData.append('token', 'ok'); + formData.append("downloadid", id.id); + formData.append("token", "ok"); const messageToken = generateMessageToken(baseUrl); const uid = getOrCreateUID(); const idRes = await fetch(`${baseUrl}/ppd.php`, { headers: { - accept: '*/*', - 'accept-language': 'en-US,en;q=0.9,en-IN;q=0.8', - 'cache-control': 'no-cache', - 'content-type': 'application/x-www-form-urlencoded', - pragma: 'no-cache', - priority: 'u=1, i', - 'sec-ch-ua': + accept: "*/*", + "accept-language": "en-US,en;q=0.9,en-IN;q=0.8", + "cache-control": "no-cache", + "content-type": "application/x-www-form-urlencoded", + pragma: "no-cache", + priority: "u=1, i", + "sec-ch-ua": '"Chromium";v="136", "Microsoft Edge";v="136", "Not.A/Brand";v="99"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'sec-fetch-dest': 'empty', - 'sec-fetch-mode': 'cors', - 'sec-fetch-site': 'same-origin', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "same-origin", cookie: - 'ext_name=ojplmecpdpgccookcobabopnaifgidhf; tgInvite222=true; cf_clearance=3ynJv2B6lHMj3FCOqtfQaL7lTN4KC3xmPRMgcNtddAc-1748787867-1.2.1.1-SEIhLbWR3ehfib5Y3P5pjzj1Qu9wipc52Icv4AmNkztXn2pTXhjKgxXnvTuA2bNscgHuc1juXujAHteqY_vaMmy2C3djMWnJGzjje_XvXZXKht8rwHZt6sviq7KAYvrYZPTrATqENuopzmqmK6dDFS.CAnWHt0VDn8q06iLm5rYj1AXUo3qkV5p1Idx_25elWHYGG8yengBrQV1MYVM9LMdQqv44PXu69FZvNkgv.d6blCKyneJnoLkw4LHAccu.QRPbFwWqqTDyO9YTLRQW9w29bKghD3_JVxkz.qxpg5FbocJ3i6tJJy74SvROpYdpVUOn0fW1YgQ7RxYwhNoHpdTKy8pvmQJGRuSVW1GjO_k', - Referer: 'https://m3.protonmovies.top/download/', - 'Referrer-Policy': 'strict-origin-when-cross-origin', + "ext_name=ojplmecpdpgccookcobabopnaifgidhf; tgInvite222=true; cf_clearance=3ynJv2B6lHMj3FCOqtfQaL7lTN4KC3xmPRMgcNtddAc-1748787867-1.2.1.1-SEIhLbWR3ehfib5Y3P5pjzj1Qu9wipc52Icv4AmNkztXn2pTXhjKgxXnvTuA2bNscgHuc1juXujAHteqY_vaMmy2C3djMWnJGzjje_XvXZXKht8rwHZt6sviq7KAYvrYZPTrATqENuopzmqmK6dDFS.CAnWHt0VDn8q06iLm5rYj1AXUo3qkV5p1Idx_25elWHYGG8yengBrQV1MYVM9LMdQqv44PXu69FZvNkgv.d6blCKyneJnoLkw4LHAccu.QRPbFwWqqTDyO9YTLRQW9w29bKghD3_JVxkz.qxpg5FbocJ3i6tJJy74SvROpYdpVUOn0fW1YgQ7RxYwhNoHpdTKy8pvmQJGRuSVW1GjO_k", + Referer: "https://m3.protonmovies.top/download/", + "Referrer-Policy": "strict-origin-when-cross-origin", }, body: `downloadid=${id.id}&msg=${messageToken}&uid=${uid}&token=ok`, - method: 'POST', + method: "POST", }); const idData = await idRes.text(); secondIdList.push({ quality: id.quality, id: idData, }); - console.log('idData', idData); - }), + console.log("idData", idData); + }) ); await Promise.all( - secondIdList.map(async id => { + secondIdList.map(async (id) => { const idRes = await axios.post(`${baseUrl}/tmp/${id.id}`); - if (idRes.data.ppd['gofile.io']) { + if (idRes.data.ppd["gofile.io"]) { const goRes = await gofileExtracter( - idRes.data.ppd['gofile.io'].link.split('/').pop(), + idRes.data.ppd["gofile.io"].link.split("/").pop() ); - console.log('link', goRes.link); + console.log("link", goRes.link); if (goRes.link) { streamLinks.push({ link: goRes.link, - server: 'gofile ' + id.quality, - type: 'mkv', + server: "gofile " + id.quality, + type: "mkv", headers: { - referer: 'https://gofile.io', - connection: 'keep-alive', - contentType: 'video/x-matroska', - cookie: 'accountToken=' + goRes.token, + referer: "https://gofile.io", + connection: "keep-alive", + contentType: "video/x-matroska", + cookie: "accountToken=" + goRes.token, }, }); } } - }), + }) ); return streamLinks; } catch (e) { - console.log('proton get stream err', e); + console.log("proton get stream err", e); return []; } }; diff --git a/providers/ridoMovies/catalog.ts b/providers/ridoMovies/catalog.ts new file mode 100644 index 0000000..fa11d5f --- /dev/null +++ b/providers/ridoMovies/catalog.ts @@ -0,0 +1,12 @@ +export const catalog = [ + { + title: "Popular Movies", + filter: "/top/catalog/movie/top.json", + }, + { + title: "Featured Movies", + filter: "/imdbRating/catalog/movie/imdbRating.json", + }, +]; + +export const genres = []; diff --git a/providers/ridoMovies/index.ts b/providers/ridoMovies/index.ts deleted file mode 100644 index ce8fdd8..0000000 --- a/providers/ridoMovies/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {ProviderType} from '../types'; -import {guardahdCatalog, guardahdGenresList} from '../guardahd/guardahdCatalog'; -import {allGetPost} from '../autoEmbed/allGetPost'; -import {guardahdGetSearchPosts} from '../guardahd/guardahdGetPosts'; -import {ridoGetInfo} from './ridoGetMeta'; -import {ridoGetStream} from './ridoGetSream'; - -export const ridoMovies: ProviderType = { - catalog: guardahdCatalog, - genres: guardahdGenresList, - GetMetaData: ridoGetInfo, - GetHomePosts: allGetPost, - GetStream: ridoGetStream, - GetSearchPosts: guardahdGetSearchPosts, -}; diff --git a/providers/ridoMovies/meta.ts b/providers/ridoMovies/meta.ts new file mode 100644 index 0000000..7fb16ec --- /dev/null +++ b/providers/ridoMovies/meta.ts @@ -0,0 +1,87 @@ +import { EpisodeLink, Info, Link, ProviderContext } from "../types"; + +export const getMeta = async function ({ + link, + providerContext, +}: { + link: string; + providerContext: ProviderContext; +}): Promise { + try { + const { getBaseUrl, axios } = providerContext; + const res = await axios.get(link); + const data = res.data; + const meta = { + title: "", + synopsis: "", + image: "", + imdbId: data?.meta?.imdb_id || "", + type: data?.meta?.type || "movie", + }; + const baseUrl = await getBaseUrl("ridomovies"); + let slug = ""; + try { + const res2 = await axios.get( + baseUrl + "/core/api/search?q=" + meta.imdbId + ); + const data2 = res2.data; + slug = data2?.data?.items[0]?.fullSlug; + if (!slug || meta?.type === "series") { + return { + title: "", + synopsis: "", + image: "", + imdbId: data?.meta?.imdb_id || "", + type: meta?.type || "movie", + linkList: [], + }; + } + } catch (err) { + return { + title: "", + synopsis: "", + image: "", + imdbId: meta?.imdbId || "", + type: meta?.type || "movie", + linkList: [], + }; + } + const links: Link[] = []; + let directLinks: EpisodeLink[] = []; + let season = new Map(); + if (meta.type === "series") { + data?.meta?.videos?.map((video: any) => { + if (video?.season <= 0) return; + if (!season.has(video?.season)) { + season.set(video?.season, []); + } + season.get(video?.season).push({ + title: "Episode " + video?.episode, + link: "", + }); + }); + for (const [seasonNum, episodes] of season.entries()) { + links.push({ + title: "Season " + seasonNum, + directLinks: episodes, + }); + } + } else { + directLinks.push({ title: "Movie", link: link }); + links.push({ title: "Movie", directLinks: directLinks }); + } + return { + ...meta, + linkList: links, + }; + } catch (err) { + return { + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", + linkList: [], + }; + } +}; diff --git a/providers/ridoMovies/posts.ts b/providers/ridoMovies/posts.ts new file mode 100644 index 0000000..7c86345 --- /dev/null +++ b/providers/ridoMovies/posts.ts @@ -0,0 +1,85 @@ +import { Post, ProviderContext } from "../types"; + +export const getPosts = async function ({ + filter, + signal, + providerContext, +}: { + filter: string; + page: number; + providerValue: string; + signal: AbortSignal; + providerContext: ProviderContext; +}): Promise { + try { + const catalog: Post[] = []; + const url = "https://cinemeta-catalogs.strem.io" + filter; + console.log("allGetPostUrl", url); + const res = await providerContext.axios.get(url, { + headers: providerContext.commonHeaders, + signal, + }); + const data = res.data; + data?.metas.map((result: any) => { + const title = result?.name; + const id = result?.imdb_id || result?.id; + const type = result?.type; + const image = result?.poster; + if (id) { + catalog.push({ + title: title, + link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`, + image: image, + }); + } + }); + console.log("catalog", catalog.length); + return catalog; + } catch (err) { + console.error("AutoEmbed error ", err); + return []; + } +}; + +export const getSearchPosts = async function ({ + searchQuery, + page, + signal, + providerContext, +}: { + searchQuery: string; + page: number; + providerValue: string; + providerContext: ProviderContext; + signal: AbortSignal; +}): Promise { + try { + const { axios, commonHeaders: headers } = providerContext; + if (page > 1) { + return []; + } + const catalog: Post[] = []; + const url2 = `https://v3-cinemeta.strem.io/catalog/movie/top/search=${encodeURI( + searchQuery + )}.json`; + const res2 = await axios.get(url2, { headers, signal }); + const data2 = res2.data; + data2?.metas.map((result: any) => { + const title = result?.name || ""; + const id = result?.imdb_id || result?.id; + const image = result?.poster; + const type = result?.type; + if (id) { + catalog.push({ + title: title, + link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`, + image: image, + }); + } + }); + return catalog; + } catch (err) { + console.error("AutoEmbed error ", err); + return []; + } +}; diff --git a/providers/ridoMovies/ridoGetMeta.ts b/providers/ridoMovies/ridoGetMeta.ts deleted file mode 100644 index 4cc34be..0000000 --- a/providers/ridoMovies/ridoGetMeta.ts +++ /dev/null @@ -1,87 +0,0 @@ -import {EpisodeLink, Info, Link, ProviderContext} from '../types'; - -export const ridoGetInfo = async function ({ - link, - providerContext, -}: { - link: string; - providerContext: ProviderContext; -}): Promise { - try { - const {getBaseUrl, axios} = providerContext; - const res = await axios.get(link); - const data = res.data; - const meta = { - title: '', - synopsis: '', - image: '', - imdbId: data?.meta?.imdb_id || '', - type: data?.meta?.type || 'movie', - }; - const baseUrl = await getBaseUrl('ridomovies'); - let slug = ''; - try { - const res2 = await axios.get( - baseUrl + '/core/api/search?q=' + meta.imdbId, - ); - const data2 = res2.data; - slug = data2?.data?.items[0]?.fullSlug; - if (!slug || meta?.type === 'series') { - return { - title: '', - synopsis: '', - image: '', - imdbId: data?.meta?.imdb_id || '', - type: meta?.type || 'movie', - linkList: [], - }; - } - } catch (err) { - return { - title: '', - synopsis: '', - image: '', - imdbId: meta?.imdbId || '', - type: meta?.type || 'movie', - linkList: [], - }; - } - const links: Link[] = []; - let directLinks: EpisodeLink[] = []; - let season = new Map(); - if (meta.type === 'series') { - data?.meta?.videos?.map((video: any) => { - if (video?.season <= 0) return; - if (!season.has(video?.season)) { - season.set(video?.season, []); - } - season.get(video?.season).push({ - title: 'Episode ' + video?.episode, - link: '', - }); - }); - for (const [seasonNum, episodes] of season.entries()) { - links.push({ - title: 'Season ' + seasonNum, - directLinks: episodes, - }); - } - } else { - directLinks.push({title: 'Movie', link: link}); - links.push({title: 'Movie', directLinks: directLinks}); - } - return { - ...meta, - linkList: links, - }; - } catch (err) { - return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', - linkList: [], - }; - } -}; diff --git a/providers/ridoMovies/ridoGetSream.ts b/providers/ridoMovies/stream.ts similarity index 63% rename from providers/ridoMovies/ridoGetSream.ts rename to providers/ridoMovies/stream.ts index bed7020..373b4a0 100644 --- a/providers/ridoMovies/ridoGetSream.ts +++ b/providers/ridoMovies/stream.ts @@ -1,6 +1,6 @@ -import {ProviderContext, Stream} from '../types'; +import { ProviderContext, Stream } from "../types"; -export const ridoGetStream = async ({ +export const getStream = async ({ link: data, providerContext, }: { @@ -8,7 +8,7 @@ export const ridoGetStream = async ({ providerContext: ProviderContext; }): Promise => { try { - const {cheerio, commonHeaders: headers, axios} = providerContext; + const { cheerio, commonHeaders: headers, axios } = providerContext; const streamData = JSON.parse(data); const streamLinks: Stream[] = []; @@ -22,15 +22,15 @@ export const ridoGetStream = async ({ // const postId = res.data.split('\\"postid\\":\\"')[1].split('\\"')[0]; // console.log('rido post id', postId); - const url = streamData?.baseUrl + '/api/' + streamData?.slug; - console.log('rido url', url); + const url = streamData?.baseUrl + "/api/" + streamData?.slug; + console.log("rido url", url); - const res = await axios.get(url, {headers}); + const res = await axios.get(url, { headers }); const iframe = res.data.data?.[0]?.url; - console.log('rido data', iframe); + console.log("rido data", iframe); const iframeUrl = iframe.split('src="')[1].split('"')[0]; - console.log('rido iframeUrl', iframeUrl); + console.log("rido iframeUrl", iframeUrl); const iframeRes = await axios.get(iframeUrl, { headers: { ...headers, @@ -40,16 +40,16 @@ export const ridoGetStream = async ({ const $ = cheerio.load(iframeRes.data); const script = $('script:contains("eval")').html(); if (!script) { - throw new Error('Unable to find script'); + throw new Error("Unable to find script"); } // console.log('rido script', script); const srcUrl = unpackJavaScript(script.trim()); - console.log('rido srcUrl', srcUrl); + console.log("rido srcUrl", srcUrl); streamLinks.push({ link: srcUrl, - server: 'rido', - type: 'm3u8', + server: "rido", + type: "m3u8", headers: { Referer: iframeUrl, }, @@ -57,19 +57,19 @@ export const ridoGetStream = async ({ return streamLinks; } catch (e) { - console.log('rido get stream err', e); + console.log("rido get stream err", e); return []; } }; function unpackJavaScript(packedCode: string): string { - const encodedString = packedCode.split('|aHR')[1].split('|')[0]; - const base64Url = 'aHR' + encodedString; + const encodedString = packedCode.split("|aHR")[1].split("|")[0]; + const base64Url = "aHR" + encodedString; function addPadding(base64: string) { - return base64 + '='.repeat((4 - (base64.length % 4)) % 4); + return base64 + "=".repeat((4 - (base64.length % 4)) % 4); } - console.log('rido base64Url', base64Url); + console.log("rido base64Url", base64Url); const unpackedCode = atob(addPadding(base64Url)); return unpackedCode; } diff --git a/providers/ringz/catalog.ts b/providers/ringz/catalog.ts new file mode 100644 index 0000000..61dd3af --- /dev/null +++ b/providers/ringz/catalog.ts @@ -0,0 +1,16 @@ +export const catalog = [ + { + title: "Movies", + filter: "MOVIES", + }, + { + title: "TV Shows", + filter: "SERIES", + }, + { + title: "Anime", + filter: "ANIME", + }, +]; + +export const genres = []; diff --git a/providers/ringz/index.ts b/providers/ringz/index.ts deleted file mode 100644 index 606cb65..0000000 --- a/providers/ringz/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {ringzGetPosts, ringzGetPostsSearch} from './ringzGetPosts'; -import {ringzGetInfo} from './ringzGetMeta'; -import {ringzGenresList, ringzCatalogList} from './ringzCatalog'; -import {ProviderType} from '../types'; -import {ringzGetStream} from './ringzGetStream'; - -export const ringz: ProviderType = { - catalog: ringzCatalogList, - genres: ringzGenresList, - GetMetaData: ringzGetInfo, - GetHomePosts: ringzGetPosts, - GetStream: ringzGetStream, - GetSearchPosts: ringzGetPostsSearch, -}; diff --git a/providers/ringz/meta.ts b/providers/ringz/meta.ts new file mode 100644 index 0000000..44f752a --- /dev/null +++ b/providers/ringz/meta.ts @@ -0,0 +1,87 @@ +import { Info, Link, ProviderContext } from "../types"; +export const getMeta = async function ({ + link: data, +}: { + link: string; + providerContext: ProviderContext; +}): Promise { + try { + const dataJson = JSON.parse(data); + const title = dataJson?.kn || dataJson?.mn; + const image = dataJson?.IH || dataJson?.IV; + const tags = dataJson?.gn + .split(",") + .slice(0, 3) + .map((tag: string) => tag.trim()); + const type = dataJson?.cg === "webSeries" ? "series" : "movie"; + const linkList: Link[] = []; + if (dataJson?.cg === "webSeries") { + ["1", "2", "3", "4"]?.forEach((item) => { + const directLinks: Link["directLinks"] = []; + if ( + typeof dataJson?.["eServer" + item] === "object" && + Object?.keys(dataJson?.["eServer" + item])?.length > 0 + ) { + Object.keys(dataJson?.["eServer" + item]).forEach((key) => { + directLinks.push({ + title: "Episode " + key, + link: JSON.stringify({ + url: dataJson?.["eServer" + item][key], + server: "Server " + item, + }), + }); + }); + linkList.push({ + title: dataJson?.pn + " (Server " + item + ")", + directLinks, + }); + } + }); + } else { + const directLinks: Link["directLinks"] = []; + ["1", "2", "3", "4"]?.forEach((item) => { + if (dataJson?.["s" + item]) { + directLinks.push({ + title: "Server " + item + " (HD)", + link: JSON.stringify({ + url: dataJson?.s1, + server: "Server " + item, + }), + }); + } + if (dataJson?.["4s" + item]) { + directLinks.push({ + title: "Server " + item + " (480p)", + link: JSON.stringify({ + url: dataJson?.["4s" + item], + server: "Server " + item, + }), + }); + } + }); + linkList.push({ + title: dataJson?.pn, + directLinks, + }); + } + return { + title, + image, + imdbId: "", + synopsis: "", + type, + linkList, + tags, + }; + } catch (err) { + return { + title: "", + image: "", + imdbId: "", + synopsis: "", + type: "movie", + linkList: [], + tags: [], + }; + } +}; diff --git a/providers/ringz/ringzGetPosts.ts b/providers/ringz/posts.ts similarity index 82% rename from providers/ringz/ringzGetPosts.ts rename to providers/ringz/posts.ts index e9f4062..b7de7d1 100644 --- a/providers/ringz/ringzGetPosts.ts +++ b/providers/ringz/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const ringzGetPosts = async function ({ +export const getPosts = async function ({ filter, signal, providerContext, @@ -11,10 +11,10 @@ export const ringzGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - return posts({filter, signal, providerContext}); + return posts({ filter, signal, providerContext }); }; -export const ringzGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, // providerContext, }: { @@ -57,28 +57,28 @@ export const ringzGetPostsSearch = async function ({ }); return catalog; } catch (err) { - console.error('ringz error ', err); + console.error("ringz error ", err); return []; } }; async function posts({ filter, // signal, - // providerContext, -}: { +}: // providerContext, +{ filter: string; signal: AbortSignal; providerContext: ProviderContext; }): Promise { try { let response; - if (filter === 'MOVIES') { + if (filter === "MOVIES") { response = getRingzMovies(); } - if (filter === 'SERIES') { + if (filter === "SERIES") { response = getRingzShows(); } - if (filter === 'ANIME') { + if (filter === "ANIME") { response = getRingzAnime(); } const data = await response; @@ -97,18 +97,18 @@ async function posts({ }); return catalog; } catch (err) { - console.error('ringz error ', err); + console.error("ringz error ", err); return []; } } export const headers = { - 'cf-access-client-id': '833049b087acf6e787cedfd85d1ccdb8.access', - 'cf-access-client-secret': - '02db296a961d7513c3102d7785df4113eff036b2d57d060ffcc2ba3ba820c6aa', + "cf-access-client-id": "833049b087acf6e787cedfd85d1ccdb8.access", + "cf-access-client-secret": + "02db296a961d7513c3102d7785df4113eff036b2d57d060ffcc2ba3ba820c6aa", }; -const BASE_URL = 'https://privatereporz.pages.dev'; +const BASE_URL = "https://privatereporz.pages.dev"; export async function getRingzMovies() { try { const response = await fetch(`${BASE_URL}/test.json`, { diff --git a/providers/ringz/ringzCatalog.ts b/providers/ringz/ringzCatalog.ts deleted file mode 100644 index cd70469..0000000 --- a/providers/ringz/ringzCatalog.ts +++ /dev/null @@ -1,16 +0,0 @@ -export const ringzCatalogList = [ - { - title: 'Movies', - filter: 'MOVIES', - }, - { - title: 'TV Shows', - filter: 'SERIES', - }, - { - title: 'Anime', - filter: 'ANIME', - }, -]; - -export const ringzGenresList = []; diff --git a/providers/ringz/ringzGetMeta.ts b/providers/ringz/ringzGetMeta.ts deleted file mode 100644 index bf7f076..0000000 --- a/providers/ringz/ringzGetMeta.ts +++ /dev/null @@ -1,87 +0,0 @@ -import {Info, Link, ProviderContext} from '../types'; -export const ringzGetInfo = async function ({ - link: data, -}: { - link: string; - providerContext: ProviderContext; -}): Promise { - try { - const dataJson = JSON.parse(data); - const title = dataJson?.kn || dataJson?.mn; - const image = dataJson?.IH || dataJson?.IV; - const tags = dataJson?.gn - .split(',') - .slice(0, 3) - .map((tag: string) => tag.trim()); - const type = dataJson?.cg === 'webSeries' ? 'series' : 'movie'; - const linkList: Link[] = []; - if (dataJson?.cg === 'webSeries') { - ['1', '2', '3', '4']?.forEach(item => { - const directLinks: Link['directLinks'] = []; - if ( - typeof dataJson?.['eServer' + item] === 'object' && - Object?.keys(dataJson?.['eServer' + item])?.length > 0 - ) { - Object.keys(dataJson?.['eServer' + item]).forEach(key => { - directLinks.push({ - title: 'Episode ' + key, - link: JSON.stringify({ - url: dataJson?.['eServer' + item][key], - server: 'Server ' + item, - }), - }); - }); - linkList.push({ - title: dataJson?.pn + ' (Server ' + item + ')', - directLinks, - }); - } - }); - } else { - const directLinks: Link['directLinks'] = []; - ['1', '2', '3', '4']?.forEach(item => { - if (dataJson?.['s' + item]) { - directLinks.push({ - title: 'Server ' + item + ' (HD)', - link: JSON.stringify({ - url: dataJson?.s1, - server: 'Server ' + item, - }), - }); - } - if (dataJson?.['4s' + item]) { - directLinks.push({ - title: 'Server ' + item + ' (480p)', - link: JSON.stringify({ - url: dataJson?.['4s' + item], - server: 'Server ' + item, - }), - }); - } - }); - linkList.push({ - title: dataJson?.pn, - directLinks, - }); - } - return { - title, - image, - imdbId: '', - synopsis: '', - type, - linkList, - tags, - }; - } catch (err) { - return { - title: '', - image: '', - imdbId: '', - synopsis: '', - type: 'movie', - linkList: [], - tags: [], - }; - } -}; diff --git a/providers/ringz/ringzGetStream.ts b/providers/ringz/stream.ts similarity index 67% rename from providers/ringz/ringzGetStream.ts rename to providers/ringz/stream.ts index 8fac548..0f1bb39 100644 --- a/providers/ringz/ringzGetStream.ts +++ b/providers/ringz/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext} from '../types'; +import { Stream, ProviderContext } from "../types"; -export const ringzGetStream = async function ({ +export const getStream = async function ({ link: data, }: { link: string; @@ -11,7 +11,7 @@ export const ringzGetStream = async function ({ streamLinks.push({ link: dataJson.url, server: dataJson.server, - type: 'mkv', + type: "mkv", }); return streamLinks; }; diff --git a/providers/showbox/catalog.ts b/providers/showbox/catalog.ts new file mode 100644 index 0000000..508d1e5 --- /dev/null +++ b/providers/showbox/catalog.ts @@ -0,0 +1,16 @@ +export const catalog = [ + { + title: "Home", + filter: "", + }, + { + title: "Movies", + filter: "/movie", + }, + { + title: "TV Shows", + filter: "/tv", + }, +]; + +export const genres = []; diff --git a/providers/showbox/sbGetEpisodeList.ts b/providers/showbox/episodes.ts similarity index 76% rename from providers/showbox/sbGetEpisodeList.ts rename to providers/showbox/episodes.ts index 136cd36..1884e5b 100644 --- a/providers/showbox/sbGetEpisodeList.ts +++ b/providers/showbox/episodes.ts @@ -1,15 +1,15 @@ -import {EpisodeLink, ProviderContext} from '../types'; +import { EpisodeLink, ProviderContext } from "../types"; -export const sbGetEpisodeLinks = async function ({ +export const getEpisodes = async function ({ url: id, providerContext, }: { url: string; providerContext: ProviderContext; }): Promise { - const {axios} = providerContext; + const { axios } = providerContext; try { - const [fileId, febboxId] = id.split('&'); + const [fileId, febboxId] = id.split("&"); const febLink = febboxId ? `https://www.febbox.com/file/file_share_list?share_key=${fileId}&pwd=&parent_id=${febboxId}&is_html=0` : `https://www.febbox.com/file/file_share_list?share_key=${fileId}&pwd=&is_html=0`; @@ -37,8 +37,8 @@ function formatEpisodeName(title: string): string { const regex = /[sS](\d+)\s*[eE](\d+)/; const match = title.match(regex); if (match) { - const season = match[1].padStart(2, '0'); - const episode = match[2].padStart(2, '0'); + const season = match[1].padStart(2, "0"); + const episode = match[2].padStart(2, "0"); return `Season${season} Episode${episode}`; } else { return title; diff --git a/providers/showbox/index.ts b/providers/showbox/index.ts deleted file mode 100644 index 54a04bd..0000000 --- a/providers/showbox/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {ProviderType} from '../types'; -import {catalogList, sbGenresList} from './sbCatalog'; -import {sbGetEpisodeLinks} from './sbGetEpisodeList'; -import {sbGetInfo} from './sbGetMeta'; -import {sbGetPosts, sbGetPostsSearch} from './sbGetPosts'; -import {sbGetStream} from './sbGetStream'; - -export const showBox: ProviderType = { - catalog: catalogList, - genres: sbGenresList, - GetMetaData: sbGetInfo, - GetHomePosts: sbGetPosts, - GetStream: sbGetStream, - GetSearchPosts: sbGetPostsSearch, - GetEpisodeLinks: sbGetEpisodeLinks, -}; diff --git a/providers/showbox/sbGetMeta.ts b/providers/showbox/meata.ts similarity index 57% rename from providers/showbox/sbGetMeta.ts rename to providers/showbox/meata.ts index de16804..be08111 100644 --- a/providers/showbox/sbGetMeta.ts +++ b/providers/showbox/meata.ts @@ -1,6 +1,6 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; -export const sbGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -8,32 +8,32 @@ export const sbGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const url = link; const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); - const type = url.includes('tv') ? 'series' : 'movie'; - const imdbId = ''; - const title = $('.heading-name').text(); + const type = url.includes("tv") ? "series" : "movie"; + const imdbId = ""; + const title = $(".heading-name").text(); const rating = - $('.btn-imdb') + $(".btn-imdb") .text() - ?.match(/\d+(\.\d+)?/g)?.[0] || ''; + ?.match(/\d+(\.\d+)?/g)?.[0] || ""; const image = - $('.cover_follow').attr('style')?.split('url(')[1]?.split(')')[0] || ''; - const synopsis = $('.description') + $(".cover_follow").attr("style")?.split("url(")[1]?.split(")")[0] || ""; + const synopsis = $(".description") .text() - ?.replaceAll(/[\n\t]/g, '') + ?.replace(/[\n\t]/g, "") ?.trim(); - const febID = $('.heading-name').find('a').attr('href')?.split('/')?.pop(); - const baseUrl = url.split('/').slice(0, 3).join('/'); + const febID = $(".heading-name").find("a").attr("href")?.split("/")?.pop(); + const baseUrl = url.split("/").slice(0, 3).join("/"); const indexUrl = `${baseUrl}/index/share_link?id=${febID}&type=${ - type === 'movie' ? '1' : '2' + type === "movie" ? "1" : "2" }`; const indexRes = await axios.get(indexUrl); const indexData = indexRes.data; - const febKey = indexData.data.link.split('/').pop(); + const febKey = indexData.data.link.split("/").pop(); const febLink = `https://www.febbox.com/file/file_share_list?share_key=${febKey}&is_html=0`; const febRes = await axios.get(febLink); const febData = febRes.data; @@ -60,12 +60,12 @@ export const sbGetInfo = async function ({ }; } catch (err) { return { - title: '', - rating: '', - synopsis: '', - image: '', - imdbId: '', - type: '', + title: "", + rating: "", + synopsis: "", + image: "", + imdbId: "", + type: "", linkList: [], }; } diff --git a/providers/showbox/sbGetPosts.ts b/providers/showbox/posts.ts similarity index 54% rename from providers/showbox/sbGetPosts.ts rename to providers/showbox/posts.ts index 7380b92..30a26c4 100644 --- a/providers/showbox/sbGetPosts.ts +++ b/providers/showbox/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const sbGetPosts = async function ({ +export const getPosts = async function ({ filter, page, // providerValue, @@ -13,13 +13,13 @@ export const sbGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('showbox'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("showbox"); const url = `${baseUrl + filter}?page=${page}/`; - return posts({url, signal, baseUrl, axios, cheerio}); + return posts({ url, signal, baseUrl, axios, cheerio }); }; -export const sbGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, // providerValue, @@ -32,10 +32,10 @@ export const sbGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('showbox'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("showbox"); const url = `${baseUrl}/search?keyword=${searchQuery}&page=${page}`; - return posts({url, signal, baseUrl, axios, cheerio}); + return posts({ url, signal, baseUrl, axios, cheerio }); }; async function posts({ @@ -48,18 +48,18 @@ async function posts({ url: string; signal: AbortSignal; baseUrl: string; - axios: ProviderContext['axios']; - cheerio: ProviderContext['cheerio']; + axios: ProviderContext["axios"]; + cheerio: ProviderContext["cheerio"]; }): Promise { try { - const res = await axios.get(url, {signal}); + const res = await axios.get(url, { signal }); const data = res.data; const $ = cheerio.load(data); const catalog: Post[] = []; - $('.movie-item').map((i, element) => { - const title = $(element).find('.movie-title').text(); - const link = $(element).find('a').attr('href'); - const image = $(element).find('img').attr('src'); + $(".movie-item").map((i, element) => { + const title = $(element).find(".movie-title").text(); + const link = $(element).find("a").attr("href"); + const image = $(element).find("img").attr("src"); if (title && link && image) { catalog.push({ title: title, diff --git a/providers/showbox/sbCatalog.ts b/providers/showbox/sbCatalog.ts deleted file mode 100644 index 05e62d6..0000000 --- a/providers/showbox/sbCatalog.ts +++ /dev/null @@ -1,16 +0,0 @@ -export const catalogList = [ - { - title: 'Home', - filter: '', - }, - { - title: 'Movies', - filter: '/movie', - }, - { - title: 'TV Shows', - filter: '/tv', - }, -]; - -export const sbGenresList = []; diff --git a/providers/showbox/sbGetStream.ts b/providers/showbox/sbGetStream.ts deleted file mode 100644 index e4d74fa..0000000 --- a/providers/showbox/sbGetStream.ts +++ /dev/null @@ -1,43 +0,0 @@ -import {Stream, ProviderContext} from '../types'; -import * as cheerio from 'cheerio'; - -export const sbGetStream = async function ({ - link: id, - // type, - signal, - providerContext, -}: { - link: string; - type: string; - signal: AbortSignal; - providerContext: ProviderContext; -}): Promise { - try { - const {axios} = providerContext; - const stream: Stream[] = []; - const [, epId] = id.split('&'); - const url = `https://febbox.vercel.app/api/video-quality?fid=${epId}`; - const res = await axios.get(url, {signal}); - const data = res.data; - const $ = cheerio.load(data.html); - $('.file_quality').each((i, el) => { - const server = - $(el).find('p.name').text() + - ' - ' + - $(el).find('p.size').text() + - ' - ' + - $(el).find('p.speed').text(); - const link = $(el).attr('data-url'); - if (link) { - stream.push({ - server: server, - type: 'mkv', - link: link, - }); - } - }); - return stream; - } catch (err) { - return []; - } -}; diff --git a/providers/showbox/stream.ts b/providers/showbox/stream.ts new file mode 100644 index 0000000..138ea89 --- /dev/null +++ b/providers/showbox/stream.ts @@ -0,0 +1,43 @@ +import { Stream, ProviderContext } from "../types"; +import * as cheerio from "cheerio"; + +export const getStream = async function ({ + link: id, + // type, + signal, + providerContext, +}: { + link: string; + type: string; + signal: AbortSignal; + providerContext: ProviderContext; +}): Promise { + try { + const { axios } = providerContext; + const stream: Stream[] = []; + const [, epId] = id.split("&"); + const url = `https://febbox.vercel.app/api/video-quality?fid=${epId}`; + const res = await axios.get(url, { signal }); + const data = res.data; + const $ = cheerio.load(data.html); + $(".file_quality").each((i, el) => { + const server = + $(el).find("p.name").text() + + " - " + + $(el).find("p.size").text() + + " - " + + $(el).find("p.speed").text(); + const link = $(el).attr("data-url"); + if (link) { + stream.push({ + server: server, + type: "mkv", + link: link, + }); + } + }); + return stream; + } catch (err) { + return []; + } +}; diff --git a/providers/tokyoInsider/catalog.ts b/providers/tokyoInsider/catalog.ts index f3e609e..3e98543 100644 --- a/providers/tokyoInsider/catalog.ts +++ b/providers/tokyoInsider/catalog.ts @@ -1,12 +1,12 @@ -export const tokyoCatalogList = [ +export const catalog = [ { - title: 'Top Anime', - filter: 'anime/search?r=5', + title: "Top Anime", + filter: "anime/search?r=5", }, { - title: 'Popular Anime', - filter: 'anime/', + title: "Popular Anime", + filter: "anime/", }, ]; -export const tokyoGenresList = []; +export const genres = []; diff --git a/providers/tokyoInsider/index.ts b/providers/tokyoInsider/index.ts deleted file mode 100644 index 5c7b166..0000000 --- a/providers/tokyoInsider/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {tokyoCatalogList, tokyoGenresList} from './catalog'; -import {tokyoGetInfo} from './tokyoGetInfo'; -import {tokyoGetPosts, tokyoGetPostsSearch} from './tokyoGetPosts'; -import {tokyoGetStream} from './tokyoGetStream'; -import {ProviderType} from '../types'; - -export const tokyoInsider: ProviderType = { - catalog: tokyoCatalogList, - genres: tokyoGenresList, - GetMetaData: tokyoGetInfo, - GetHomePosts: tokyoGetPosts, - GetStream: tokyoGetStream, - GetSearchPosts: tokyoGetPostsSearch, - blurImage: true, -}; diff --git a/providers/tokyoInsider/meta.ts b/providers/tokyoInsider/meta.ts new file mode 100644 index 0000000..e4a8414 --- /dev/null +++ b/providers/tokyoInsider/meta.ts @@ -0,0 +1,65 @@ +import { Info, ProviderContext } from "../types"; + +export const getMeta = async function ({ + link, + providerContext, +}: { + link: string; + providerContext: ProviderContext; +}): Promise { + try { + const { cheerio } = providerContext; + const url = link; + const res = await fetch(url); + const data = await res.text(); + const $ = cheerio.load(data); + const meta = { + title: $('.c_h2:contains("Title(s):")') + .text() + .replace("Title(s):", "") + .trim() + .split("\n")[0], + synopsis: $('.c_h2b:contains("Summary:"),.c_h2:contains("Summary:")') + .text() + .replace("Summary:", "") + .trim(), + image: $(".a_img").attr("src") || "", + imdbId: "", + type: "series", + }; + const episodesList: { title: string; link: string }[] = []; + $(".episode").map((i, element) => { + const link = + "https://www.tokyoinsider.com" + $(element).find("a").attr("href") || + $(".download-link").attr("href"); + let title = + $(element).find("a").find("em").text() + + " " + + $(element).find("a").find("strong").text(); + if (!title.trim()) { + title = $(".download-link").text(); + } + if (link && title.trim()) { + episodesList.push({ title, link }); + } + }); + return { + ...meta, + linkList: [ + { + title: meta.title, + directLinks: episodesList, + }, + ], + }; + } catch (err) { + return { + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "series", + linkList: [], + }; + } +}; diff --git a/providers/tokyoInsider/tokyoGetPosts.ts b/providers/tokyoInsider/posts.ts similarity index 57% rename from providers/tokyoInsider/tokyoGetPosts.ts rename to providers/tokyoInsider/posts.ts index ea2dc29..de04094 100644 --- a/providers/tokyoInsider/tokyoGetPosts.ts +++ b/providers/tokyoInsider/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const tokyoGetPosts = async function ({ +export const getPosts = async function ({ filter, page, // providerValue, @@ -13,14 +13,14 @@ export const tokyoGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseURL = await getBaseUrl('tokyoinsider'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseURL = await getBaseUrl("tokyoinsider"); const start = page < 2 ? 0 : (page - 1) * 20; const url = `${baseURL}/${filter}&start=${start}`; - return posts({baseURL, url, signal, axios, cheerio}); + return posts({ baseURL, url, signal, axios, cheerio }); }; -export const tokyoGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, // providerValue, @@ -33,11 +33,11 @@ export const tokyoGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseURL = await getBaseUrl('tokyoinsider'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseURL = await getBaseUrl("tokyoinsider"); const start = page < 2 ? 0 : (page - 1) * 20; const url = `${baseURL}/anime/search?k=${searchQuery}&start=${start}`; - return posts({baseURL, url, signal, axios, cheerio}); + return posts({ baseURL, url, signal, axios, cheerio }); }; async function posts({ @@ -50,21 +50,21 @@ async function posts({ baseURL: string; url: string; signal: AbortSignal; - axios: ProviderContext['axios']; - cheerio: ProviderContext['cheerio']; + axios: ProviderContext["axios"]; + cheerio: ProviderContext["cheerio"]; }): Promise { try { - const res = await axios.get(url, {signal}); + const res = await axios.get(url, { signal }); const data = res.data; const $ = cheerio.load(data); const catalog: Post[] = []; $('td.c_h2[width="40"]').map((i, element) => { const image = $(element) - .find('.a_img') - .attr('src') - ?.replace('small', 'default'); - const title = $(element).find('a').attr('title'); - const link = baseURL + $(element).find('a').attr('href'); + .find(".a_img") + .attr("src") + ?.replace("small", "default"); + const title = $(element).find("a").attr("title"); + const link = baseURL + $(element).find("a").attr("href"); if (title && link && image) { catalog.push({ title: title, diff --git a/providers/tokyoInsider/stream.ts b/providers/tokyoInsider/stream.ts new file mode 100644 index 0000000..f298e7f --- /dev/null +++ b/providers/tokyoInsider/stream.ts @@ -0,0 +1,33 @@ +import { Stream, ProviderContext } from "../types"; + +export const getStream = async function ({ + link, + providerContext, +}: { + link: string; + providerContext: ProviderContext; +}): Promise { + try { + const { cheerio } = providerContext; + const url = link; + const res = await fetch(url); + const data = await res.text(); + const $ = cheerio.load(data); + const streamLinks: Stream[] = []; + $(".c_h1,.c_h2").map((i, element) => { + $(element).find("span").remove(); + const title = $(element).find("a").text() || ""; + const link = $(element).find("a").attr("href") || ""; + if (title && link.includes("media")) { + streamLinks.push({ + server: title, + link, + type: link.split(".").pop() || "mkv", + }); + } + }); + return streamLinks; + } catch (err) { + return []; + } +}; diff --git a/providers/tokyoInsider/tokyoGetInfo.ts b/providers/tokyoInsider/tokyoGetInfo.ts deleted file mode 100644 index c5f5915..0000000 --- a/providers/tokyoInsider/tokyoGetInfo.ts +++ /dev/null @@ -1,65 +0,0 @@ -import {Info, ProviderContext} from '../types'; - -export const tokyoGetInfo = async function ({ - link, - providerContext, -}: { - link: string; - providerContext: ProviderContext; -}): Promise { - try { - const {cheerio} = providerContext; - const url = link; - const res = await fetch(url); - const data = await res.text(); - const $ = cheerio.load(data); - const meta = { - title: $('.c_h2:contains("Title(s):")') - .text() - .replace('Title(s):', '') - .trim() - .split('\n')[0], - synopsis: $('.c_h2b:contains("Summary:"),.c_h2:contains("Summary:")') - .text() - .replace('Summary:', '') - .trim(), - image: $('.a_img').attr('src') || '', - imdbId: '', - type: 'series', - }; - const episodesList: {title: string; link: string}[] = []; - $('.episode').map((i, element) => { - const link = - 'https://www.tokyoinsider.com' + $(element).find('a').attr('href') || - $('.download-link').attr('href'); - let title = - $(element).find('a').find('em').text() + - ' ' + - $(element).find('a').find('strong').text(); - if (!title.trim()) { - title = $('.download-link').text(); - } - if (link && title.trim()) { - episodesList.push({title, link}); - } - }); - return { - ...meta, - linkList: [ - { - title: meta.title, - directLinks: episodesList, - }, - ], - }; - } catch (err) { - return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'series', - linkList: [], - }; - } -}; diff --git a/providers/tokyoInsider/tokyoGetStream.ts b/providers/tokyoInsider/tokyoGetStream.ts deleted file mode 100644 index e5f73dd..0000000 --- a/providers/tokyoInsider/tokyoGetStream.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {Stream, ProviderContext} from '../types'; - -export const tokyoGetStream = async function ({ - link, - providerContext, -}: { - link: string; - providerContext: ProviderContext; -}): Promise { - try { - const {cheerio} = providerContext; - const url = link; - const res = await fetch(url); - const data = await res.text(); - const $ = cheerio.load(data); - const streamLinks: Stream[] = []; - $('.c_h1,.c_h2').map((i, element) => { - $(element).find('span').remove(); - const title = $(element).find('a').text() || ''; - const link = $(element).find('a').attr('href') || ''; - if (title && link.includes('media')) { - streamLinks.push({ - server: title, - link, - type: link.split('.').pop() || 'mkv', - }); - } - }); - return streamLinks; - } catch (err) { - return []; - } -}; diff --git a/providers/topmovies/catalog.ts b/providers/topmovies/catalog.ts new file mode 100644 index 0000000..bc6bfbe --- /dev/null +++ b/providers/topmovies/catalog.ts @@ -0,0 +1,85 @@ +export const catalog = [ + { + title: "Latest", + filter: "", + }, + { + title: "Netflix", + filter: "/web-series/tv-shows-by-network/netflix", + }, + { + title: "Hotstar", + filter: "/web-series/tv-shows-by-network/hotstar", + }, + { + title: "Amazon Prime", + filter: "/web-series/tv-shows-by-network/amazon-prime-video", + }, +]; + +export const genres = [ + { + title: "Apple TV+", + filter: "/ott/apple-tv", + }, + { + title: "Disney+", + filter: "/ott/disney-plus", + }, + { + title: "Hulu", + filter: "/ott/hulu", + }, + { + title: "Crunchyroll", + filter: "/ott/crunchyroll", + }, + { + title: "Action", + filter: "/movies-by-genre/action/", + }, + { + title: "Adventure", + filter: "/movies-by-genre/adventure/", + }, + { + title: "Animation", + filter: "/movies-by-genre/animated/", + }, + { + title: "Comedy", + filter: "/movies-by-genre/comedy/", + }, + { + title: "Crime", + filter: "/movies-by-genre/crime/", + }, + { + title: "Documentary", + filter: "/movies-by-genre/documentary/", + }, + { + title: "Fantasy", + filter: "/movies-by-genre/fantasy/", + }, + { + title: "Horror", + filter: "/movies-by-genre/horror/", + }, + { + title: "Mystery", + filter: "/movies-by-genre/mystery/", + }, + { + title: "Romance", + filter: "/movies-by-genre/romance/", + }, + { + title: "Thriller", + filter: "/movies-by-genre/thriller/", + }, + { + title: "Sci-Fi", + filter: "/movies-by-genre/sci-fi/", + }, +]; diff --git a/providers/topmovies/episodes.ts b/providers/topmovies/episodes.ts new file mode 100644 index 0000000..3684a38 --- /dev/null +++ b/providers/topmovies/episodes.ts @@ -0,0 +1,52 @@ +import { EpisodeLink, ProviderContext } from "../types"; + +export const getEpisodes = async function ({ + url, + providerContext, +}: { + url: string; + providerContext: ProviderContext; +}): Promise { + const { axios, cheerio } = providerContext; + try { + if (url.includes("url=")) { + url = atob(url.split("url=")[1]); + } + const res = await axios.get(url); + const html = res.data; + let $ = cheerio.load(html); + if (url.includes("url=")) { + const newUrl = $("meta[http-equiv='refresh']") + .attr("content") + ?.split("url=")[1]; + const res2 = await axios.get(newUrl || url); + const html2 = res2.data; + $ = cheerio.load(html2); + } + const episodeLinks: EpisodeLink[] = []; + $("h3,h4").map((i, element) => { + const seriesTitle = $(element).text(); + const episodesLink = $(element).find("a").attr("href"); + if (episodesLink && episodesLink !== "#") { + episodeLinks.push({ + title: seriesTitle.trim() || "No title found", + link: episodesLink || "", + }); + } + }); + $("a.maxbutton").map((i, element) => { + const seriesTitle = $(element).children("span").text(); + const episodesLink = $(element).attr("href"); + if (episodesLink && episodesLink !== "#") { + episodeLinks.push({ + title: seriesTitle.trim() || "No title found", + link: episodesLink || "", + }); + } + }); + return episodeLinks; + } catch (err) { + console.error(err); + return []; + } +}; diff --git a/providers/topmovies/index.ts b/providers/topmovies/index.ts deleted file mode 100644 index 396cb6c..0000000 --- a/providers/topmovies/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {modGetInfo} from '../mod/modGetInfo'; -import {modGetEpisodeLinks} from '../mod/modGetEpisodesList'; -import {modGetStream} from '../mod/modGetStream'; -import {ProviderType} from '../types'; -import {topGetPosts, topGetPostsSearch} from './topGetPosts'; -import {topCatalogList, topGenresList} from './topCatalog'; - -export const topMovies: ProviderType = { - catalog: topCatalogList, - genres: topGenresList, - GetMetaData: modGetInfo, - GetHomePosts: topGetPosts, - GetStream: modGetStream, - GetEpisodeLinks: modGetEpisodeLinks, - nonStreamableServer: [], - GetSearchPosts: topGetPostsSearch, -}; diff --git a/providers/topmovies/meta.ts b/providers/topmovies/meta.ts new file mode 100644 index 0000000..bd7b972 --- /dev/null +++ b/providers/topmovies/meta.ts @@ -0,0 +1,71 @@ +import { Info, Link, ProviderContext } from "../types"; + +export const getMeta = async function ({ + link, + providerContext, +}: { + link: string; + providerContext: ProviderContext; +}): Promise { + try { + const { axios, cheerio } = providerContext; + const url = link; + const res = await axios.get(url); + const data = res.data; + const $ = cheerio.load(data); + const meta = { + title: $(".imdbwp__title").text(), + synopsis: $(".imdbwp__teaser").text(), + image: $(".imdbwp__thumb").find("img").attr("src") || "", + imdbId: $(".imdbwp__link").attr("href")?.split("/")[4] || "", + type: $(".thecontent").text().toLocaleLowerCase().includes("season") + ? "series" + : "movie", + }; + const links: Link[] = []; + + $("h3,h4").map((i, element) => { + const seriesTitle = $(element).text(); + // const batchZipLink = $(element) + // .next("p") + // .find(".maxbutton-batch-zip,.maxbutton-zip-download") + // .attr("href"); + const episodesLink = $(element) + .next("p") + .find( + ".maxbutton-episode-links,.maxbutton-g-drive,.maxbutton-af-download" + ) + .attr("href"); + const movieLink = $(element) + .next("p") + .find(".maxbutton-download-links") + .attr("href"); + + if ( + movieLink || + (episodesLink && episodesLink !== "javascript:void(0);") + ) { + links.push({ + title: seriesTitle.replace("Download ", "").trim() || "Download", + episodesLink: episodesLink || "", + directLinks: movieLink + ? [{ link: movieLink, title: "Movie", type: "movie" }] + : [], + quality: seriesTitle?.match(/\d+p\b/)?.[0] || "", + }); + } + }); + // console.log('mod meta', links); + return { ...meta, linkList: links }; + } catch (err) { + console.error(err); + return { + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", + linkList: [], + }; + } +}; diff --git a/providers/topmovies/posts.ts b/providers/topmovies/posts.ts new file mode 100644 index 0000000..670babe --- /dev/null +++ b/providers/topmovies/posts.ts @@ -0,0 +1,94 @@ +import { Post, ProviderContext } from "../types"; + +const headers = { + Accept: + "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": + '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + Cookie: "popads_user_id=6ba8fe60a481387a3249f05aa058822d", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", +}; + +export const getPosts = async function ({ + filter, + page, + signal, + providerContext, +}: { + filter: string; + page: number; + providerValue: string; + signal: AbortSignal; + providerContext: ProviderContext; +}): Promise { + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("Topmovies"); + const url = `${baseUrl + filter}/page/${page}/`; + + return posts(url, signal, providerContext); +}; + +export const getSearchPosts = async function ({ + searchQuery, + page, + signal, + providerContext, +}: { + searchQuery: string; + page: number; + providerValue: string; + signal: AbortSignal; + providerContext: ProviderContext; +}): Promise { + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("Topmovies"); + const url = `${baseUrl}/search/${searchQuery}/page/${page}/`; + return posts(url, signal, providerContext); +}; + +async function posts( + url: string, + signal: AbortSignal, + providerContext: ProviderContext +): Promise { + try { + const { axios, cheerio } = providerContext; + const res = await axios.get(url, { headers, signal }); + const data = res.data; + const $ = cheerio.load(data); + const catalog: Post[] = []; + $(".post-cards") + .find("article") + .map((i, element) => { + const title = $(element).find("a").attr("title"); + const link = $(element).find("a").attr("href"); + const image = + $(element).find("img").attr("data-src") || + $(element).find("img").attr("src") || + ""; + if (title && link) { + catalog.push({ + title: title.replace("Download", "").trim(), + link: link, + image: image, + }); + } + }); + // console.log(catalog); + return catalog; + } catch (err) { + console.error("mod error ", err); + return []; + } +} diff --git a/providers/topmovies/stream.ts b/providers/topmovies/stream.ts new file mode 100644 index 0000000..adf9f82 --- /dev/null +++ b/providers/topmovies/stream.ts @@ -0,0 +1,288 @@ +import { Stream, ProviderContext, EpisodeLink } from "../types"; + +const headers = { + Accept: + "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": + '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + Cookie: "popads_user_id=6ba8fe60a481387a3249f05aa058822d", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", +}; + +export const getStream = async function ({ + link: url, + type, + providerContext, +}: { + link: string; + type: string; + providerContext: ProviderContext; +}): Promise { + const { axios, cheerio } = providerContext; + try { + const modGetEpisodeLinks = async function ({ + url, + providerContext, + }: { + url: string; + providerContext: ProviderContext; + }): Promise { + const { axios, cheerio } = providerContext; + try { + if (url.includes("url=")) { + url = atob(url.split("url=")[1]); + } + const res = await axios.get(url); + const html = res.data; + let $ = cheerio.load(html); + if (url.includes("url=")) { + const newUrl = $("meta[http-equiv='refresh']") + .attr("content") + ?.split("url=")[1]; + const res2 = await axios.get(newUrl || url); + const html2 = res2.data; + $ = cheerio.load(html2); + } + const episodeLinks: EpisodeLink[] = []; + $("h3,h4").map((i, element) => { + const seriesTitle = $(element).text(); + const episodesLink = $(element).find("a").attr("href"); + if (episodesLink && episodesLink !== "#") { + episodeLinks.push({ + title: seriesTitle.trim() || "No title found", + link: episodesLink || "", + }); + } + }); + $("a.maxbutton").map((i, element) => { + const seriesTitle = $(element).children("span").text(); + const episodesLink = $(element).attr("href"); + if (episodesLink && episodesLink !== "#") { + episodeLinks.push({ + title: seriesTitle.trim() || "No title found", + link: episodesLink || "", + }); + } + }); + return episodeLinks; + } catch (err) { + console.error(err); + return []; + } + }; + console.log("modGetStream", type, url); + if (type === "movie") { + const servers = await modGetEpisodeLinks({ url, providerContext }); + url = servers[0].link || url; + } + + let downloadLink = await modExtractor(url, providerContext); + + // console.log(downloadLink.data); + + const ddl = downloadLink?.data?.match(/content="0;url=(.*?)"/)?.[1] || url; + // console.log('ddl', url); + + // console.log(ddl); + // console.log(ddl); + const servers: Stream[] = []; + const driveLink = await isDriveLink(ddl); + const driveRes = await axios.get(driveLink, { headers }); + const driveHtml = driveRes.data; + const $drive = cheerio.load(driveHtml); + + try { + const resumeBot = $drive(".btn.btn-light").attr("href") || ""; + const resumeBotRes = await axios.get(resumeBot, { headers }); + const resumeBotToken = resumeBotRes.data.match( + /formData\.append\('token', '([a-f0-9]+)'\)/ + )[1]; + const resumeBotBody = new FormData(); + resumeBotBody.append("token", resumeBotToken); + const resumeBotPath = resumeBotRes.data.match( + /fetch\('\/download\?id=([a-zA-Z0-9\/+]+)'/ + )[1]; + const resumeBotBaseUrl = resumeBot.split("/download")[0]; + // console.log( + // 'resumeBotPath', + // resumeBotBaseUrl + '/download?id=' + resumeBotPath, + // ); + // console.log('resumeBotBody', resumeBotToken); + + const resumeBotDownload = await fetch( + resumeBotBaseUrl + "/download?id=" + resumeBotPath, + { + method: "POST", + body: resumeBotBody, + headers: { + Referer: resumeBot, + Cookie: "PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308", + }, + } + ); + const resumeBotDownloadData = await resumeBotDownload.json(); + console.log("resumeBotDownloadData", resumeBotDownloadData.url); + servers.push({ + server: "ResumeBot", + link: resumeBotDownloadData.url, + type: "mkv", + }); + } catch (err) { + console.log("ResumeBot link not found", err); + } + // CF workers type 1 + try { + const cfWorkersLink = driveLink.replace("/file", "/wfile") + "?type=1"; + const cfWorkersRes = await axios.get(cfWorkersLink, { headers }); + const cfWorkersHtml = cfWorkersRes.data; + const $cfWorkers = cheerio.load(cfWorkersHtml); + const cfWorkersStream = $cfWorkers(".btn-success"); + cfWorkersStream.each((i, el) => { + const link = (el as any).attribs?.href; + if (link) { + servers.push({ + server: "Cf Worker 1." + i, + link: link, + type: "mkv", + }); + } + }); + } catch (err) { + console.log("CF workers link not found", err); + } + + // CF workers type 2 + try { + const cfWorkersLink = driveLink.replace("/file", "/wfile") + "?type=2"; + const cfWorkersRes = await axios.get(cfWorkersLink, { headers }); + const cfWorkersHtml = cfWorkersRes.data; + const $cfWorkers = cheerio.load(cfWorkersHtml); + const cfWorkersStream = $cfWorkers(".btn-success"); + cfWorkersStream.each((i, el) => { + const link = (el as any).attribs?.href; + if (link) { + servers.push({ + server: "Cf Worker 2." + i, + link: link, + type: "mkv", + }); + } + }); + } catch (err) { + console.log("CF workers link not found", err); + } + + // gdrive + + //instant link + try { + const seed = $drive(".btn-danger").attr("href") || ""; + const instantToken = seed.split("=")[1]; + // console.log('InstantToken', instantToken); + const InstantFromData = new FormData(); + InstantFromData.append("keys", instantToken); + const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api"; + // console.log('videoSeedUrl', videoSeedUrl); + const instantLinkRes = await fetch(videoSeedUrl, { + method: "POST", + body: InstantFromData, + headers: { + "x-token": videoSeedUrl, + }, + }); + const instantLinkData = await instantLinkRes.json(); + // console.log('instantLinkData', instantLinkData); + if (instantLinkData.error === false) { + const instantLink = instantLinkData.url; + servers.push({ + server: "Gdrive-Instant", + link: instantLink, + type: "mkv", + }); + } else { + console.log("Instant link not found", instantLinkData); + } + } catch (err) { + console.log("Instant link not found", err); + } + return servers; + } catch (err) { + console.log("getStream error", err); + return []; + } +}; + +const isDriveLink = async (ddl: string) => { + if (ddl.includes("drive")) { + const driveLeach = await fetch(ddl); + const driveLeachData = await driveLeach.text(); + const pathMatch = driveLeachData.match( + /window\.location\.replace\("([^"]+)"\)/ + ); + const path = pathMatch?.[1]; + const mainUrl = ddl.split("/")[2]; + console.log(`driveUrl = https://${mainUrl}${path}`); + return `https://${mainUrl}${path}`; + } else { + return ddl; + } +}; + +async function modExtractor(url: string, providerContext: ProviderContext) { + const { axios, cheerio } = providerContext; + try { + const wpHttp = url.split("sid=")[1]; + var bodyFormData0 = new FormData(); + bodyFormData0.append("_wp_http", wpHttp); + const res = await fetch(url.split("?")[0], { + method: "POST", + body: bodyFormData0, + }); + const data = await res.text(); + // console.log('', data); + const html = data; + const $ = cheerio.load(html); + + // find input with name="_wp_http2" + const wpHttp2 = $("input").attr("name", "_wp_http2").val(); + + // console.log('wpHttp2', wpHttp2); + + // form data + var bodyFormData = new FormData(); + bodyFormData.append("_wp_http2", wpHttp2); + const formUrl1 = $("form").attr("action"); + const formUrl = formUrl1 || url.split("?")[0]; + + const res2 = await fetch(formUrl, { + method: "POST", + body: bodyFormData, + }); + const html2: any = await res2.text(); + const link = html2.match(/setAttribute\("href",\s*"(.*?)"/)[1]; + console.log(link); + const cookie = link.split("=")[1]; + console.log("cookie", cookie); + + const downloadLink = await axios.get(link, { + headers: { + Referer: formUrl, + Cookie: `${cookie}=${wpHttp2}`, + }, + }); + return downloadLink; + } catch (err) { + console.log("modGetStream error", err); + } +} diff --git a/providers/topmovies/topCatalog.ts b/providers/topmovies/topCatalog.ts deleted file mode 100644 index f9cc773..0000000 --- a/providers/topmovies/topCatalog.ts +++ /dev/null @@ -1,85 +0,0 @@ -export const topCatalogList = [ - { - title: 'Latest', - filter: '', - }, - { - title: 'Netflix', - filter: '/web-series/tv-shows-by-network/netflix', - }, - { - title: 'Hotstar', - filter: '/web-series/tv-shows-by-network/hotstar', - }, - { - title: 'Amazon Prime', - filter: '/web-series/tv-shows-by-network/amazon-prime-video', - }, -]; - -export const topGenresList = [ - { - title: 'Apple TV+', - filter: '/ott/apple-tv', - }, - { - title: 'Disney+', - filter: '/ott/disney-plus', - }, - { - title: 'Hulu', - filter: '/ott/hulu', - }, - { - title: 'Crunchyroll', - filter: '/ott/crunchyroll', - }, - { - title: 'Action', - filter: '/movies-by-genre/action/', - }, - { - title: 'Adventure', - filter: '/movies-by-genre/adventure/', - }, - { - title: 'Animation', - filter: '/movies-by-genre/animated/', - }, - { - title: 'Comedy', - filter: '/movies-by-genre/comedy/', - }, - { - title: 'Crime', - filter: '/movies-by-genre/crime/', - }, - { - title: 'Documentary', - filter: '/movies-by-genre/documentary/', - }, - { - title: 'Fantasy', - filter: '/movies-by-genre/fantasy/', - }, - { - title: 'Horror', - filter: '/movies-by-genre/horror/', - }, - { - title: 'Mystery', - filter: '/movies-by-genre/mystery/', - }, - { - title: 'Romance', - filter: '/movies-by-genre/romance/', - }, - { - title: 'Thriller', - filter: '/movies-by-genre/thriller/', - }, - { - title: 'Sci-Fi', - filter: '/movies-by-genre/sci-fi/', - }, -]; diff --git a/providers/topmovies/topGetPosts.ts b/providers/topmovies/topGetPosts.ts deleted file mode 100644 index 8f53586..0000000 --- a/providers/topmovies/topGetPosts.ts +++ /dev/null @@ -1,94 +0,0 @@ -import {Post, ProviderContext} from '../types'; - -const headers = { - Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Cache-Control': 'no-store', - 'Accept-Language': 'en-US,en;q=0.9', - DNT: '1', - 'sec-ch-ua': - '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - Cookie: 'popads_user_id=6ba8fe60a481387a3249f05aa058822d', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0', -}; - -export const topGetPosts = async function ({ - filter, - page, - signal, - providerContext, -}: { - filter: string; - page: number; - providerValue: string; - signal: AbortSignal; - providerContext: ProviderContext; -}): Promise { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('Topmovies'); - const url = `${baseUrl + filter}/page/${page}/`; - - return posts(url, signal, providerContext); -}; - -export const topGetPostsSearch = async function ({ - searchQuery, - page, - signal, - providerContext, -}: { - searchQuery: string; - page: number; - providerValue: string; - signal: AbortSignal; - providerContext: ProviderContext; -}): Promise { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('Topmovies'); - const url = `${baseUrl}/search/${searchQuery}/page/${page}/`; - return posts(url, signal, providerContext); -}; - -async function posts( - url: string, - signal: AbortSignal, - providerContext: ProviderContext, -): Promise { - try { - const {axios, cheerio} = providerContext; - const res = await axios.get(url, {headers, signal}); - const data = res.data; - const $ = cheerio.load(data); - const catalog: Post[] = []; - $('.post-cards') - .find('article') - .map((i, element) => { - const title = $(element).find('a').attr('title'); - const link = $(element).find('a').attr('href'); - const image = - $(element).find('img').attr('data-src') || - $(element).find('img').attr('src') || - ''; - if (title && link) { - catalog.push({ - title: title.replace('Download', '').trim(), - link: link, - image: image, - }); - } - }); - // console.log(catalog); - return catalog; - } catch (err) { - console.error('mod error ', err); - return []; - } -} diff --git a/providers/uhd/catalog.ts b/providers/uhd/catalog.ts new file mode 100644 index 0000000..973e38b --- /dev/null +++ b/providers/uhd/catalog.ts @@ -0,0 +1,37 @@ +export const catalog = [ + { + title: "Latest", + filter: "", + }, + { + title: "Web Series", + filter: "/web-series", + }, + { + title: "Movies", + filter: "/movies", + }, + { + title: "4K HDR", + filter: "/4k-hdr", + }, +]; + +export const genres = [ + { + title: "4K HEVC", + filter: "/2160p-hevc", + }, + { + title: "HD 10bit", + filter: "/1080p-10bit", + }, + { + title: "English Movies", + filter: "/movies/english-movies", + }, + { + title: "Dual Audio", + filter: "/movies/dual-audio-movies", + }, +]; diff --git a/providers/uhd/index.ts b/providers/uhd/index.ts deleted file mode 100644 index 3a95318..0000000 --- a/providers/uhd/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {uhdCatalogList, uhdGenresList} from './uhCtatalog'; -import {uhdGetPosts, uhdGetPostsSearch} from './uhdGetPosts'; -import {uhdGetStream} from './uhdGetStream'; -import {getUhdInfo} from './getUhdInfo'; -import {ProviderType} from '../types'; - -export const uhdMovies: ProviderType = { - catalog: uhdCatalogList, - genres: uhdGenresList, - GetMetaData: getUhdInfo, - GetHomePosts: uhdGetPosts, - GetStream: uhdGetStream, - nonStreamableServer: ['Gdrive-Instant'], - GetSearchPosts: uhdGetPostsSearch, -}; diff --git a/providers/uhd/getUhdInfo.ts b/providers/uhd/meta.ts similarity index 52% rename from providers/uhd/getUhdInfo.ts rename to providers/uhd/meta.ts index b54e2f9..06cf79c 100644 --- a/providers/uhd/getUhdInfo.ts +++ b/providers/uhd/meta.ts @@ -1,25 +1,25 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; const headers = { Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Cache-Control': 'no-store', - 'Accept-Language': 'en-US,en;q=0.9', - DNT: '1', - 'sec-ch-ua': + "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", }; -export async function getUhdInfo({ +export const getMeta = async function ({ link, providerContext, }: { @@ -27,14 +27,14 @@ export async function getUhdInfo({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const url = link; - const res = await axios.get(url, {headers}); + const res = await axios.get(url, { headers }); const html = await res.data; const $ = cheerio.load(html); - const title = $('h2:first').text() || ''; - const image = $('h2').siblings().find('img').attr('src') || ''; + const title = $("h2:first").text() || ""; + const image = $("h2").siblings().find("img").attr("src") || ""; // const trailer = $('iframe').attr('src') || ''; // console.log({ title, image, trailer }); @@ -43,20 +43,20 @@ export async function getUhdInfo({ const episodes: Link[] = []; // new structure - $('.mks_separator').each((index, element) => { + $(".mks_separator").each((index, element) => { $(element) - .nextUntil('.mks_separator') + .nextUntil(".mks_separator") .each((index, element) => { const title = $(element).text(); - const episodesList: {title: string; link: string}[] = []; + const episodesList: { title: string; link: string }[] = []; $(element) - .next('p') - .find('a') + .next("p") + .find("a") .each((index, element) => { const title = $(element).text(); - const link = $(element).attr('href'); - if (title && link && !title.toLocaleLowerCase().includes('zip')) { - episodesList.push({title, link}); + const link = $(element).attr("href"); + if (title && link && !title.toLocaleLowerCase().includes("zip")) { + episodesList.push({ title, link }); // console.log({ title, link }); } }); @@ -70,20 +70,20 @@ export async function getUhdInfo({ }); // old structure - $('hr').each((index, element) => { + $("hr").each((index, element) => { $(element) - .nextUntil('hr') + .nextUntil("hr") .each((index, element) => { const title = $(element).text(); - const episodesList: {title: string; link: string}[] = []; + const episodesList: { title: string; link: string }[] = []; $(element) - .next('p') - .find('a') + .next("p") + .find("a") .each((index, element) => { const title = $(element).text(); - const link = $(element).attr('href'); - if (title && link && !title.toLocaleLowerCase().includes('zip')) { - episodesList.push({title, link}); + const link = $(element).attr("href"); + if (title && link && !title.toLocaleLowerCase().includes("zip")) { + episodesList.push({ title, link }); // console.log({ title, link }); } }); @@ -98,23 +98,23 @@ export async function getUhdInfo({ // console.log(episodes); return { title: title.match(/^Download\s+([^(\[]+)/i) - ? title?.match(/^Download\s+([^(\[]+)/i)?.[1] || '' - : title.replace('Download', '') || '', + ? title?.match(/^Download\s+([^(\[]+)/i)?.[1] || "" + : title.replace("Download", "") || "", image, - imdbId: '', + imdbId: "", synopsis: title, - type: '', + type: "", linkList: episodes, }; } catch (error) { console.error(error); return { - title: '', - image: '', - imdbId: '', - synopsis: '', + title: "", + image: "", + imdbId: "", + synopsis: "", linkList: [], - type: 'uhd', + type: "uhd", }; } -} +}; diff --git a/providers/uhd/uhdGetPosts.ts b/providers/uhd/posts.ts similarity index 50% rename from providers/uhd/uhdGetPosts.ts rename to providers/uhd/posts.ts index 6c2fa6e..d225b15 100644 --- a/providers/uhd/uhdGetPosts.ts +++ b/providers/uhd/posts.ts @@ -1,25 +1,25 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; const headers = { Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Cache-Control': 'no-store', - 'Accept-Language': 'en-US,en;q=0.9', - DNT: '1', - 'sec-ch-ua': + "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", }; -export const uhdGetPosts = async ({ +export const getPosts = async ({ filter, page, // providerValue, @@ -32,16 +32,16 @@ export const uhdGetPosts = async ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise => { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('UhdMovies'); + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("UhdMovies"); const url = page === 1 ? `${baseUrl}/${filter}/` : `${baseUrl + filter}/page/${page}/`; - console.log('url', url); + console.log("url", url); return posts(baseUrl, url, signal, providerContext); }; -export const uhdGetPostsSearch = async ({ +export const getSearchPosts = async ({ searchQuery, page, // providerValue, @@ -54,8 +54,8 @@ export const uhdGetPostsSearch = async ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise => { - const {getBaseUrl} = providerContext; - const baseUrl = await getBaseUrl('UhdMovies'); + const { getBaseUrl } = providerContext; + const baseUrl = await getBaseUrl("UhdMovies"); const url = `${baseUrl}/search/${searchQuery}/page/${page}/`; return posts(baseUrl, url, signal, providerContext); @@ -65,25 +65,25 @@ async function posts( baseURL: string, url: string, signal: AbortSignal, - providerContext: ProviderContext, + providerContext: ProviderContext ): Promise { try { - const {axios, cheerio} = providerContext; - const res = await axios.get(url, {headers, signal}); + const { axios, cheerio } = providerContext; + const res = await axios.get(url, { headers, signal }); const html = res.data; const $ = cheerio.load(html); const uhdCatalog: Post[] = []; - $('.gridlove-posts') - .find('.layout-masonry') + $(".gridlove-posts") + .find(".layout-masonry") .each((index, element) => { - const title = $(element).find('a').attr('title'); - const link = $(element).find('a').attr('href'); - const image = $(element).find('a').find('img').attr('src'); + const title = $(element).find("a").attr("title"); + const link = $(element).find("a").attr("href"); + const image = $(element).find("a").find("img").attr("src"); if (title && link && image) { uhdCatalog.push({ - title: title.replace('Download', '').trim(), + title: title.replace("Download", "").trim(), link: link, image: image, }); @@ -91,7 +91,7 @@ async function posts( }); return uhdCatalog; } catch (err) { - console.error('uhd error ', err); + console.error("uhd error ", err); return []; } } diff --git a/providers/uhd/uhdGetStream.ts b/providers/uhd/stream.ts similarity index 53% rename from providers/uhd/uhdGetStream.ts rename to providers/uhd/stream.ts index 0e8a710..a2bbd9d 100644 --- a/providers/uhd/uhdGetStream.ts +++ b/providers/uhd/stream.ts @@ -1,25 +1,25 @@ -import {ProviderContext, Stream} from '../types'; +import { ProviderContext, Stream } from "../types"; const headers = { Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Cache-Control': 'no-store', - 'Accept-Language': 'en-US,en;q=0.9', - DNT: '1', - 'sec-ch-ua': + "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", }; -export const uhdGetStream = async ({ +export const getStream = async ({ link: url, providerContext, }: { @@ -27,35 +27,35 @@ export const uhdGetStream = async ({ providerContext: ProviderContext; }): Promise => { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; let downloadLink = await modExtractor(url, providerContext); // console.log(downloadLink.data); const ddl = downloadLink?.data?.match(/content="0;url=(.*?)"/)?.[1] || url; - console.log('ddl', ddl); + console.log("ddl", ddl); // console.log(ddl); const driveLink = await isDriveLink(ddl); const ServerLinks: Stream[] = []; - const driveRes = await axios.get(driveLink, {headers}); + const driveRes = await axios.get(driveLink, { headers }); const driveHtml = driveRes.data; const $drive = cheerio.load(driveHtml); //instant link try { - const seed = $drive('.btn-danger').attr('href') || ''; - const instantToken = seed.split('=')[1]; + const seed = $drive(".btn-danger").attr("href") || ""; + const instantToken = seed.split("=")[1]; // console.log('InstantToken', instantToken); const InstantFromData = new FormData(); - InstantFromData.append('keys', instantToken); - const videoSeedUrl = seed.split('/').slice(0, 3).join('/') + '/api'; + InstantFromData.append("keys", instantToken); + const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api"; // console.log('videoSeedUrl', videoSeedUrl); const instantLinkRes = await fetch(videoSeedUrl, { - method: 'POST', + method: "POST", body: InstantFromData, headers: { - 'x-token': videoSeedUrl, + "x-token": videoSeedUrl, }, }); const instantLinkData = await instantLinkRes.json(); @@ -63,96 +63,96 @@ export const uhdGetStream = async ({ if (instantLinkData.error === false) { const instantLink = instantLinkData.url; ServerLinks.push({ - server: 'Gdrive-Instant', + server: "Gdrive-Instant", link: instantLink, - type: 'mkv', + type: "mkv", }); } else { - console.log('Instant link not found', instantLinkData); + console.log("Instant link not found", instantLinkData); } } catch (err) { - console.log('Instant link not found', err); + console.log("Instant link not found", err); } // resume link try { - const resumeDrive = driveLink.replace('/file', '/zfile'); + const resumeDrive = driveLink.replace("/file", "/zfile"); // console.log('resumeDrive', resumeDrive); - const resumeDriveRes = await axios.get(resumeDrive, {headers}); + const resumeDriveRes = await axios.get(resumeDrive, { headers }); const resumeDriveHtml = resumeDriveRes.data; const $resumeDrive = cheerio.load(resumeDriveHtml); - const resumeLink = $resumeDrive('.btn-success').attr('href'); + const resumeLink = $resumeDrive(".btn-success").attr("href"); // console.log('resumeLink', resumeLink); if (resumeLink) { ServerLinks.push({ - server: 'ResumeCloud', + server: "ResumeCloud", link: resumeLink, - type: 'mkv', + type: "mkv", }); } } catch (err) { - console.log('Resume link not found'); + console.log("Resume link not found"); } // CF workers type 1 try { - const cfWorkersLink = driveLink.replace('/file', '/wfile') + '?type=1'; - const cfWorkersRes = await axios.get(cfWorkersLink, {headers}); + const cfWorkersLink = driveLink.replace("/file", "/wfile") + "?type=1"; + const cfWorkersRes = await axios.get(cfWorkersLink, { headers }); const cfWorkersHtml = cfWorkersRes.data; const $cfWorkers = cheerio.load(cfWorkersHtml); - const cfWorkersStream = $cfWorkers('.btn-success'); + const cfWorkersStream = $cfWorkers(".btn-success"); cfWorkersStream.each((i, el) => { - const link = el.attribs.href; + const link = (el as any).attribs?.href; if (link) { ServerLinks.push({ - server: 'Cf Worker 1.' + i, + server: "Cf Worker 1." + i, link: link, - type: 'mkv', + type: "mkv", }); } }); } catch (err) { - console.log('CF workers link not found', err); + console.log("CF workers link not found", err); } // CF workers type 2 try { - const cfWorkersLink = driveLink.replace('/file', '/wfile') + '?type=2'; - const cfWorkersRes = await axios.get(cfWorkersLink, {headers}); + const cfWorkersLink = driveLink.replace("/file", "/wfile") + "?type=2"; + const cfWorkersRes = await axios.get(cfWorkersLink, { headers }); const cfWorkersHtml = cfWorkersRes.data; const $cfWorkers = cheerio.load(cfWorkersHtml); - const cfWorkersStream = $cfWorkers('.btn-success'); + const cfWorkersStream = $cfWorkers(".btn-success"); cfWorkersStream.each((i, el) => { - const link = el.attribs.href; + const link = (el as any).attribs?.href; if (link) { ServerLinks.push({ - server: 'Cf Worker 2.' + i, + server: "Cf Worker 2." + i, link: link, - type: 'mkv', + type: "mkv", }); } }); } catch (err) { - console.log('CF workers link not found', err); + console.log("CF workers link not found", err); } - console.log('ServerLinks', ServerLinks); + console.log("ServerLinks", ServerLinks); return ServerLinks; } catch (err) { - console.log('getStream error', err); + console.log("getStream error", err); return []; } }; const isDriveLink = async (ddl: string) => { - if (ddl.includes('drive')) { + if (ddl.includes("drive")) { const driveLeach = await fetch(ddl); const driveLeachData = await driveLeach.text(); const pathMatch = driveLeachData.match( - /window\.location\.replace\("([^"]+)"\)/, + /window\.location\.replace\("([^"]+)"\)/ ); const path = pathMatch?.[1]; - const mainUrl = ddl.split('/')[2]; + const mainUrl = ddl.split("/")[2]; console.log(`driveUrl = https://${mainUrl}${path}`); return `https://${mainUrl}${path}`; } else { @@ -161,13 +161,13 @@ const isDriveLink = async (ddl: string) => { }; async function modExtractor(url: string, providerContext: ProviderContext) { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; try { - const wpHttp = url.split('sid=')[1]; + const wpHttp = url.split("sid=")[1]; var bodyFormData0 = new FormData(); - bodyFormData0.append('_wp_http', wpHttp); - const res = await fetch(url.split('?')[0], { - method: 'POST', + bodyFormData0.append("_wp_http", wpHttp); + const res = await fetch(url.split("?")[0], { + method: "POST", body: bodyFormData0, }); const data = await res.text(); @@ -176,25 +176,25 @@ async function modExtractor(url: string, providerContext: ProviderContext) { const $ = cheerio.load(html); // find input with name="_wp_http2" - const wpHttp2 = $('input').attr('name', '_wp_http2').val(); + const wpHttp2 = $("input").attr("name", "_wp_http2").val(); // console.log('wpHttp2', wpHttp2); // form data var bodyFormData = new FormData(); - bodyFormData.append('_wp_http2', wpHttp2); - const formUrl1 = $('form').attr('action'); - const formUrl = formUrl1 || url.split('?')[0]; + bodyFormData.append("_wp_http2", wpHttp2); + const formUrl1 = $("form").attr("action"); + const formUrl = formUrl1 || url.split("?")[0]; const res2 = await fetch(formUrl, { - method: 'POST', + method: "POST", body: bodyFormData, }); const html2: any = await res2.text(); const link = html2.match(/setAttribute\("href",\s*"(.*?)"/)[1]; console.log(link); - const cookie = link.split('=')[1]; - console.log('cookie', cookie); + const cookie = link.split("=")[1]; + console.log("cookie", cookie); const downloadLink = await axios.get(link, { headers: { @@ -204,6 +204,6 @@ async function modExtractor(url: string, providerContext: ProviderContext) { }); return downloadLink; } catch (err) { - console.log('modGetStream error', err); + console.log("modGetStream error", err); } } diff --git a/providers/uhd/uhCtatalog.ts b/providers/uhd/uhCtatalog.ts deleted file mode 100644 index 50fa4f5..0000000 --- a/providers/uhd/uhCtatalog.ts +++ /dev/null @@ -1,37 +0,0 @@ -export const uhdCatalogList = [ - { - title: 'Latest', - filter: '', - }, - { - title: 'Web Series', - filter: '/web-series', - }, - { - title: 'Movies', - filter: '/movies', - }, - { - title: '4K HDR', - filter: '/4k-hdr', - }, -]; - -export const uhdGenresList = [ - { - title: '4K HEVC', - filter: '/2160p-hevc', - }, - { - title: 'HD 10bit', - filter: '/1080p-10bit', - }, - { - title: 'English Movies', - filter: '/movies/english-movies', - }, - { - title: 'Dual Audio', - filter: '/movies/dual-audio-movies', - }, -]; diff --git a/providers/vadapav/VagapavCatalog.ts b/providers/vadapav/VagapavCatalog.ts deleted file mode 100644 index dc9dbc3..0000000 --- a/providers/vadapav/VagapavCatalog.ts +++ /dev/null @@ -1,16 +0,0 @@ -export const vadapavCatalogList = [ - { - title: 'Movies', - filter: '/608c853f-704e-48f0-b785-4ae1f48ea70d', - }, - { - title: 'Tv Shows', - filter: '/72983eef-a12f-4be4-99a7-e8f6afa568c1', - }, - { - title: 'Anime', - filter: '/36abf81c-1032-4fbf-9a55-347a05ce2ca3', - }, -]; - -export const vadapavGenresList = []; diff --git a/providers/vadapav/catalog.ts b/providers/vadapav/catalog.ts new file mode 100644 index 0000000..6124192 --- /dev/null +++ b/providers/vadapav/catalog.ts @@ -0,0 +1,16 @@ +export const catalog = [ + { + title: "Movies", + filter: "/608c853f-704e-48f0-b785-4ae1f48ea70d", + }, + { + title: "Tv Shows", + filter: "/72983eef-a12f-4be4-99a7-e8f6afa568c1", + }, + { + title: "Anime", + filter: "/36abf81c-1032-4fbf-9a55-347a05ce2ca3", + }, +]; + +export const genres = []; diff --git a/providers/vadapav/vadapavGetEpisodes.ts b/providers/vadapav/episodes.ts similarity index 50% rename from providers/vadapav/vadapavGetEpisodes.ts rename to providers/vadapav/episodes.ts index 229328b..36d7b64 100644 --- a/providers/vadapav/vadapavGetEpisodes.ts +++ b/providers/vadapav/episodes.ts @@ -1,31 +1,31 @@ -import {EpisodeLink, ProviderContext} from '../types'; +import { EpisodeLink, ProviderContext } from "../types"; -export const vadapavGetEpisodeLinks = async function ({ +export const getEpisodes = async function ({ url, providerContext, }: { url: string; providerContext: ProviderContext; }): Promise { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; try { - const baseUrl = url?.split('/').slice(0, 3).join('/'); + const baseUrl = url?.split("/").slice(0, 3).join("/"); const res = await axios.get(url); const html = res.data; let $ = cheerio.load(html); const episodeLinks: EpisodeLink[] = []; $('.file-entry:not(:contains("Parent Directory"))').map((i, element) => { - const link = $(element).attr('href'); + const link = $(element).attr("href"); if ( link && - ($(element).text()?.includes('.mp4') || - $(element).text()?.includes('.mkv')) + ($(element).text()?.includes(".mp4") || + $(element).text()?.includes(".mkv")) ) { episodeLinks.push({ title: - $(element).text()?.match(/E\d+/)?.[0]?.replace('E', 'Episode ') || - i + 1 + '. ' + $(element).text()?.replace('.mkv', ''), + $(element).text()?.match(/E\d+/)?.[0]?.replace("E", "Episode ") || + i + 1 + ". " + $(element).text()?.replace(".mkv", ""), link: baseUrl + link, }); } diff --git a/providers/vadapav/index.ts b/providers/vadapav/index.ts deleted file mode 100644 index 110972f..0000000 --- a/providers/vadapav/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {vadapavGetPosts, vadapavGetPostsSearch} from './vadapavGetPosts'; -import {vadapavCatalogList, vadapavGenresList} from './VagapavCatalog'; -import {ProviderType} from '../types'; -import {vadapavGetInfo} from './vadapavGetInfo'; -import {vadapavGetStream} from './vadapavGetStream'; -import {vadapavGetEpisodeLinks} from './vadapavGetEpisodes'; - -export const vadapavProvider: ProviderType = { - catalog: vadapavCatalogList, - genres: vadapavGenresList, - GetHomePosts: vadapavGetPosts, - GetEpisodeLinks: vadapavGetEpisodeLinks, - GetMetaData: vadapavGetInfo, - GetStream: vadapavGetStream, - GetSearchPosts: vadapavGetPostsSearch, -}; diff --git a/providers/vadapav/vadapavGetInfo.ts b/providers/vadapav/meta.ts similarity index 57% rename from providers/vadapav/vadapavGetInfo.ts rename to providers/vadapav/meta.ts index 0c805c2..2c46adb 100644 --- a/providers/vadapav/vadapavGetInfo.ts +++ b/providers/vadapav/meta.ts @@ -1,6 +1,6 @@ -import {EpisodeLink, Info, Link, ProviderContext} from '../types'; +import { EpisodeLink, Info, Link, ProviderContext } from "../types"; -export const vadapavGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -8,68 +8,68 @@ export const vadapavGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio} = providerContext; - const baseUrl = link?.split('/').slice(0, 3).join('/'); + const { axios, cheerio } = providerContext; + const baseUrl = link?.split("/").slice(0, 3).join("/"); const url = link; const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); const title = - $('.directory') + $(".directory") .children() .first() .text() .trim() - ?.split('/') + ?.split("/") .pop() - ?.trim() || ''; + ?.trim() || ""; const links: Link[] = []; $('.directory-entry:not(:contains("Parent Directory"))').map( (i, element) => { - const link = $(element).attr('href'); + const link = $(element).attr("href"); if (link) { links.push({ episodesLink: baseUrl + link, title: $(element).text(), }); } - }, + } ); const directLinks: EpisodeLink[] = []; $('.file-entry:not(:contains("Parent Directory"))').map((i, element) => { - const link = $(element).attr('href'); + const link = $(element).attr("href"); if ( link && - ($(element).text()?.includes('.mp4') || - $(element).text()?.includes('.mkv')) + ($(element).text()?.includes(".mp4") || + $(element).text()?.includes(".mkv")) ) { directLinks.push({ - title: i + 1 + '. ' + $(element).text(), + title: i + 1 + ". " + $(element).text(), link: baseUrl + link, }); } }); if (directLinks.length > 0) { links.push({ - title: title + ' DL', + title: title + " DL", directLinks: directLinks, }); } return { title: title, - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: links, }; } catch (err) { return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/vadapav/vadapavGetPosts.ts b/providers/vadapav/posts.ts similarity index 64% rename from providers/vadapav/vadapavGetPosts.ts rename to providers/vadapav/posts.ts index 4eb3305..4cfaab0 100644 --- a/providers/vadapav/vadapavGetPosts.ts +++ b/providers/vadapav/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const vadapavGetPosts = async function ({ +export const getPosts = async function ({ filter, page, // providerValue, @@ -13,16 +13,16 @@ export const vadapavGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('vadapav'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("vadapav"); if (page > 1) { return []; } const url = `${baseUrl + filter}`; - return posts({baseUrl, url, signal, axios, cheerio}); + return posts({ baseUrl, url, signal, axios, cheerio }); }; -export const vadapavGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, // providerValue, @@ -35,13 +35,13 @@ export const vadapavGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('vadapav'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("vadapav"); if (page > 1) { return []; } const url = `${baseUrl}/s/${searchQuery}`; - return posts({baseUrl, url, signal, axios, cheerio}); + return posts({ baseUrl, url, signal, axios, cheerio }); }; async function posts({ @@ -54,24 +54,24 @@ async function posts({ baseUrl: string; url: string; signal: AbortSignal; - axios: ProviderContext['axios']; - cheerio: ProviderContext['cheerio']; + axios: ProviderContext["axios"]; + cheerio: ProviderContext["cheerio"]; }): Promise { try { - const res = await axios.get(url, {signal}); + const res = await axios.get(url, { signal }); const data = res.data; const $ = cheerio.load(data); const catalog: Post[] = []; $('.directory-entry:not(:contains("Parent Directory"))').map( (i, element) => { const title = $(element).text(); - const link = $(element).attr('href'); + const link = $(element).attr("href"); const imageTitle = title?.length > 30 - ? title?.slice(0, 30)?.replaceAll('.', ' ') - : title?.replaceAll('.', ' '); + ? title?.slice(0, 30)?.replace(/\./g, " ") + : title?.replace(/\./g, " "); const image = `https://placehold.jp/23/000000/ffffff/200x400.png?text=${encodeURIComponent( - imageTitle, + imageTitle )}&css=%7B%22background%22%3A%22%20-webkit-gradient(linear%2C%20left%20bottom%2C%20left%20top%2C%20from(%233f3b3b)%2C%20to(%23000000))%22%2C%22text-transform%22%3A%22%20capitalize%22%7D`; if (title && link) { catalog.push({ @@ -80,7 +80,7 @@ async function posts({ image: image, }); } - }, + } ); return catalog; } catch (err) { diff --git a/providers/vadapav/stream.ts b/providers/vadapav/stream.ts new file mode 100644 index 0000000..ac552d6 --- /dev/null +++ b/providers/vadapav/stream.ts @@ -0,0 +1,21 @@ +import { Stream, ProviderContext } from "../types"; + +export const getStream = async function ({ + link: url, // type, // providerContext, +}: { + link: string; + type: string; + providerContext: ProviderContext; +}): Promise { + try { + const stream: Stream[] = []; + stream.push({ + server: "vadapav", + link: url, + type: url?.split(".").pop() || "mkv", + }); + return stream; + } catch (err) { + return []; + } +}; diff --git a/providers/vadapav/vadapavGetStream.ts b/providers/vadapav/vadapavGetStream.ts deleted file mode 100644 index 472e4c0..0000000 --- a/providers/vadapav/vadapavGetStream.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {Stream, ProviderContext} from '../types'; - -export const vadapavGetStream = async function ({ - link: url, // type, -} // providerContext, -: { - link: string; - type: string; - providerContext: ProviderContext; -}): Promise { - try { - const stream: Stream[] = []; - stream.push({ - server: 'vadapav', - link: url, - type: url?.split('.').pop() || 'mkv', - }); - return stream; - } catch (err) { - return []; - } -}; diff --git a/providers/vega/catalog.ts b/providers/vega/catalog.ts index f89d73e..4c93063 100644 --- a/providers/vega/catalog.ts +++ b/providers/vega/catalog.ts @@ -1,101 +1,101 @@ -export const homeList = [ +export const catalog = [ { - title: 'New', - filter: '', + title: "New", + filter: "", }, { - title: 'Netflix', - filter: 'web-series/netflix', + title: "Netflix", + filter: "web-series/netflix", }, { - title: 'Amazon Prime', - filter: 'web-series/amazon-prime-video', + title: "Amazon Prime", + filter: "web-series/amazon-prime-video", }, { - title: '4K Movies', - filter: 'movies-by-quality/2160p', + title: "4K Movies", + filter: "movies-by-quality/2160p", }, ]; -export const genresList = [ +export const genres = [ { - title: 'Action', - filter: 'category/movies-by-genres/action', + title: "Action", + filter: "category/movies-by-genres/action", }, { - title: 'Adventure', - filter: 'category/movies-by-genres/adventure', + title: "Adventure", + filter: "category/movies-by-genres/adventure", }, { - title: 'Animation', - filter: 'category/movies-by-genres/animation', + title: "Animation", + filter: "category/movies-by-genres/animation", }, { - title: 'Biography', - filter: 'category/movies-by-genres/biography', + title: "Biography", + filter: "category/movies-by-genres/biography", }, { - title: 'Comedy', - filter: 'category/movies-by-genres/comedy', + title: "Comedy", + filter: "category/movies-by-genres/comedy", }, { - title: 'Crime', - filter: 'category/movies-by-genres/crime', + title: "Crime", + filter: "category/movies-by-genres/crime", }, { - title: 'Documentary', - filter: 'category/movies-by-genres/documentary', + title: "Documentary", + filter: "category/movies-by-genres/documentary", }, { - title: 'Drama', - filter: 'category/movies-by-genres/drama', + title: "Drama", + filter: "category/movies-by-genres/drama", }, { - title: 'Family', - filter: 'category/movies-by-genres/family', + title: "Family", + filter: "category/movies-by-genres/family", }, { - title: 'Fantasy', - filter: 'category/movies-by-genres/fantasy', + title: "Fantasy", + filter: "category/movies-by-genres/fantasy", }, { - title: 'History', - filter: 'category/movies-by-genres/history', + title: "History", + filter: "category/movies-by-genres/history", }, { - title: 'Horror', - filter: 'category/movies-by-genres/horror', + title: "Horror", + filter: "category/movies-by-genres/horror", }, { - title: 'Music', - filter: 'category/movies-by-genres/music', + title: "Music", + filter: "category/movies-by-genres/music", }, { - title: 'Mystery', - filter: 'category/movies-by-genres/mystery', + title: "Mystery", + filter: "category/movies-by-genres/mystery", }, { - title: 'Romance', - filter: 'category/movies-by-genres/romance', + title: "Romance", + filter: "category/movies-by-genres/romance", }, { - title: 'Sci-Fi', - filter: 'category/movies-by-genres/sci-fi', + title: "Sci-Fi", + filter: "category/movies-by-genres/sci-fi", }, { - title: 'Sport', - filter: 'category/movies-by-genres/sport', + title: "Sport", + filter: "category/movies-by-genres/sport", }, { - title: 'Thriller', - filter: 'category/movies-by-genres/thriller', + title: "Thriller", + filter: "category/movies-by-genres/thriller", }, { - title: 'War', - filter: 'category/movies-by-genres/war', + title: "War", + filter: "category/movies-by-genres/war", }, { - title: 'Western', - filter: 'category/movies-by-genres/western', + title: "Western", + filter: "category/movies-by-genres/western", }, ]; diff --git a/providers/vega/episodes.ts b/providers/vega/episodes.ts new file mode 100644 index 0000000..256e9d9 --- /dev/null +++ b/providers/vega/episodes.ts @@ -0,0 +1,39 @@ +import { EpisodeLink, ProviderContext } from "../types"; + +export const getEpisodes = async function ({ + url, + providerContext, +}: { + url: string; + providerContext: ProviderContext; +}): Promise { + const { axios, cheerio, commonHeaders: headers } = providerContext; + console.log("getEpisodeLinks", url); + try { + const res = await axios.get(url, { headers }); + const $ = cheerio.load(res.data); + const container = $(".entry-content,.entry-inner"); + $(".unili-content,.code-block-1").remove(); + const episodes: EpisodeLink[] = []; + container.find("h4").each((index, element) => { + const el = $(element); + const title = el.text().replaceAll("-", "").replaceAll(":", ""); + const link = el + .next("p") + .find( + '.btn-outline[style="background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;"]' + ) + .parent() + .attr("href"); + if (title && link) { + episodes.push({ title, link }); + } + }); + // console.log(episodes); + return episodes; + } catch (err) { + console.log("getEpisodeLinks error: "); + // console.error(err); + return []; + } +}; diff --git a/providers/vega/getEpisodesLink.ts b/providers/vega/getEpisodesLink.ts deleted file mode 100644 index 91f3622..0000000 --- a/providers/vega/getEpisodesLink.ts +++ /dev/null @@ -1,39 +0,0 @@ -import {EpisodeLink, ProviderContext} from '../types'; - -export const vegaGetEpisodeLinks = async function ({ - url, - providerContext, -}: { - url: string; - providerContext: ProviderContext; -}): Promise { - const {axios, cheerio, commonHeaders: headers} = providerContext; - console.log('getEpisodeLinks', url); - try { - const res = await axios.get(url, {headers}); - const $ = cheerio.load(res.data); - const container = $('.entry-content,.entry-inner'); - $('.unili-content,.code-block-1').remove(); - const episodes: EpisodeLink[] = []; - container.find('h4').each((index, element) => { - const el = $(element); - const title = el.text().replaceAll('-', '').replaceAll(':', ''); - const link = el - .next('p') - .find( - '.btn-outline[style="background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;"]', - ) - .parent() - .attr('href'); - if (title && link) { - episodes.push({title, link}); - } - }); - // console.log(episodes); - return episodes; - } catch (err) { - console.log('getEpisodeLinks error: '); - // console.error(err); - return []; - } -}; diff --git a/providers/vega/index.ts b/providers/vega/index.ts deleted file mode 100644 index d365412..0000000 --- a/providers/vega/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import {vegaGetInfo} from './getInfo'; -import {vegaGetStream} from './getStream'; -import {vegaGetEpisodeLinks} from './getEpisodesLink'; -import {vegaGetPosts, vegaGetPostsSearch} from './getPosts'; -import {homeList, genresList} from './catalog'; -import {ProviderType} from '../types'; - -export const vegaMovies: ProviderType = { - catalog: homeList, - genres: genresList, - GetMetaData: vegaGetInfo, - GetHomePosts: vegaGetPosts, - GetStream: vegaGetStream, - nonStreamableServer: ['filepress', 'hubcloud', 'HubCdn'], - GetEpisodeLinks: vegaGetEpisodeLinks, - GetSearchPosts: vegaGetPostsSearch, -}; diff --git a/providers/vega/meta.ts b/providers/vega/meta.ts new file mode 100644 index 0000000..fc0190e --- /dev/null +++ b/providers/vega/meta.ts @@ -0,0 +1,158 @@ +import { Info, Link, ProviderContext } from "../types"; + +const headers = { + Accept: + "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": + '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + Cookie: + "_lscache_vary=62abf8b96599676eb8ec211cffaeb8ff; ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=n4Y1XTKZ5TfIMBNQuAXzerwKpx0U35KoOm3imfT0GpU-1732097818-1.2.1.1-ZeAnEu.8D9TSZHYDoj7vwo1A1rpdKl304ZpaBn_QbAQOr211JFAb7.JRQU3EL2eIy1Dfl8HhYvH7_259.22lUz8gbchHcQ8hvfuQXMtFMCbqDBLzjNUZa9stuk.39l28IcPhH9Z2szsf3SGtNI1sAfo66Djt7sOReLK3lHw9UkJp7BdGqt6a2X9qAc8EsAI3lE480Tmt0fkHv14Oc30LSbPB_WwFmiqAki2W.Gv9hV7TN_QBFESleTDlXd.6KGflfd4.KwWF7rpSRo_cgoc9ALLLIafpxHVbe7_g5r7zvpml_Pj8fEL75fw.1GBuy16bciHBuB8s_kahuJYUnhtQFFgfTQl8_Gn6KeovBWx.PJ7nFv5sklHUfAyBVq3t30xKe8ZDydsQ_G.yipfj_In5GmmWcXGb6E4.bioDOwW_sKLtxwdTQt7Nu.RkILX_mKvXNpyLqflIVj8G7X5E8I.unw", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0", +}; + +export const getMeta = async ({ + link, + providerContext, +}: { + link: string; + providerContext: ProviderContext; +}): Promise => { + try { + const { axios, cheerio } = providerContext; + const url = link; + console.log("url", url); + const baseUrl = url.split("/").slice(0, 3).join("/"); + const response = await axios.get(url, { + headers: { + ...headers, + Referer: baseUrl, + }, + }); + const $ = cheerio.load(response.data); + const infoContainer = $(".entry-content,.post-inner"); + const heading = infoContainer?.find("h3"); + const imdbId = + //@ts-ignore + heading?.next("p")?.find("a")?.[0]?.attribs?.href?.match(/tt\d+/g)?.[0] || + infoContainer.text().match(/tt\d+/g)?.[0] || + ""; + // console.log(imdbId) + + const type = heading?.next("p")?.text()?.includes("Series Name") + ? "series" + : "movie"; + // console.log(type); + // title + const titleRegex = /Name: (.+)/; + const title = heading?.next("p")?.text()?.match(titleRegex)?.[1] || ""; + // console.log(title); + + // synopsis + const synopsisNode = //@ts-ignore + infoContainer?.find("p")?.next("h3,h4")?.next("p")?.[0]?.children?.[0]; + const synopsis = + synopsisNode && "data" in synopsisNode ? synopsisNode.data : ""; + // console.log(synopsis); + + // image + let image = + infoContainer?.find("img[data-lazy-src]")?.attr("data-lazy-src") || ""; + if (image.startsWith("//")) { + image = "https:" + image; + } + // console.log(image); + + // console.log({title, synopsis, image, imdbId, type}); + /// Links + const hr = infoContainer?.first()?.find("hr"); + const list = hr?.nextUntil("hr"); + const links: Link[] = []; + list.each((index, element: any) => { + element = $(element); + // title + const title = element?.text() || ""; + + const quality = element?.text().match(/\d+p\b/)?.[0] || ""; + // console.log(title); + // movieLinks + const movieLinks = element + ?.next() + .find(".dwd-button") + .text() + .toLowerCase() + .includes("download") + ? element?.next().find(".dwd-button")?.parent()?.attr("href") + : ""; + + // episode links + const vcloudLinks = element + ?.next() + .find( + ".btn-outline[style='background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;'],.btn-outline[style='background:linear-gradient(135deg,#ed0b0b,#f2d152); color: #fdf8f2;']" + ) + ?.parent() + ?.attr("href"); + console.log(title); + const episodesLink = + (vcloudLinks + ? vcloudLinks + : element + ?.next() + .find(".dwd-button") + .text() + .toLowerCase() + .includes("episode") + ? element?.next().find(".dwd-button")?.parent()?.attr("href") + : "") || + element + ?.next() + .find( + ".btn-outline[style='background:linear-gradient(135deg,#0ebac3,#09d261); color: white;']" + ) + ?.parent() + ?.attr("href"); + if (movieLinks || episodesLink) { + links.push({ + title, + directLinks: movieLinks + ? [{ title: "Movie", link: movieLinks, type: "movie" }] + : [], + episodesLink, + quality, + }); + } + }); + // console.log(links); + return { + title, + synopsis, + image, + imdbId, + type, + linkList: links, + }; + } catch (error) { + console.log("getInfo error"); + console.error(error); + // ToastAndroid.show('No response', ToastAndroid.SHORT); + return { + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "", + linkList: [], + }; + } +}; diff --git a/providers/vega/getPosts.ts b/providers/vega/posts.ts similarity index 52% rename from providers/vega/getPosts.ts rename to providers/vega/posts.ts index 07b3af7..4f1576d 100644 --- a/providers/vega/getPosts.ts +++ b/providers/vega/posts.ts @@ -1,27 +1,27 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; const headers = { Accept: - 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', - 'Cache-Control': 'no-store', - 'Accept-Language': 'en-US,en;q=0.9', - DNT: '1', - 'sec-ch-ua': + "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Dest': 'document', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", Cookie: - '_lscache_vary=62abf8b96599676eb8ec211cffaeb8ff; ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=n4Y1XTKZ5TfIMBNQuAXzerwKpx0U35KoOm3imfT0GpU-1732097818-1.2.1.1-ZeAnEu.8D9TSZHYDoj7vwo1A1rpdKl304ZpaBn_QbAQOr211JFAb7.JRQU3EL2eIy1Dfl8HhYvH7_259.22lUz8gbchHcQ8hvfuQXMtFMCbqDBLzjNUZa9stuk.39l28IcPhH9Z2szsf3SGtNI1sAfo66Djt7sOReLK3lHw9UkJp7BdGqt6a2X9qAc8EsAI3lE480Tmt0fkHv14Oc30LSbPB_WwFmiqAki2W.Gv9hV7TN_QBFESleTDlXd.6KGflfd4.KwWF7rpSRo_cgoc9ALLLIafpxHVbe7_g5r7zvpml_Pj8fEL75fw.1GBuy16bciHBuB8s_kahuJYUnhtQFFgfTQl8_Gn6KeovBWx.PJ7nFv5sklHUfAyBVq3t30xKe8ZDydsQ_G.yipfj_In5GmmWcXGb6E4.bioDOwW_sKLtxwdTQt7Nu.RkILX_mKvXNpyLqflIVj8G7X5E8I.unw', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0', + "_lscache_vary=62abf8b96599676eb8ec211cffaeb8ff; ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=n4Y1XTKZ5TfIMBNQuAXzerwKpx0U35KoOm3imfT0GpU-1732097818-1.2.1.1-ZeAnEu.8D9TSZHYDoj7vwo1A1rpdKl304ZpaBn_QbAQOr211JFAb7.JRQU3EL2eIy1Dfl8HhYvH7_259.22lUz8gbchHcQ8hvfuQXMtFMCbqDBLzjNUZa9stuk.39l28IcPhH9Z2szsf3SGtNI1sAfo66Djt7sOReLK3lHw9UkJp7BdGqt6a2X9qAc8EsAI3lE480Tmt0fkHv14Oc30LSbPB_WwFmiqAki2W.Gv9hV7TN_QBFESleTDlXd.6KGflfd4.KwWF7rpSRo_cgoc9ALLLIafpxHVbe7_g5r7zvpml_Pj8fEL75fw.1GBuy16bciHBuB8s_kahuJYUnhtQFFgfTQl8_Gn6KeovBWx.PJ7nFv5sklHUfAyBVq3t30xKe8ZDydsQ_G.yipfj_In5GmmWcXGb6E4.bioDOwW_sKLtxwdTQt7Nu.RkILX_mKvXNpyLqflIVj8G7X5E8I.unw", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0", }; -export const vegaGetPosts = async ({ +export const getPosts = async ({ filter, page, providerValue, @@ -34,16 +34,16 @@ export const vegaGetPosts = async ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise => { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('Vega'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("Vega"); - console.log('vegaGetPosts baseUrl:', providerValue, baseUrl); + console.log("vegaGetPosts baseUrl:", providerValue, baseUrl); const url = `${baseUrl}/${filter}/page/${page}/`; - console.log('vegaGetPosts url:', url); + console.log("vegaGetPosts url:", url); return posts(baseUrl, url, signal, headers, axios, cheerio); }; -export const vegaGetPostsSearch = async ({ +export const getSearchPosts = async ({ searchQuery, page, providerValue, @@ -56,12 +56,12 @@ export const vegaGetPostsSearch = async ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise => { - const {getBaseUrl, axios, commonHeaders, cheerio} = providerContext; - const baseUrl = await getBaseUrl('Vega'); + const { getBaseUrl, axios, commonHeaders, cheerio } = providerContext; + const baseUrl = await getBaseUrl("Vega"); - console.log('vegaGetPosts baseUrl:', providerValue, baseUrl); + console.log("vegaGetPosts baseUrl:", providerValue, baseUrl); const url = `${baseUrl}/page/${page}/?s=${searchQuery}`; - console.log('vegaGetPosts url:', url); + console.log("vegaGetPosts url:", url); return posts(baseUrl, url, signal, commonHeaders, axios, cheerio); }; @@ -71,8 +71,8 @@ async function posts( url: string, signal: AbortSignal, headers: Record = {}, - axios: ProviderContext['axios'], - cheerio: ProviderContext['cheerio'], + axios: ProviderContext["axios"], + cheerio: ProviderContext["cheerio"] ): Promise { try { const urlRes = await axios.get(url, { @@ -84,30 +84,30 @@ async function posts( }); const $ = cheerio.load(urlRes.data); const posts: Post[] = []; - $('.blog-items,.post-list') - ?.children('article') + $(".blog-items,.post-list") + ?.children("article") ?.each((index, element) => { const post = { title: ( $(element) - ?.find('a') - ?.attr('title') - ?.replace('Download', '') + ?.find("a") + ?.attr("title") + ?.replace("Download", "") ?.match(/^(.*?)\s*\((\d{4})\)|^(.*?)\s*\((Season \d+)\)/)?.[0] || - $(element)?.find('a')?.attr('title')?.replace('Download', '') || - $(element)?.find('.post-title').text()?.replace('Download', '') || - '' + $(element)?.find("a")?.attr("title")?.replace("Download", "") || + $(element)?.find(".post-title").text()?.replace("Download", "") || + "" ).trim(), - link: $(element)?.find('a')?.attr('href') || '', + link: $(element)?.find("a")?.attr("href") || "", image: - $(element).find('a').find('img').attr('data-lazy-src') || - $(element).find('a').find('img').attr('data-src') || - $(element).find('a').find('img').attr('src') || - '', + $(element).find("a").find("img").attr("data-lazy-src") || + $(element).find("a").find("img").attr("data-src") || + $(element).find("a").find("img").attr("src") || + "", }; - if (post.image.startsWith('//')) { - post.image = 'https:' + post.image; + if (post.image.startsWith("//")) { + post.image = "https:" + post.image; } posts.push(post); }); @@ -115,7 +115,7 @@ async function posts( // console.log(posts); return posts; } catch (error) { - console.error('vegaGetPosts error:', error); + console.error("vegaGetPosts error:", error); return []; } } diff --git a/providers/vega/stream.ts b/providers/vega/stream.ts new file mode 100644 index 0000000..8de5b5a --- /dev/null +++ b/providers/vega/stream.ts @@ -0,0 +1,117 @@ +import { ProviderContext, Stream } from "../types"; + +const headers = { + Accept: + "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + "Cache-Control": "no-store", + "Accept-Language": "en-US,en;q=0.9", + DNT: "1", + "sec-ch-ua": + '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Dest": "document", + "Sec-Fetch-Mode": "navigate", + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + Cookie: + "_lscache_vary=62abf8b96599676eb8ec211cffaeb8ff; ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=n4Y1XTKZ5TfIMBNQuAXzerwKpx0U35KoOm3imfT0GpU-1732097818-1.2.1.1-ZeAnEu.8D9TSZHYDoj7vwo1A1rpdKl304ZpaBn_QbAQOr211JFAb7.JRQU3EL2eIy1Dfl8HhYvH7_259.22lUz8gbchHcQ8hvfuQXMtFMCbqDBLzjNUZa9stuk.39l28IcPhH9Z2szsf3SGtNI1sAfo66Djt7sOReLK3lHw9UkJp7BdGqt6a2X9qAc8EsAI3lE480Tmt0fkHv14Oc30LSbPB_WwFmiqAki2W.Gv9hV7TN_QBFESleTDlXd.6KGflfd4.KwWF7rpSRo_cgoc9ALLLIafpxHVbe7_g5r7zvpml_Pj8fEL75fw.1GBuy16bciHBuB8s_kahuJYUnhtQFFgfTQl8_Gn6KeovBWx.PJ7nFv5sklHUfAyBVq3t30xKe8ZDydsQ_G.yipfj_In5GmmWcXGb6E4.bioDOwW_sKLtxwdTQt7Nu.RkILX_mKvXNpyLqflIVj8G7X5E8I.unw", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0", +}; + +export async function getStream({ + link, + type, + signal, + providerContext, +}: { + link: string; + type: string; + signal: AbortSignal; + providerContext: ProviderContext; +}) { + const { axios, cheerio, extractors } = providerContext; + const { hubcloudExtracter } = extractors; + try { + const streamLinks: Stream[] = []; + console.log("dotlink", link); + if (type === "movie") { + // vlink + const dotlinkRes = await axios(`${link}`, { headers }); + const dotlinkText = dotlinkRes.data; + // console.log('dotlinkText', dotlinkText); + const vlink = dotlinkText.match(/ { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; try { const res = await axios.get(url); const html = res.data; let $ = cheerio.load(html); const episodeLinks: EpisodeLink[] = []; $( - 'strong:contains("Episode"),strong:contains("1080"),strong:contains("720"),strong:contains("480")', + 'strong:contains("Episode"),strong:contains("1080"),strong:contains("720"),strong:contains("480")' ).map((i, element) => { const title = $(element).text(); const link = $(element) .parent() .parent() - .next('h4') - .find('a') - .attr('href'); - if (link && !title.includes('zip')) { + .next("h4") + .find("a") + .attr("href"); + if (link && !title.includes("zip")) { episodeLinks.push({ title: title, link, @@ -34,7 +34,7 @@ export const world4uGetEpisodeLinks = async function ({ } catch (err) { return [ { - title: 'Server 1', + title: "Server 1", link: url, }, ]; diff --git a/providers/world4u/index.ts b/providers/world4u/index.ts deleted file mode 100644 index b65deca..0000000 --- a/providers/world4u/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {world4uCatalogList, world4uGenresList} from './catalog'; -import {world4uGetEpisodeLinks} from './world4uGetEpisodeLinks'; -import {world4uGetInfo} from './world4uGetInfo'; -import {world4uGetPosts, world4uGetPostsSearch} from './world4uGetPosts'; -import {world4uGetStream} from './world4uGetStream'; -import {ProviderType} from '../types'; - -export const world4u: ProviderType = { - catalog: world4uCatalogList, - genres: world4uGenresList, - GetMetaData: world4uGetInfo, - GetHomePosts: world4uGetPosts, - GetStream: world4uGetStream, - GetEpisodeLinks: world4uGetEpisodeLinks, - GetSearchPosts: world4uGetPostsSearch, -}; diff --git a/providers/world4u/world4uGetInfo.ts b/providers/world4u/meta.ts similarity index 54% rename from providers/world4u/world4uGetInfo.ts rename to providers/world4u/meta.ts index 074f1f8..3596090 100644 --- a/providers/world4u/world4uGetInfo.ts +++ b/providers/world4u/meta.ts @@ -1,6 +1,6 @@ -import {Info, Link, ProviderContext} from '../types'; +import { Info, Link, ProviderContext } from "../types"; -export const world4uGetInfo = async function ({ +export const getMeta = async function ({ link, providerContext, }: { @@ -8,51 +8,51 @@ export const world4uGetInfo = async function ({ providerContext: ProviderContext; }): Promise { try { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const url = link; const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); - const type = $('.entry-content') + const type = $(".entry-content") .text() .toLocaleLowerCase() - .includes('movie name') - ? 'movie' - : 'series'; - const imdbId = $('.imdb_left').find('a').attr('href')?.split('/')[4] || ''; - const title = $('.entry-content') + .includes("movie name") + ? "movie" + : "series"; + const imdbId = $(".imdb_left").find("a").attr("href")?.split("/")[4] || ""; + const title = $(".entry-content") .find('strong:contains("Name")') .children() .remove() .end() .text() - .replace(':', ''); - const synopsis = $('.entry-content') + .replace(":", ""); + const synopsis = $(".entry-content") .find('p:contains("Synopsis"),p:contains("Plot"),p:contains("Story")') .children() .remove() .end() .text(); const image = - $('.wp-caption').find('img').attr('data-src') || - $('.entry-content').find('img').attr('data-src') || - ''; + $(".wp-caption").find("img").attr("data-src") || + $(".entry-content").find("img").attr("data-src") || + ""; const links: Link[] = []; - $('.my-button').map((i, element) => { + $(".my-button").map((i, element) => { const title = $(element).parent().parent().prev().text(); - const episodesLink = $(element).attr('href'); - const quality = title.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ''; + const episodesLink = $(element).attr("href"); + const quality = title.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || ""; if (episodesLink && title) { links.push({ title, - episodesLink: type === 'series' ? episodesLink : '', + episodesLink: type === "series" ? episodesLink : "", directLinks: - type === 'movie' + type === "movie" ? [ { link: episodesLink, title, - type: 'movie', + type: "movie", }, ] : [], @@ -70,11 +70,11 @@ export const world4uGetInfo = async function ({ }; } catch (err) { return { - title: '', - synopsis: '', - image: '', - imdbId: '', - type: 'movie', + title: "", + synopsis: "", + image: "", + imdbId: "", + type: "movie", linkList: [], }; } diff --git a/providers/world4u/world4uGetPosts.ts b/providers/world4u/posts.ts similarity index 51% rename from providers/world4u/world4uGetPosts.ts rename to providers/world4u/posts.ts index 87bb9ca..4797c15 100644 --- a/providers/world4u/world4uGetPosts.ts +++ b/providers/world4u/posts.ts @@ -1,6 +1,6 @@ -import {Post, ProviderContext} from '../types'; +import { Post, ProviderContext } from "../types"; -export const world4uGetPosts = async function ({ +export const getPosts = async function ({ filter, page, // providerValue, @@ -13,13 +13,13 @@ export const world4uGetPosts = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('w4u'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("w4u"); const url = `${baseUrl + filter}/page/${page}/`; - return posts({url, signal, axios, cheerio}); + return posts({ url, signal, axios, cheerio }); }; -export const world4uGetPostsSearch = async function ({ +export const getSearchPosts = async function ({ searchQuery, page, // providerValue, @@ -32,10 +32,10 @@ export const world4uGetPostsSearch = async function ({ signal: AbortSignal; providerContext: ProviderContext; }): Promise { - const {getBaseUrl, axios, cheerio} = providerContext; - const baseUrl = await getBaseUrl('w4u'); + const { getBaseUrl, axios, cheerio } = providerContext; + const baseUrl = await getBaseUrl("w4u"); const url = `${baseUrl}/page/${page}/?s=${searchQuery}`; - return posts({url, signal, axios, cheerio}); + return posts({ url, signal, axios, cheerio }); }; async function posts({ @@ -46,25 +46,25 @@ async function posts({ }: { url: string; signal: AbortSignal; - axios: ProviderContext['axios']; - cheerio: ProviderContext['cheerio']; + axios: ProviderContext["axios"]; + cheerio: ProviderContext["cheerio"]; }): Promise { try { - const res = await axios.get(url, {signal}); + const res = await axios.get(url, { signal }); const data = res.data; const $ = cheerio.load(data); const catalog: Post[] = []; - $('.recent-posts') + $(".recent-posts") .children() .map((i, element) => { - const title = $(element).find('.post-thumb').find('a').attr('title'); - const link = $(element).find('.post-thumb').find('a').attr('href'); + const title = $(element).find(".post-thumb").find("a").attr("title"); + const link = $(element).find(".post-thumb").find("a").attr("href"); const image = - $(element).find('.post-thumb').find('img').attr('data-src') || - $(element).find('.post-thumb').find('img').attr('src'); + $(element).find(".post-thumb").find("img").attr("data-src") || + $(element).find(".post-thumb").find("img").attr("src"); if (title && link && image) { catalog.push({ - title: title.replace('Download', '').trim(), + title: title.replace("Download", "").trim(), link: link, image: image, }); diff --git a/providers/world4u/world4uGetStream.ts b/providers/world4u/stream.ts similarity index 52% rename from providers/world4u/world4uGetStream.ts rename to providers/world4u/stream.ts index 237fae5..27e467c 100644 --- a/providers/world4u/world4uGetStream.ts +++ b/providers/world4u/stream.ts @@ -1,6 +1,6 @@ -import {Stream, ProviderContext} from '../types'; +import { Stream, ProviderContext } from "../types"; -export const world4uGetStream = async function ({ +export const getStream = async function ({ link: url, type, providerContext, @@ -9,43 +9,43 @@ export const world4uGetStream = async function ({ type: string; providerContext: ProviderContext; }): Promise { - const {axios, cheerio} = providerContext; + const { axios, cheerio } = providerContext; const headers = { - 'sec-ch-ua': + "sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"', - 'sec-ch-ua-mobile': '?0', - 'sec-ch-ua-platform': '"Windows"', - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-User': '?1', - 'Upgrade-Insecure-Requests': '1', - 'User-Agent': - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0', + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": '"Windows"', + "Sec-Fetch-Site": "none", + "Sec-Fetch-User": "?1", + "Upgrade-Insecure-Requests": "1", + "User-Agent": + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0", }; try { - if (type === 'movie') { - const linkRes = await axios.get(url, {headers}); + if (type === "movie") { + const linkRes = await axios.get(url, { headers }); const linkData = linkRes.data; const $ = cheerio.load(linkData); - url = $('strong:contains("INSTANT")').parent().attr('href') || url; + url = $('strong:contains("INSTANT")').parent().attr("href") || url; } // fastilinks - if (url.includes('fastilinks')) { - const fastilinksRes = await axios.get(url, {headers}); + if (url.includes("fastilinks")) { + const fastilinksRes = await axios.get(url, { headers }); const fastilinksData = fastilinksRes.data; const $$ = cheerio.load(fastilinksData); const fastilinksKey = $$( - 'input[name="_csrf_token_645a83a41868941e4692aa31e7235f2"]', - ).attr('value'); - console.log('fastilinksKey', fastilinksKey); + 'input[name="_csrf_token_645a83a41868941e4692aa31e7235f2"]' + ).attr("value"); + console.log("fastilinksKey", fastilinksKey); const fastilinksFormData = new FormData(); fastilinksFormData.append( - '_csrf_token_645a83a41868941e4692aa31e7235f2', - fastilinksKey, + "_csrf_token_645a83a41868941e4692aa31e7235f2", + fastilinksKey || "" ); const fastilinksRes2 = await fetch(url, { - method: 'POST', + method: "POST", headers: headers, body: fastilinksFormData, }); @@ -53,92 +53,92 @@ export const world4uGetStream = async function ({ // console.log('fastilinksHtml', fastilinksHtml); const $$$ = cheerio.load(fastilinksHtml); const fastilinksLink = - $$$('a:contains("mediafire")').attr('href') || - $$$('a:contains("photolinx")').attr('href'); - console.log('fastilinksLink', fastilinksLink); + $$$('a:contains("mediafire")').attr("href") || + $$$('a:contains("photolinx")').attr("href"); + console.log("fastilinksLink", fastilinksLink); url = fastilinksLink || url; } - console.log('world4uGetStream', type, url); + console.log("world4uGetStream", type, url); - if (url.includes('photolinx')) { - console.log('photolinx', url); + if (url.includes("photolinx")) { + console.log("photolinx", url); // const photolinxBaseUrl = url.split('/').slice(0, 3).join('/'); - const photolinxRes = await axios.get(url, {headers}); + const photolinxRes = await axios.get(url, { headers }); const photolinxData = photolinxRes.data; const $$$ = cheerio.load(photolinxData); - const access_token = $$$('#generate_url').attr('data-token'); - const uid = $$$('#generate_url').attr('data-uid'); + const access_token = $$$("#generate_url").attr("data-token"); + const uid = $$$("#generate_url").attr("data-uid"); const body = { - type: 'DOWNLOAD_GENERATE', + type: "DOWNLOAD_GENERATE", payload: { access_token, uid, }, }; - console.log('photolinxData', JSON.stringify(body)); + console.log("photolinxData", JSON.stringify(body)); - const photolinxRes2 = await fetch('https://photolinx.shop/action', { + const photolinxRes2 = await fetch("https://photolinx.shop/action", { headers: { - 'sec-fetch-site': 'same-origin', - 'x-requested-with': 'xmlhttprequest', - cookie: 'PHPSESSID=9a8d855c700cf0711831c04960c2e2b4', - Referer: 'https://photolinx.shop/download/5mPkrBD0D2x', - 'Referrer-Policy': 'strict-origin-when-cross-origin', + "sec-fetch-site": "same-origin", + "x-requested-with": "xmlhttprequest", + cookie: "PHPSESSID=9a8d855c700cf0711831c04960c2e2b4", + Referer: "https://photolinx.shop/download/5mPkrBD0D2x", + "Referrer-Policy": "strict-origin-when-cross-origin", }, body: JSON.stringify(body), - method: 'POST', + method: "POST", }); const photolinxData2 = await photolinxRes2.json(); - console.log('photolinxData2', photolinxData2); + console.log("photolinxData2", photolinxData2); const dwUrl = photolinxData2?.download_url; if (dwUrl) { const streamLinks = [ { - server: 'Photolinx', + server: "Photolinx", link: dwUrl, - type: 'mkv', + type: "mkv", }, ]; return streamLinks; } } - const res = await axios.get(url, {headers}); + const res = await axios.get(url, { headers }); const html = res.data; const streamLinks: Stream[] = []; - let data = {download: ''}; + let data = { download: "" }; try { const key = - html.match(/formData\.append\('key',\s*'(\d+)'\);/)?.[1] || ''; - console.log('key', key); + html.match(/formData\.append\('key',\s*'(\d+)'\);/)?.[1] || ""; + console.log("key", key); const formData = new FormData(); - formData.append('key', key); + formData.append("key", key); const streamRes = await fetch(url, { - method: 'POST', + method: "POST", headers: headers, body: formData, }); data = await streamRes.json(); } catch (err) { - console.log('error in world4uGetStream', err); + console.log("error in world4uGetStream", err); } // console.log('streamRes', streamRes); let $ = cheerio.load(html); // console.log('data', html); const mediafireUrl = - $('h1:contains("Download")').find('a').attr('href') || - $('.input.popsok').attr('href'); - console.log('mediafireUrl', mediafireUrl); + $('h1:contains("Download")').find("a").attr("href") || + $(".input.popsok").attr("href"); + console.log("mediafireUrl", mediafireUrl); if (mediafireUrl) { const directUrl = await axios.head(mediafireUrl); - const urlContentType = directUrl.headers['content-type']; - console.log('mfcontentType', urlContentType); - if (urlContentType && urlContentType.includes('video')) { + const urlContentType = directUrl.headers["content-type"]; + console.log("mfcontentType", urlContentType); + if (urlContentType && urlContentType.includes("video")) { streamLinks.push({ - server: 'Mediafire', + server: "Mediafire", link: mediafireUrl, - type: 'mkv', + type: "mkv", }); return streamLinks; } else { @@ -155,13 +155,13 @@ export const world4uGetStream = async function ({ // If a match is found, return the URL; otherwise return null let downloadLInk = match ? match[1] : null; - console.log('downloadLInk', downloadLInk); + console.log("downloadLInk", downloadLInk); if (downloadLInk) { streamLinks.push({ - server: 'Mediafire', + server: "Mediafire", link: downloadLInk, - type: 'mkv', + type: "mkv", }); } return streamLinks; @@ -169,13 +169,13 @@ export const world4uGetStream = async function ({ } const requireRepairRes = await axios.head(data.download); - const contentType = requireRepairRes.headers['content-type']; - console.log('contentType', contentType); - if (contentType && contentType.includes('video')) { + const contentType = requireRepairRes.headers["content-type"]; + console.log("contentType", contentType); + if (contentType && contentType.includes("video")) { streamLinks.push({ - server: 'Mediafire', + server: "Mediafire", link: data.download, - type: 'mkv', + type: "mkv", }); return streamLinks; } else { @@ -186,19 +186,19 @@ export const world4uGetStream = async function ({ }); const repairHtml = repairRes.data; const $ = cheerio.load(repairHtml); - const repairLink = $('#continue-btn').attr('href'); - console.log('repairLink', 'https://www.mediafire.com' + repairLink); + const repairLink = $("#continue-btn").attr("href"); + console.log("repairLink", "https://www.mediafire.com" + repairLink); const repairRequireRepairRes = await axios.get( - 'https://www.mediafire.com' + repairLink, + "https://www.mediafire.com" + repairLink ); const $$ = cheerio.load(repairRequireRepairRes.data); - const repairDownloadLink = $$('.input.popsok').attr('href'); - console.log('repairDownloadLink', repairDownloadLink); + const repairDownloadLink = $$(".input.popsok").attr("href"); + console.log("repairDownloadLink", repairDownloadLink); if (repairDownloadLink) { streamLinks.push({ - server: 'Mediafire', + server: "Mediafire", link: repairDownloadLink, - type: 'mkv', + type: "mkv", }); } }