mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
minify again
This commit is contained in:
87
dist/katmovies/episodes.js
vendored
87
dist/katmovies/episodes.js
vendored
@@ -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(thisArg,_arguments,P,generator){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){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getEpisodes=void 0,exports.extractKmhdLink=extractKmhdLink;const getEpisodes=function(_a){return __awaiter(this,arguments,void 0,function*({url:url,providerContext:providerContext}){var _b;const{axios:axios,cheerio:cheerio}=providerContext,episodesLink=[];try{if(url.includes("gdflix")){const baseUrl=null===(_b=url.split("/pack"))||void 0===_b?void 0:_b[0],data=(yield axios.get(url)).data,$=cheerio.load(data),links=$(".list-group-item");if(null==links||links.map((i,link)=>{episodesLink.push({title:$(link).text()||"",link:baseUrl+$(link).find("a").attr("href")||""})}),episodesLink.length>0)return episodesLink}if(url.includes("/pack")){const epIds=yield extractKmhdEpisodes(url,providerContext);null==epIds||epIds.forEach((id,index)=>{episodesLink.push({title:`Episode ${index+1}`,link:url.split("/pack")[0]+"/file/"+id})})}const episodeData=(yield axios.get(url,{headers:{Cookie:"_ga_GNR438JY8N=GS1.1.1722240350.5.0.1722240350.0.0.0; _ga=GA1.1.372196696.1722150754; unlocked=true"}})).data,$=cheerio.load(episodeData),links=$(".autohyperlink");return null==links||links.map((i,link)=>{episodesLink.push({title:$(link).parent().children().remove().end().text()||"",link:$(link).attr("href")||""})}),episodesLink}catch(err){return[]}})};function extractKmhdLink(katlink,providerContext){return __awaiter(this,void 0,void 0,function*(){const{axios:axios}=providerContext,data=(yield axios.get(katlink)).data,hubDriveRes=data.match(/hubdrive_res:\s*"([^"]+)"/)[1];return data.match(/hubdrive_res\s*:\s*{[^}]*?link\s*:\s*"([^"]+)"/)[1]+hubDriveRes})}function extractKmhdEpisodes(katlink,providerContext){return __awaiter(this,void 0,void 0,function*(){const{axios:axios}=providerContext;return(yield axios.get(katlink)).data.match(/[\w]+_[a-f0-9]{8}/g)})}exports.getEpisodes=getEpisodes;
|
||||
Reference in New Issue
Block a user