This commit is contained in:
himanshu8443
2025-07-11 19:17:23 +05:30
parent 6ca69cf93b
commit 13f71510d5
139 changed files with 139 additions and 10578 deletions

View File

@@ -1,86 +1 @@
"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.getEpisodes = void 0;
exports.extractKmhdLink = extractKmhdLink;
const getEpisodes = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ url, providerContext, }) {
var _b;
const { axios, cheerio } = providerContext;
const episodesLink = [];
try {
if (url.includes("gdflix")) {
const baseUrl = (_b = url.split("/pack")) === null || _b === void 0 ? void 0 : _b[0];
const res = yield axios.get(url);
const data = res.data;
const $ = cheerio.load(data);
const links = $(".list-group-item");
links === null || links === void 0 ? void 0 : links.map((i, link) => {
episodesLink.push({
title: $(link).text() || "",
link: baseUrl + $(link).find("a").attr("href") || "",
});
});
if (episodesLink.length > 0) {
return episodesLink;
}
}
if (url.includes("/pack")) {
const epIds = yield extractKmhdEpisodes(url, providerContext);
epIds === null || epIds === void 0 ? void 0 : epIds.forEach((id, index) => {
episodesLink.push({
title: `Episode ${index + 1}`,
link: url.split("/pack")[0] + "/file/" + id,
});
});
}
const res = yield axios.get(url, {
headers: {
Cookie: "_ga_GNR438JY8N=GS1.1.1722240350.5.0.1722240350.0.0.0; _ga=GA1.1.372196696.1722150754; unlocked=true",
},
});
const episodeData = res.data;
const $ = cheerio.load(episodeData);
const links = $(".autohyperlink");
links === null || links === void 0 ? void 0 : links.map((i, link) => {
episodesLink.push({
title: $(link).parent().children().remove().end().text() || "",
link: $(link).attr("href") || "",
});
});
return episodesLink;
}
catch (err) {
console.error(err);
return [];
}
});
};
exports.getEpisodes = getEpisodes;
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;
});
}
function extractKmhdEpisodes(katlink, providerContext) {
return __awaiter(this, void 0, void 0, function* () {
const { axios } = providerContext;
const res = yield axios.get(katlink);
const data = res.data;
const ids = data.match(/[\w]+_[a-f0-9]{8}/g);
return ids;
});
}
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(r,o){function a(t){try{c(n.next(t))}catch(t){o(t)}}function s(t){try{c(n.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,s)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getEpisodes=void 0,exports.extractKmhdLink=extractKmhdLink;const getEpisodes=function(t){return __awaiter(this,arguments,void 0,function*({url:t,providerContext:e}){var i;const{axios:n,cheerio:r}=e,o=[];try{if(t.includes("gdflix")){const e=null===(i=t.split("/pack"))||void 0===i?void 0:i[0],a=(yield n.get(t)).data,s=r.load(a),c=s(".list-group-item");if(null==c||c.map((t,i)=>{o.push({title:s(i).text()||"",link:e+s(i).find("a").attr("href")||""})}),o.length>0)return o}if(t.includes("/pack")){const i=yield extractKmhdEpisodes(t,e);null==i||i.forEach((e,i)=>{o.push({title:`Episode ${i+1}`,link:t.split("/pack")[0]+"/file/"+e})})}const a=(yield n.get(t,{headers:{Cookie:"_ga_GNR438JY8N=GS1.1.1722240350.5.0.1722240350.0.0.0; _ga=GA1.1.372196696.1722150754; unlocked=true"}})).data,s=r.load(a),c=s(".autohyperlink");return null==c||c.map((t,e)=>{o.push({title:s(e).parent().children().remove().end().text()||"",link:s(e).attr("href")||""})}),o}catch(t){return[]}})};function extractKmhdLink(t,e){return __awaiter(this,void 0,void 0,function*(){const{axios:i}=e,n=(yield i.get(t)).data,r=n.match(/hubdrive_res:\s*"([^"]+)"/)[1];return n.match(/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/)[1]+r})}function extractKmhdEpisodes(t,e){return __awaiter(this,void 0,void 0,function*(){const{axios:i}=e;return(yield i.get(t)).data.match(/[\w]+_[a-f0-9]{8}/g)})}exports.getEpisodes=getEpisodes;