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:
129
dist/katmovies/meta.js
vendored
129
dist/katmovies/meta.js
vendored
@@ -1 +1,128 @@
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(o,a){function r(t){try{d(n.next(t))}catch(t){a(t)}}function s(t){try{d(n.throw(t))}catch(t){a(t)}}function d(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,s)}d((n=n.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const getMeta=function(t){return __awaiter(this,arguments,void 0,function*({link:t,providerContext:e}){var i;try{const{axios:n,cheerio:o}=e,a=t,r=(yield n.get(a)).data,s=o.load(r),d=s(".yQ8hqd.ksSzJd.LoQAYe").html()?s(".yQ8hqd.ksSzJd.LoQAYe"):s(".FxvUNb"),c=(null===(i=d.find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])').attr("href"))||void 0===i?void 0:i.split("/")[4])||"",l=d.find('li:contains("Name")').children().remove().end().text(),h=s(".yQ8hqd.ksSzJd.LoQAYe").html()?"series":"movie",p=d.find('li:contains("Stars")').text(),f=s('h4:contains("SCREENSHOTS")').next().find("img").attr("src")||"",u=[],v=[];return s(".entry-content").find('p:contains("Episode")').each((e,i)=>{const n=s(i).nextAll("h3,h2").first().find('a:contains("1080"),a:contains("720"),a:contains("480")').attr("href")||"",o=s(i).find("span").text();t.trim().length>0&&o.includes("Episode ")&&v.push({title:o,link:n})}),v.length>0&&u.push({quality:"",title:l,directLinks:v}),s(".entry-content").find("pre").nextUntil("div").filter("h2").each((t,e)=>{var i;const n=s(e).find("a").attr("href"),o=(null===(i=s(e).text().match(/\b(480p|720p|1080p|2160p)\b/i))||void 0===i?void 0:i[0])||"",a=s(e).text();n&&a.includes("")&&u.push({quality:o,title:a,episodesLink:n})}),0===u.length&&"movie"===h&&s(".entry-content").find('h2:contains("DOWNLOAD"),h3:contains("DOWNLOAD")').nextUntil("pre,div").filter("h2").each((t,e)=>{var i;const n=s(e).find("a").attr("href"),o=(null===(i=s(e).text().match(/\b(480p|720p|1080p|2160p)\b/i))||void 0===i?void 0:i[0])||"",a=s(e).text();n&&!a.includes("Online")&&u.push({quality:o,title:a,directLinks:[{link:n,title:a,type:"movie"}]})}),{title:l,synopsis:p,image:f,imdbId:c,type:h,linkList:u}}catch(t){return{title:"",synopsis:"",image:"",imdbId:"",type:"movie",linkList:[]}}})};exports.getMeta=getMeta;
|
||||
"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.getMeta = void 0;
|
||||
const getMeta = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ link, providerContext, }) {
|
||||
var _b;
|
||||
try {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const url = link;
|
||||
const res = yield axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const container = $(".yQ8hqd.ksSzJd.LoQAYe").html()
|
||||
? $(".yQ8hqd.ksSzJd.LoQAYe")
|
||||
: $(".FxvUNb");
|
||||
const imdbId = ((_b = container
|
||||
.find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])')
|
||||
.attr("href")) === null || _b === void 0 ? void 0 : _b.split("/")[4]) || "";
|
||||
const title = container
|
||||
.find('li:contains("Name")')
|
||||
.children()
|
||||
.remove()
|
||||
.end()
|
||||
.text();
|
||||
const type = $(".yQ8hqd.ksSzJd.LoQAYe").html() ? "series" : "movie";
|
||||
const synopsis = container.find('li:contains("Stars")').text();
|
||||
const image = $('h4:contains("SCREENSHOTS")').next().find("img").attr("src") || "";
|
||||
console.log("katGetInfo", title, synopsis, image, imdbId, type);
|
||||
// Links
|
||||
const links = [];
|
||||
const directLink = [];
|
||||
// direct links
|
||||
$(".entry-content")
|
||||
.find('p:contains("Episode")')
|
||||
.each((i, element) => {
|
||||
const dlLink = $(element)
|
||||
.nextAll("h3,h2")
|
||||
.first()
|
||||
.find('a:contains("1080"),a:contains("720"),a:contains("480")')
|
||||
.attr("href") || "";
|
||||
const dlTitle = $(element).find("span").text();
|
||||
if (link.trim().length > 0 && dlTitle.includes("Episode ")) {
|
||||
directLink.push({
|
||||
title: dlTitle,
|
||||
link: dlLink,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (directLink.length > 0) {
|
||||
links.push({
|
||||
quality: "",
|
||||
title: title,
|
||||
directLinks: directLink,
|
||||
});
|
||||
}
|
||||
$(".entry-content")
|
||||
.find("pre")
|
||||
.nextUntil("div")
|
||||
.filter("h2")
|
||||
.each((i, element) => {
|
||||
var _a;
|
||||
const link = $(element).find("a").attr("href");
|
||||
const quality = ((_a = $(element)
|
||||
.text()
|
||||
.match(/\b(480p|720p|1080p|2160p)\b/i)) === null || _a === void 0 ? void 0 : _a[0]) || "";
|
||||
const title = $(element).text();
|
||||
if (link && title.includes("")) {
|
||||
links.push({
|
||||
quality,
|
||||
title,
|
||||
episodesLink: link,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (links.length === 0 && type === "movie") {
|
||||
$(".entry-content")
|
||||
.find('h2:contains("DOWNLOAD"),h3:contains("DOWNLOAD")')
|
||||
.nextUntil("pre,div")
|
||||
.filter("h2")
|
||||
.each((i, element) => {
|
||||
var _a;
|
||||
const link = $(element).find("a").attr("href");
|
||||
const quality = ((_a = $(element)
|
||||
.text()
|
||||
.match(/\b(480p|720p|1080p|2160p)\b/i)) === null || _a === void 0 ? void 0 : _a[0]) || "";
|
||||
const title = $(element).text();
|
||||
if (link && !title.includes("Online")) {
|
||||
links.push({
|
||||
quality,
|
||||
title,
|
||||
directLinks: [{ link, title, type: "movie" }],
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// console.log('drive meta', title, synopsis, image, imdbId, type, links);
|
||||
return {
|
||||
title,
|
||||
synopsis,
|
||||
image,
|
||||
imdbId,
|
||||
type,
|
||||
linkList: links,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getMeta = getMeta;
|
||||
|
||||
Reference in New Issue
Block a user