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:
98
dist/4khdhub/meta.js
vendored
98
dist/4khdhub/meta.js
vendored
@@ -1 +1,97 @@
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(o,s){function r(t){try{d(n.next(t))}catch(t){s(t)}}function a(t){try{d(n.throw(t))}catch(t){s(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,a)}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}){try{const{axios:i,cheerio:n,getBaseUrl:o}=e,s=`${yield o("4khdhub")}${t}`,r=(yield i.get(s)).data,a=n.load(r),d=a(".season-content").length>0?"series":"movie",l="",c=a(".page-title").text()||"",f=a(".poster-image").find("img").attr("src")||"",p=a(".content-section").find("p").first().text().trim()||"",u=[];return"series"===d?a(".season-item").map((t,e)=>{const i=a(e).find(".episode-title").text();let n=[];a(e).find(".episode-download-item").map((t,e)=>{const i=a(e).find(".episode-file-info").text().trim().replace("\n"," "),o=a(e).find(".episode-links").find("a:contains('HubDrive')").attr("href");i&&o&&n.push({title:i,link:o})}),i&&n.length>0&&u.push({title:i,directLinks:n})}):a(".download-item").map((t,e)=>{const i=a(e).find(".flex-1.text-left.font-semibold").text().trim(),n=a(e).find(".grid.grid-cols-2.gap-2").find("a:contains('HubDrive')").attr("href");i&&n&&u.push({title:i,directLinks:[{title:i,link:n}]})}),{title:c,synopsis:p,image:f,imdbId:l,type:d,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, }) {
|
||||
try {
|
||||
const { axios, cheerio, getBaseUrl } = providerContext;
|
||||
const baseUrl = yield getBaseUrl("4khdhub");
|
||||
const url = `${baseUrl}${link}`;
|
||||
const res = yield axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const type = $(".season-content").length > 0 ? "series" : "movie";
|
||||
const imdbId = "";
|
||||
const title = $(".page-title").text() || "";
|
||||
const image = $(".poster-image").find("img").attr("src") || "";
|
||||
const synopsis = $(".content-section").find("p").first().text().trim() || "";
|
||||
// Links
|
||||
const links = [];
|
||||
if (type === "series") {
|
||||
$(".season-item").map((i, element) => {
|
||||
const title = $(element).find(".episode-title").text();
|
||||
let directLinks = [];
|
||||
$(element)
|
||||
.find(".episode-download-item")
|
||||
.map((i, element) => {
|
||||
const title = $(element)
|
||||
.find(".episode-file-info")
|
||||
.text()
|
||||
.trim()
|
||||
.replace("\n", " ");
|
||||
const link = $(element)
|
||||
.find(".episode-links")
|
||||
.find("a:contains('HubDrive')")
|
||||
.attr("href");
|
||||
console.log("title⭐", title, "link", link);
|
||||
if (title && link) {
|
||||
directLinks.push({ title, link });
|
||||
}
|
||||
});
|
||||
if (title && directLinks.length > 0) {
|
||||
links.push({
|
||||
title,
|
||||
directLinks: directLinks,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(".download-item").map((i, element) => {
|
||||
const title = $(element)
|
||||
.find(".flex-1.text-left.font-semibold")
|
||||
.text()
|
||||
.trim();
|
||||
const link = $(element)
|
||||
.find(".grid.grid-cols-2.gap-2")
|
||||
.find("a:contains('HubDrive')")
|
||||
.attr("href");
|
||||
// console.log("title⭐", title, "link", link);
|
||||
if (title && link) {
|
||||
links.push({ title, directLinks: [{ title, link }] });
|
||||
}
|
||||
});
|
||||
}
|
||||
// console.log('multi meta', 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