mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
renaming
This commit is contained in:
12
providers/guardahd/catalog.ts
Normal file
12
providers/guardahd/catalog.ts
Normal file
@@ -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 = [];
|
||||
@@ -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 = [];
|
||||
@@ -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<Post[]> {
|
||||
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 [];
|
||||
}
|
||||
};
|
||||
@@ -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,
|
||||
};
|
||||
91
providers/guardahd/meta.ts
Normal file
91
providers/guardahd/meta.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import { EpisodeLink, Info, Link, ProviderContext } from "../types";
|
||||
|
||||
export const getMeta = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
link: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Info> {
|
||||
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: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
85
providers/guardahd/posts.ts
Normal file
85
providers/guardahd/posts.ts
Normal file
@@ -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<Post[]> {
|
||||
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<Post[]> {
|
||||
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 [];
|
||||
}
|
||||
};
|
||||
@@ -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<Stream[]> {
|
||||
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",
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user