mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
build
This commit is contained in:
150
dist/hubcloudExtractor.js
vendored
150
dist/hubcloudExtractor.js
vendored
@@ -32,6 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
@@ -46,75 +55,78 @@ const decode = function (value) {
|
||||
}
|
||||
return atob(value.toString());
|
||||
};
|
||||
async function hubcloudExtracter(link, signal) {
|
||||
try {
|
||||
console.log('hubcloudExtracter', link);
|
||||
const baseUrl = link.split('/').slice(0, 3).join('/');
|
||||
const streamLinks = [];
|
||||
const vLinkRes = await (0, axios_1.default)(`${link}`, { headers: headers_1.headers, signal });
|
||||
const vLinkText = vLinkRes.data;
|
||||
const $vLink = cheerio.load(vLinkText);
|
||||
const vLinkRedirect = vLinkText.match(/var\s+url\s*=\s*'([^']+)';/) || [];
|
||||
let vcloudLink = decode(vLinkRedirect[1]?.split('r=')?.[1]) ||
|
||||
vLinkRedirect[1] ||
|
||||
$vLink('.fa-file-download.fa-lg').parent().attr('href') ||
|
||||
link;
|
||||
console.log('vcloudLink', vcloudLink);
|
||||
if (vcloudLink?.startsWith('/')) {
|
||||
vcloudLink = `${baseUrl}${vcloudLink}`;
|
||||
console.log('New vcloudLink', vcloudLink);
|
||||
function hubcloudExtracter(link, signal) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
var _a, _b, _c, _d, _e;
|
||||
try {
|
||||
console.log('hubcloudExtracter', link);
|
||||
const baseUrl = link.split('/').slice(0, 3).join('/');
|
||||
const streamLinks = [];
|
||||
const vLinkRes = yield (0, axios_1.default)(`${link}`, { headers: headers_1.headers, signal });
|
||||
const vLinkText = vLinkRes.data;
|
||||
const $vLink = cheerio.load(vLinkText);
|
||||
const vLinkRedirect = vLinkText.match(/var\s+url\s*=\s*'([^']+)';/) || [];
|
||||
let vcloudLink = decode((_b = (_a = vLinkRedirect[1]) === null || _a === void 0 ? void 0 : _a.split('r=')) === null || _b === void 0 ? void 0 : _b[1]) ||
|
||||
vLinkRedirect[1] ||
|
||||
$vLink('.fa-file-download.fa-lg').parent().attr('href') ||
|
||||
link;
|
||||
console.log('vcloudLink', vcloudLink);
|
||||
if (vcloudLink === null || vcloudLink === void 0 ? void 0 : vcloudLink.startsWith('/')) {
|
||||
vcloudLink = `${baseUrl}${vcloudLink}`;
|
||||
console.log('New vcloudLink', vcloudLink);
|
||||
}
|
||||
const vcloudRes = yield fetch(vcloudLink, {
|
||||
headers: headers_1.headers,
|
||||
signal,
|
||||
redirect: 'follow',
|
||||
});
|
||||
const $ = cheerio.load(yield vcloudRes.text());
|
||||
// console.log('vcloudRes', $.text());
|
||||
const linkClass = $('.btn-success.btn-lg.h6,.btn-danger,.btn-secondary');
|
||||
for (const element of linkClass) {
|
||||
const itm = $(element);
|
||||
let link = itm.attr('href') || '';
|
||||
if ((link === null || link === void 0 ? void 0 : link.includes('.dev')) && !(link === null || link === void 0 ? void 0 : link.includes('/?id='))) {
|
||||
streamLinks.push({ server: 'Cf Worker', link: link, type: 'mkv' });
|
||||
}
|
||||
if (link === null || link === void 0 ? void 0 : link.includes('pixeld')) {
|
||||
if (!(link === null || link === void 0 ? void 0 : link.includes('api'))) {
|
||||
const token = link.split('/').pop();
|
||||
const baseUrl = link.split('/').slice(0, -2).join('/');
|
||||
link = `${baseUrl}/api/file/${token}?download`;
|
||||
}
|
||||
streamLinks.push({ server: 'Pixeldrain', link: link, type: 'mkv' });
|
||||
}
|
||||
if ((link === null || link === void 0 ? void 0 : link.includes('hubcloud')) || (link === null || link === void 0 ? void 0 : link.includes('/?id='))) {
|
||||
try {
|
||||
const newLinkRes = yield axios_1.default.head(link, { headers: headers_1.headers, signal });
|
||||
const newLink = ((_e = (_d = (_c = newLinkRes.request) === null || _c === void 0 ? void 0 : _c.responseURL) === null || _d === void 0 ? void 0 : _d.split('link=')) === null || _e === void 0 ? void 0 : _e[1]) || link;
|
||||
streamLinks.push({ server: 'hubcloud', link: newLink, type: 'mkv' });
|
||||
}
|
||||
catch (error) {
|
||||
console.log('hubcloudExtracter error in hubcloud link: ', error);
|
||||
}
|
||||
}
|
||||
if (link === null || link === void 0 ? void 0 : link.includes('cloudflarestorage')) {
|
||||
streamLinks.push({ server: 'CfStorage', link: link, type: 'mkv' });
|
||||
}
|
||||
if (link === null || link === void 0 ? void 0 : link.includes('fastdl')) {
|
||||
streamLinks.push({ server: 'FastDl', link: link, type: 'mkv' });
|
||||
}
|
||||
if (link.includes('hubcdn')) {
|
||||
streamLinks.push({
|
||||
server: 'HubCdn',
|
||||
link: link,
|
||||
type: 'mkv',
|
||||
});
|
||||
}
|
||||
}
|
||||
console.log('streamLinks', streamLinks);
|
||||
return streamLinks;
|
||||
}
|
||||
const vcloudRes = await fetch(vcloudLink, {
|
||||
headers: headers_1.headers,
|
||||
signal,
|
||||
redirect: 'follow',
|
||||
});
|
||||
const $ = cheerio.load(await vcloudRes.text());
|
||||
// console.log('vcloudRes', $.text());
|
||||
const linkClass = $('.btn-success.btn-lg.h6,.btn-danger,.btn-secondary');
|
||||
for (const element of linkClass) {
|
||||
const itm = $(element);
|
||||
let link = itm.attr('href') || '';
|
||||
if (link?.includes('.dev') && !link?.includes('/?id=')) {
|
||||
streamLinks.push({ server: 'Cf Worker', link: link, type: 'mkv' });
|
||||
}
|
||||
if (link?.includes('pixeld')) {
|
||||
if (!link?.includes('api')) {
|
||||
const token = link.split('/').pop();
|
||||
const baseUrl = link.split('/').slice(0, -2).join('/');
|
||||
link = `${baseUrl}/api/file/${token}?download`;
|
||||
}
|
||||
streamLinks.push({ server: 'Pixeldrain', link: link, type: 'mkv' });
|
||||
}
|
||||
if (link?.includes('hubcloud') || link?.includes('/?id=')) {
|
||||
try {
|
||||
const newLinkRes = await axios_1.default.head(link, { headers: headers_1.headers, signal });
|
||||
const newLink = newLinkRes.request?.responseURL?.split('link=')?.[1] || link;
|
||||
streamLinks.push({ server: 'hubcloud', link: newLink, type: 'mkv' });
|
||||
}
|
||||
catch (error) {
|
||||
console.log('hubcloudExtracter error in hubcloud link: ', error);
|
||||
}
|
||||
}
|
||||
if (link?.includes('cloudflarestorage')) {
|
||||
streamLinks.push({ server: 'CfStorage', link: link, type: 'mkv' });
|
||||
}
|
||||
if (link?.includes('fastdl')) {
|
||||
streamLinks.push({ server: 'FastDl', link: link, type: 'mkv' });
|
||||
}
|
||||
if (link.includes('hubcdn')) {
|
||||
streamLinks.push({
|
||||
server: 'HubCdn',
|
||||
link: link,
|
||||
type: 'mkv',
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
console.log('hubcloudExtracter error: ', error);
|
||||
return [];
|
||||
}
|
||||
console.log('streamLinks', streamLinks);
|
||||
return streamLinks;
|
||||
}
|
||||
catch (error) {
|
||||
console.log('hubcloudExtracter error: ', error);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user