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:
128
dist/hdhub4u/meta.js
vendored
128
dist/hdhub4u/meta.js
vendored
@@ -1 +1,127 @@
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(a,o){function r(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,s)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const hdbHeaders={Cookie:"xla=s4t",Referer:"https://google.com","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"},getMeta=function(t){return __awaiter(this,arguments,void 0,function*({link:t,providerContext:e}){var n;try{const{axios:i,cheerio:a}=e,o=t,r=(yield i.get(o,{headers:hdbHeaders})).data,s=a.load(r),c=s(".page-body"),d=(null===(n=c.find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])').attr("href"))||void 0===n?void 0:n.split("/")[4])||"",l=c.find('h2[data-ved="2ahUKEwjL0NrBk4vnAhWlH7cAHRCeAlwQ3B0oATAfegQIFBAM"],h2[data-ved="2ahUKEwiP0pGdlermAhUFYVAKHV8tAmgQ3B0oATAZegQIDhAM"]').text(),p=l.toLocaleLowerCase().includes("season")?"series":"movie",h=c.find('strong:contains("DESCRIPTION")').parent().text().replace("DESCRIPTION:",""),f=c.find('img[decoding="async"]').attr("src")||"",u=[],g=[];return s('strong:contains("EPiSODE")').map((t,e)=>{const n=s(e).parent().parent().text(),i=s(e).parent().parent().parent().next().next().find("a").attr("href")||s(e).parent().parent().parent().next().find("a").attr("href");i&&i&&g.push({title:n,link:i})}),0===g.length&&c.find('a:contains("EPiSODE")').map((t,e)=>{const n=s(e).text(),i=s(e).attr("href");i&&g.push({title:n.toLocaleUpperCase(),link:i})}),g.length>0&&u.push({title:l,directLinks:g}),0===g.length&&c.find('a:contains("480"),a:contains("720"),a:contains("1080"),a:contains("2160"),a:contains("4K")').map((t,e)=>{var n;const i=(null===(n=s(e).text().match(/\b(480p|720p|1080p|2160p)\b/i))||void 0===n?void 0:n[0])||"",a=s(e).attr("href"),o=s(e).text();a&&u.push({directLinks:[{link:a,title:"Movie",type:"movie"}],quality:i,title:o})}),{title:l,synopsis:h,image:f,imdbId:d,type:p,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 hdbHeaders = {
|
||||
Cookie: "xla=s4t",
|
||||
Referer: "https://google.com",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.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, { headers: hdbHeaders });
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const container = $(".page-body");
|
||||
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('h2[data-ved="2ahUKEwjL0NrBk4vnAhWlH7cAHRCeAlwQ3B0oATAfegQIFBAM"],h2[data-ved="2ahUKEwiP0pGdlermAhUFYVAKHV8tAmgQ3B0oATAZegQIDhAM"]')
|
||||
.text();
|
||||
const type = title.toLocaleLowerCase().includes("season")
|
||||
? "series"
|
||||
: "movie";
|
||||
const synopsis = container
|
||||
.find('strong:contains("DESCRIPTION")')
|
||||
.parent()
|
||||
.text()
|
||||
.replace("DESCRIPTION:", "");
|
||||
const image = container.find('img[decoding="async"]').attr("src") || "";
|
||||
// Links
|
||||
const links = [];
|
||||
const directLink = [];
|
||||
// direct link type
|
||||
$('strong:contains("EPiSODE")').map((i, element) => {
|
||||
const epTitle = $(element).parent().parent().text();
|
||||
const episodesLink = $(element)
|
||||
.parent()
|
||||
.parent()
|
||||
.parent()
|
||||
.next()
|
||||
.next()
|
||||
.find("a")
|
||||
.attr("href") ||
|
||||
$(element).parent().parent().parent().next().find("a").attr("href");
|
||||
if (episodesLink && episodesLink) {
|
||||
directLink.push({
|
||||
title: epTitle,
|
||||
link: episodesLink,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (directLink.length === 0) {
|
||||
container.find('a:contains("EPiSODE")').map((i, element) => {
|
||||
const epTitle = $(element).text();
|
||||
const episodesLink = $(element).attr("href");
|
||||
if (episodesLink) {
|
||||
directLink.push({
|
||||
title: epTitle.toLocaleUpperCase(),
|
||||
link: episodesLink,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
if (directLink.length > 0) {
|
||||
links.push({
|
||||
title: title,
|
||||
directLinks: directLink,
|
||||
});
|
||||
}
|
||||
if (directLink.length === 0) {
|
||||
container
|
||||
.find('a:contains("480"),a:contains("720"),a:contains("1080"),a:contains("2160"),a:contains("4K")')
|
||||
.map((i, element) => {
|
||||
var _a;
|
||||
const quality = ((_a = $(element)
|
||||
.text()
|
||||
.match(/\b(480p|720p|1080p|2160p)\b/i)) === null || _a === void 0 ? void 0 : _a[0]) || "";
|
||||
const movieLinks = $(element).attr("href");
|
||||
const title = $(element).text();
|
||||
if (movieLinks) {
|
||||
links.push({
|
||||
directLinks: [
|
||||
{ link: movieLinks, title: "Movie", type: "movie" },
|
||||
],
|
||||
quality: quality,
|
||||
title: title,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 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