mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
build
This commit is contained in:
133
dist/vega/stream.js
vendored
133
dist/vega/stream.js
vendored
@@ -1,4 +1,13 @@
|
||||
"use strict";
|
||||
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());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getStream = getStream;
|
||||
const headers = {
|
||||
@@ -17,49 +26,35 @@ const headers = {
|
||||
"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",
|
||||
};
|
||||
async function getStream({ link, type, signal, providerContext, }) {
|
||||
const { axios, cheerio, extractors } = providerContext;
|
||||
const { hubcloudExtracter } = extractors;
|
||||
try {
|
||||
const streamLinks = [];
|
||||
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(/<a\s+href="([^"]*cloud\.[^"]*)"/i) || [];
|
||||
// console.log('vLink', vlink[1]);
|
||||
link = vlink[1];
|
||||
// filepress link
|
||||
try {
|
||||
const $ = cheerio.load(dotlinkText);
|
||||
const filepressLink = $('.btn.btn-sm.btn-outline[style="background:linear-gradient(135deg,rgb(252,185,0) 0%,rgb(0,0,0)); color: #fdf8f2;"]')
|
||||
.parent()
|
||||
.attr("href");
|
||||
// console.log('filepressLink', filepressLink);
|
||||
const filepressID = filepressLink?.split("/").pop();
|
||||
const filepressBaseUrl = filepressLink
|
||||
?.split("/")
|
||||
.slice(0, -2)
|
||||
.join("/");
|
||||
// console.log('filepressID', filepressID);
|
||||
// console.log('filepressBaseUrl', filepressBaseUrl);
|
||||
const filepressTokenRes = await axios.post(filepressBaseUrl + "/api/file/downlaod/", {
|
||||
id: filepressID,
|
||||
method: "indexDownlaod",
|
||||
captchaValue: null,
|
||||
}, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: filepressBaseUrl,
|
||||
},
|
||||
});
|
||||
// console.log('filepressTokenRes', filepressTokenRes.data);
|
||||
if (filepressTokenRes.data?.status) {
|
||||
const filepressToken = filepressTokenRes.data?.data;
|
||||
const filepressStreamLink = await axios.post(filepressBaseUrl + "/api/file/downlaod2/", {
|
||||
id: filepressToken,
|
||||
function getStream(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ link, type, signal, providerContext, }) {
|
||||
var _b, _c, _d, _e;
|
||||
const { axios, cheerio, extractors } = providerContext;
|
||||
const { hubcloudExtracter } = extractors;
|
||||
try {
|
||||
const streamLinks = [];
|
||||
console.log("dotlink", link);
|
||||
if (type === "movie") {
|
||||
// vlink
|
||||
const dotlinkRes = yield axios(`${link}`, { headers });
|
||||
const dotlinkText = dotlinkRes.data;
|
||||
// console.log('dotlinkText', dotlinkText);
|
||||
const vlink = dotlinkText.match(/<a\s+href="([^"]*cloud\.[^"]*)"/i) || [];
|
||||
// console.log('vLink', vlink[1]);
|
||||
link = vlink[1];
|
||||
// filepress link
|
||||
try {
|
||||
const $ = cheerio.load(dotlinkText);
|
||||
const filepressLink = $('.btn.btn-sm.btn-outline[style="background:linear-gradient(135deg,rgb(252,185,0) 0%,rgb(0,0,0)); color: #fdf8f2;"]')
|
||||
.parent()
|
||||
.attr("href");
|
||||
// console.log('filepressLink', filepressLink);
|
||||
const filepressID = filepressLink === null || filepressLink === void 0 ? void 0 : filepressLink.split("/").pop();
|
||||
const filepressBaseUrl = filepressLink === null || filepressLink === void 0 ? void 0 : filepressLink.split("/").slice(0, -2).join("/");
|
||||
// console.log('filepressID', filepressID);
|
||||
// console.log('filepressBaseUrl', filepressBaseUrl);
|
||||
const filepressTokenRes = yield axios.post(filepressBaseUrl + "/api/file/downlaod/", {
|
||||
id: filepressID,
|
||||
method: "indexDownlaod",
|
||||
captchaValue: null,
|
||||
}, {
|
||||
@@ -68,27 +63,41 @@ async function getStream({ link, type, signal, providerContext, }) {
|
||||
Referer: filepressBaseUrl,
|
||||
},
|
||||
});
|
||||
// console.log('filepressStreamLink', filepressStreamLink.data);
|
||||
streamLinks.push({
|
||||
server: "filepress",
|
||||
link: filepressStreamLink.data?.data?.[0],
|
||||
type: "mkv",
|
||||
});
|
||||
// console.log('filepressTokenRes', filepressTokenRes.data);
|
||||
if ((_b = filepressTokenRes.data) === null || _b === void 0 ? void 0 : _b.status) {
|
||||
const filepressToken = (_c = filepressTokenRes.data) === null || _c === void 0 ? void 0 : _c.data;
|
||||
const filepressStreamLink = yield axios.post(filepressBaseUrl + "/api/file/downlaod2/", {
|
||||
id: filepressToken,
|
||||
method: "indexDownlaod",
|
||||
captchaValue: null,
|
||||
}, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: filepressBaseUrl,
|
||||
},
|
||||
});
|
||||
// console.log('filepressStreamLink', filepressStreamLink.data);
|
||||
streamLinks.push({
|
||||
server: "filepress",
|
||||
link: (_e = (_d = filepressStreamLink.data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e[0],
|
||||
type: "mkv",
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log("filepress error: ");
|
||||
// console.error(error);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.log("filepress error: ");
|
||||
// console.error(error);
|
||||
return yield hubcloudExtracter(link, signal);
|
||||
}
|
||||
catch (error) {
|
||||
console.log("getStream error: ", error);
|
||||
if (error.message.includes("Aborted")) {
|
||||
}
|
||||
else {
|
||||
}
|
||||
return [];
|
||||
}
|
||||
return await hubcloudExtracter(link, signal);
|
||||
}
|
||||
catch (error) {
|
||||
console.log("getStream error: ", error);
|
||||
if (error.message.includes("Aborted")) {
|
||||
}
|
||||
else {
|
||||
}
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user