mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
init
This commit is contained in:
17
dist/showbox/index.js
vendored
Normal file
17
dist/showbox/index.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.showBox = void 0;
|
||||
const sbCatalog_1 = require("./sbCatalog");
|
||||
const sbGetEpisodeList_1 = require("./sbGetEpisodeList");
|
||||
const sbGetMeta_1 = require("./sbGetMeta");
|
||||
const sbGetPosts_1 = require("./sbGetPosts");
|
||||
const sbGetStream_1 = require("./sbGetStream");
|
||||
exports.showBox = {
|
||||
catalog: sbCatalog_1.catalogList,
|
||||
genres: sbCatalog_1.sbGenresList,
|
||||
GetMetaData: sbGetMeta_1.sbGetInfo,
|
||||
GetHomePosts: sbGetPosts_1.sbGetPosts,
|
||||
GetStream: sbGetStream_1.sbGetStream,
|
||||
GetSearchPosts: sbGetPosts_1.sbGetPostsSearch,
|
||||
GetEpisodeLinks: sbGetEpisodeList_1.sbGetEpisodeLinks,
|
||||
};
|
||||
18
dist/showbox/sbCatalog.js
vendored
Normal file
18
dist/showbox/sbCatalog.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sbGenresList = exports.catalogList = void 0;
|
||||
exports.catalogList = [
|
||||
{
|
||||
title: 'Home',
|
||||
filter: '',
|
||||
},
|
||||
{
|
||||
title: 'Movies',
|
||||
filter: '/movie',
|
||||
},
|
||||
{
|
||||
title: 'TV Shows',
|
||||
filter: '/tv',
|
||||
},
|
||||
];
|
||||
exports.sbGenresList = [];
|
||||
43
dist/showbox/sbGetEpisodeList.js
vendored
Normal file
43
dist/showbox/sbGetEpisodeList.js
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sbGetEpisodeLinks = void 0;
|
||||
const sbGetEpisodeLinks = async function ({ url: id, providerContext, }) {
|
||||
const { axios } = providerContext;
|
||||
try {
|
||||
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`;
|
||||
const res = await axios.get(febLink);
|
||||
const data = res.data;
|
||||
const fileList = data.data.file_list;
|
||||
const episodeLinks = [];
|
||||
fileList?.map((file) => {
|
||||
const fileName = formatEpisodeName(file.file_name);
|
||||
const epId = file?.fid;
|
||||
if (!file.is_dir && fileName && epId) {
|
||||
episodeLinks.push({
|
||||
title: fileName,
|
||||
link: `${fileId}&${epId}`,
|
||||
});
|
||||
}
|
||||
});
|
||||
return episodeLinks;
|
||||
}
|
||||
catch (err) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
exports.sbGetEpisodeLinks = sbGetEpisodeLinks;
|
||||
function formatEpisodeName(title) {
|
||||
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');
|
||||
return `Season${season} Episode${episode}`;
|
||||
}
|
||||
else {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
65
dist/showbox/sbGetMeta.js
vendored
Normal file
65
dist/showbox/sbGetMeta.js
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sbGetInfo = void 0;
|
||||
const sbGetInfo = async function ({ link, providerContext, }) {
|
||||
try {
|
||||
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 rating = $('.btn-imdb')
|
||||
.text()
|
||||
?.match(/\d+(\.\d+)?/g)?.[0] || '';
|
||||
const image = $('.cover_follow').attr('style')?.split('url(')[1]?.split(')')[0] || '';
|
||||
const synopsis = $('.description')
|
||||
.text()
|
||||
?.replaceAll(/[\n\t]/g, '')
|
||||
?.trim();
|
||||
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'}`;
|
||||
const indexRes = await axios.get(indexUrl);
|
||||
const indexData = indexRes.data;
|
||||
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;
|
||||
const fileList = febData?.data?.file_list;
|
||||
const links = [];
|
||||
if (fileList) {
|
||||
fileList.map((file) => {
|
||||
const fileName = `${file.file_name} (${file.file_size})`;
|
||||
const fileId = file.fid;
|
||||
links.push({
|
||||
title: fileName,
|
||||
episodesLink: file.is_dir ? `${febKey}&${fileId}` : `${febKey}&`,
|
||||
});
|
||||
});
|
||||
}
|
||||
return {
|
||||
title,
|
||||
rating,
|
||||
synopsis,
|
||||
image,
|
||||
imdbId,
|
||||
type,
|
||||
linkList: links,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
return {
|
||||
title: '',
|
||||
rating: '',
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: '',
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.sbGetInfo = sbGetInfo;
|
||||
47
dist/showbox/sbGetPosts.js
vendored
Normal file
47
dist/showbox/sbGetPosts.js
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sbGetPostsSearch = exports.sbGetPosts = void 0;
|
||||
const sbGetPosts = async function ({ filter, page,
|
||||
// providerValue,
|
||||
signal, providerContext, }) {
|
||||
const { getBaseUrl, axios, cheerio } = providerContext;
|
||||
const baseUrl = await getBaseUrl('showbox');
|
||||
const url = `${baseUrl + filter}?page=${page}/`;
|
||||
return posts({ url, signal, baseUrl, axios, cheerio });
|
||||
};
|
||||
exports.sbGetPosts = sbGetPosts;
|
||||
const sbGetPostsSearch = async function ({ searchQuery, page,
|
||||
// providerValue,
|
||||
signal, providerContext, }) {
|
||||
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 });
|
||||
};
|
||||
exports.sbGetPostsSearch = sbGetPostsSearch;
|
||||
async function posts({ url, signal,
|
||||
// baseUrl,
|
||||
axios, cheerio, }) {
|
||||
try {
|
||||
const res = await axios.get(url, { signal });
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const catalog = [];
|
||||
$('.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,
|
||||
link: link,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
return catalog;
|
||||
}
|
||||
catch (err) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
70
dist/showbox/sbGetStream.js
vendored
Normal file
70
dist/showbox/sbGetStream.js
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || (function () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sbGetStream = void 0;
|
||||
const cheerio = __importStar(require("cheerio"));
|
||||
const sbGetStream = async function ({ link: id,
|
||||
// type,
|
||||
signal, providerContext, }) {
|
||||
try {
|
||||
const { axios } = providerContext;
|
||||
const 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 [];
|
||||
}
|
||||
};
|
||||
exports.sbGetStream = sbGetStream;
|
||||
Reference in New Issue
Block a user