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:
16
providers/showbox/catalog.ts
Normal file
16
providers/showbox/catalog.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export const catalog = [
|
||||
{
|
||||
title: "Home",
|
||||
filter: "",
|
||||
},
|
||||
{
|
||||
title: "Movies",
|
||||
filter: "/movie",
|
||||
},
|
||||
{
|
||||
title: "TV Shows",
|
||||
filter: "/tv",
|
||||
},
|
||||
];
|
||||
|
||||
export const genres = [];
|
||||
@@ -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<EpisodeLink[]> {
|
||||
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;
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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<Info> {
|
||||
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: [],
|
||||
};
|
||||
}
|
||||
@@ -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<Post[]> {
|
||||
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<Post[]> {
|
||||
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<Post[]> {
|
||||
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,
|
||||
@@ -1,16 +0,0 @@
|
||||
export const catalogList = [
|
||||
{
|
||||
title: 'Home',
|
||||
filter: '',
|
||||
},
|
||||
{
|
||||
title: 'Movies',
|
||||
filter: '/movie',
|
||||
},
|
||||
{
|
||||
title: 'TV Shows',
|
||||
filter: '/tv',
|
||||
},
|
||||
];
|
||||
|
||||
export const sbGenresList = [];
|
||||
@@ -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<Stream[]> {
|
||||
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 [];
|
||||
}
|
||||
};
|
||||
43
providers/showbox/stream.ts
Normal file
43
providers/showbox/stream.ts
Normal file
@@ -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<Stream[]> {
|
||||
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 [];
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user