mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
unminify
This commit is contained in:
105
dist/katmovies/stream.js
vendored
105
dist/katmovies/stream.js
vendored
@@ -1 +1,104 @@
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))(function(n,a){function o(t){try{c(i.next(t))}catch(t){a(t)}}function s(t){try{c(i.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(o,s)}c((i=i.apply(t,e||[])).next())})};function extractKmhdLink(t,e){return __awaiter(this,void 0,void 0,function*(){const{axios:r}=e,i=(yield r.get(t)).data,n=i.match(/hubdrive_res:\s*"([^"]+)"/)[1];return i.match(/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/)[1]+n})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const getStream=function(t){return __awaiter(this,arguments,void 0,function*({link:t,signal:e,providerContext:r}){const{axios:i,cheerio:n,extractors:a}=r,{hubcloudExtracter:o,gdFlixExtracter:s}=a,c=[];try{if(t.includes("gdflix"))return yield s(t,e);if(t.includes("kmhd")){const i=yield extractKmhdLink(t,r);return yield o(i,e)}if(t.includes("gdflix")){try{const e=t.replace("/file","/zfile"),r=(yield i.get(e)).data,a=n.load(r)(".btn-success").attr("href");a&&c.push({server:"ResumeCloud",link:a,type:"mkv"})}catch(t){}try{const e=yield i.get(t,{timeout:1e4}),r=n.load(e.data)(".btn-danger").attr("href")||"",a=r.split("=")[1],o=new FormData;o.append("keys",a);const s=r.split("/").slice(0,3).join("/")+"/api",d=yield fetch(s,{method:"POST",body:o,headers:{"x-token":s}}),u=yield d.json();if(!1===u.error){const t=u.url;c.push({server:"Gdrive-Instant",link:t,type:"mkv"})}}catch(t){}return c}return yield o(t,e)}catch(t){return[]}})};exports.getStream=getStream;
|
||||
"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 = void 0;
|
||||
function extractKmhdLink(katlink, providerContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { axios } = providerContext;
|
||||
const res = yield axios.get(katlink);
|
||||
const data = res.data;
|
||||
const hubDriveRes = data.match(/hubdrive_res:\s*"([^"]+)"/)[1];
|
||||
const hubDriveLink = data.match(/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/)[1];
|
||||
return hubDriveLink + hubDriveRes;
|
||||
});
|
||||
}
|
||||
const getStream = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ link, signal, providerContext, }) {
|
||||
const { axios, cheerio, extractors } = providerContext;
|
||||
const { hubcloudExtracter, gdFlixExtracter } = extractors;
|
||||
const streamLinks = [];
|
||||
console.log("katGetStream", link);
|
||||
try {
|
||||
if (link.includes("gdflix")) {
|
||||
return yield gdFlixExtracter(link, signal);
|
||||
}
|
||||
if (link.includes("kmhd")) {
|
||||
const hubcloudLink = yield extractKmhdLink(link, providerContext);
|
||||
return yield hubcloudExtracter(hubcloudLink, signal);
|
||||
}
|
||||
if (link.includes("gdflix")) {
|
||||
// resume link
|
||||
try {
|
||||
const resumeDrive = link.replace("/file", "/zfile");
|
||||
// console.log('resumeDrive', resumeDrive);
|
||||
const resumeDriveRes = yield axios.get(resumeDrive);
|
||||
const resumeDriveHtml = resumeDriveRes.data;
|
||||
const $resumeDrive = cheerio.load(resumeDriveHtml);
|
||||
const resumeLink = $resumeDrive(".btn-success").attr("href");
|
||||
console.log("resumeLink", resumeLink);
|
||||
if (resumeLink) {
|
||||
streamLinks.push({
|
||||
server: "ResumeCloud",
|
||||
link: resumeLink,
|
||||
type: "mkv",
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Resume link not found");
|
||||
}
|
||||
//instant link
|
||||
try {
|
||||
const driveres = yield axios.get(link, { timeout: 10000 });
|
||||
const $drive = cheerio.load(driveres.data);
|
||||
const seed = $drive(".btn-danger").attr("href") || "";
|
||||
const instantToken = seed.split("=")[1];
|
||||
// console.log('InstantToken', instantToken);
|
||||
const InstantFromData = new FormData();
|
||||
InstantFromData.append("keys", instantToken);
|
||||
const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api";
|
||||
// console.log('videoSeedUrl', videoSeedUrl);
|
||||
const instantLinkRes = yield fetch(videoSeedUrl, {
|
||||
method: "POST",
|
||||
body: InstantFromData,
|
||||
headers: {
|
||||
"x-token": videoSeedUrl,
|
||||
},
|
||||
});
|
||||
const instantLinkData = yield instantLinkRes.json();
|
||||
console.log("instantLinkData", instantLinkData);
|
||||
if (instantLinkData.error === false) {
|
||||
const instantLink = instantLinkData.url;
|
||||
streamLinks.push({
|
||||
server: "Gdrive-Instant",
|
||||
link: instantLink,
|
||||
type: "mkv",
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log("Instant link not found", instantLinkData);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Instant link not found", err);
|
||||
}
|
||||
return streamLinks;
|
||||
}
|
||||
const stereams = yield hubcloudExtracter(link, signal);
|
||||
return stereams;
|
||||
}
|
||||
catch (error) {
|
||||
console.log("katgetStream error: ", error);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getStream = getStream;
|
||||
|
||||
Reference in New Issue
Block a user