mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
unminify
This commit is contained in:
122
dist/uhd/meta.js
vendored
122
dist/uhd/meta.js
vendored
@@ -1 +1,121 @@
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(a,o){function c(e){try{r(n.next(e))}catch(e){o(e)}}function s(e){try{r(n.throw(e))}catch(e){o(e)}}function r(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(c,s)}r((n=n.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const headers={Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Cache-Control":"no-store","Accept-Language":"en-US,en;q=0.9",DNT:"1","sec-ch-ua":'"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0"},getMeta=function(e){return __awaiter(this,arguments,void 0,function*({link:e,providerContext:t}){var i;try{const{axios:n,cheerio:a}=t,o=e,c=yield n.get(o,{headers:headers}),s=yield c.data,r=a.load(s),l=r("h2:first").text()||"",h=r("h2").siblings().find("img").attr("src")||"",d=[];return r(".mks_separator,p:contains('mks_separator')").each((e,t)=>{r(t).nextUntil(".mks_separator").each((e,t)=>{const i=r(t).text(),n=[];r(t).next("p").find("a").each((e,t)=>{const i=r(t).text(),a=r(t).attr("href");i&&a&&!i.toLocaleLowerCase().includes("zip")&&n.push({title:i,link:a})}),i&&n.length>0&&d.push({title:i,directLinks:n})})}),r("hr").each((e,t)=>{r(t).nextUntil("hr").each((e,t)=>{const i=r(t).text(),n=[];r(t).next("p").find("a").each((e,t)=>{const i=r(t).text(),a=r(t).attr("href");i&&a&&!i.toLocaleLowerCase().includes("zip")&&n.push({title:i,link:a})}),i&&n.length>0&&d.push({title:i,directLinks:n})})}),{title:l.match(/^Download\s+([^(\[]+)/i)?(null===(i=null==l?void 0:l.match(/^Download\s+([^(\[]+)/i))||void 0===i?void 0:i[1])||"":l.replace("Download","")||"",image:h,imdbId:"",synopsis:l,type:"",linkList:d}}catch(e){return{title:"",image:"",imdbId:"",synopsis:"",linkList:[],type:"uhd"}}})};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 headers = {
|
||||
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"Cache-Control": "no-store",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
DNT: "1",
|
||||
"sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"sec-ch-ua-platform": '"Windows"',
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0",
|
||||
};
|
||||
const getMeta = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ link, providerContext, }) {
|
||||
var _b;
|
||||
try {
|
||||
const { axios, cheerio } = providerContext;
|
||||
console.log("Fetching metadata from UHD...", link, providerContext);
|
||||
const url = link;
|
||||
const res = yield axios.get(url, { headers });
|
||||
const html = yield res.data;
|
||||
const $ = cheerio.load(html);
|
||||
const title = $("h2:first").text() || "";
|
||||
const image = $("h2").siblings().find("img").attr("src") || "";
|
||||
// const trailer = $('iframe').attr('src') || '';
|
||||
// console.log({ title, image, trailer });
|
||||
// Links
|
||||
const episodes = [];
|
||||
// new structure
|
||||
$(".mks_separator,p:contains('mks_separator')").each((index, element) => {
|
||||
$(element)
|
||||
.nextUntil(".mks_separator")
|
||||
.each((index, element) => {
|
||||
const title = $(element).text();
|
||||
const episodesList = [];
|
||||
$(element)
|
||||
.next("p")
|
||||
.find("a")
|
||||
.each((index, element) => {
|
||||
const title = $(element).text();
|
||||
const link = $(element).attr("href");
|
||||
if (title && link && !title.toLocaleLowerCase().includes("zip")) {
|
||||
episodesList.push({ title, link });
|
||||
// console.log({ title, link });
|
||||
}
|
||||
});
|
||||
if (title && episodesList.length > 0) {
|
||||
episodes.push({
|
||||
title,
|
||||
directLinks: episodesList,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
// old structure
|
||||
$("hr").each((index, element) => {
|
||||
$(element)
|
||||
.nextUntil("hr")
|
||||
.each((index, element) => {
|
||||
const title = $(element).text();
|
||||
const episodesList = [];
|
||||
$(element)
|
||||
.next("p")
|
||||
.find("a")
|
||||
.each((index, element) => {
|
||||
const title = $(element).text();
|
||||
const link = $(element).attr("href");
|
||||
if (title && link && !title.toLocaleLowerCase().includes("zip")) {
|
||||
episodesList.push({ title, link });
|
||||
// console.log({ title, link });
|
||||
}
|
||||
});
|
||||
if (title && episodesList.length > 0) {
|
||||
episodes.push({
|
||||
title,
|
||||
directLinks: episodesList,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
// console.log(episodes);
|
||||
return {
|
||||
title: title.match(/^Download\s+([^(\[]+)/i)
|
||||
? ((_b = title === null || title === void 0 ? void 0 : title.match(/^Download\s+([^(\[]+)/i)) === null || _b === void 0 ? void 0 : _b[1]) || ""
|
||||
: title.replace("Download", "") || "",
|
||||
image,
|
||||
imdbId: "",
|
||||
synopsis: title,
|
||||
type: "",
|
||||
linkList: episodes,
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
return {
|
||||
title: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
synopsis: "",
|
||||
linkList: [],
|
||||
type: "uhd",
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getMeta = getMeta;
|
||||
|
||||
Reference in New Issue
Block a user