push
This commit is contained in:
1 parent
bcf05e8063
commit
f37985b4c8
109 files changed
+22810
-6143
No files matched your search
+490
-1
@@ -1 +1,490 @@
|
||||
const _0x242fc1=_0x35c1;(function(_0x3e594b,_0x19aec9){const _0x2b9eba={_0x4ee093:0x117,_0x57b392:0x10b,_0x2e0f2c:0x114},_0x33e261=_0x35c1,_0x165159=_0x3e594b();while(!![]){try{const _0x333e0c=parseInt(_0x33e261(_0x2b9eba._0x4ee093))/0x1+-parseInt(_0x33e261(0xf3))/0x2+-parseInt(_0x33e261(0xc3))/0x3*(parseInt(_0x33e261(0xea))/0x4)+parseInt(_0x33e261(0x122))/0x5*(parseInt(_0x33e261(_0x2b9eba._0x57b392))/0x6)+-parseInt(_0x33e261(_0x2b9eba._0x2e0f2c))/0x7+parseInt(_0x33e261(0xc5))/0x8*(parseInt(_0x33e261(0xc9))/0x9)+parseInt(_0x33e261(0xdd))/0xa;if(_0x333e0c===_0x19aec9)break;else _0x165159['push'](_0x165159['shift']());}catch(_0x4f1033){_0x165159['push'](_0x165159['shift']());}}}(_0x4846,0x1bbe8));var __create=Object[_0x242fc1(0x123)],__defProp=Object[_0x242fc1(0xf1)],__defProps=Object[_0x242fc1(0x107)],__getOwnPropDesc=Object['getOwnPropertyDescriptor'],__getOwnPropDescs=Object[_0x242fc1(0xd1)],__getOwnPropNames=Object['getOwnPropertyNames'],__getOwnPropSymbols=Object['getOwnPropertySymbols'],__getProtoOf=Object['getPrototypeOf'],__hasOwnProp=Object['prototype']['hasOwnProperty'],__propIsEnum=Object['prototype']['propertyIsEnumerable'],__defNormalProp=(_0x4e72ae,_0x3282fc,_0x221b73)=>_0x3282fc in _0x4e72ae?__defProp(_0x4e72ae,_0x3282fc,{'enumerable':!![],'configurable':!![],'writable':!![],'value':_0x221b73}):_0x4e72ae[_0x3282fc]=_0x221b73,__spreadValues=(_0x4d6a07,_0x5914a3)=>{const _0x22aeaf=_0x242fc1;for(var _0x32fca5 in _0x5914a3||(_0x5914a3={}))if(__hasOwnProp['call'](_0x5914a3,_0x32fca5))__defNormalProp(_0x4d6a07,_0x32fca5,_0x5914a3[_0x32fca5]);if(__getOwnPropSymbols)for(var _0x32fca5 of __getOwnPropSymbols(_0x5914a3)){if(__propIsEnum[_0x22aeaf(0xf8)](_0x5914a3,_0x32fca5))__defNormalProp(_0x4d6a07,_0x32fca5,_0x5914a3[_0x32fca5]);}return _0x4d6a07;},__spreadProps=(_0x52825b,_0xd74939)=>__defProps(_0x52825b,__getOwnPropDescs(_0xd74939)),__copyProps=(_0x4cbd15,_0x15a416,_0x5eab40,_0x1f3bf3)=>{const _0x3b3296={_0x4e968b:0xf2,_0x370629:0xf8},_0x4410db=_0x242fc1;if(_0x15a416&&typeof _0x15a416===_0x4410db(_0x3b3296._0x4e968b)||typeof _0x15a416==='function'){for(let _0x1989d1 of __getOwnPropNames(_0x15a416))if(!__hasOwnProp[_0x4410db(_0x3b3296._0x370629)](_0x4cbd15,_0x1989d1)&&_0x1989d1!==_0x5eab40)__defProp(_0x4cbd15,_0x1989d1,{'get':()=>_0x15a416[_0x1989d1],'enumerable':!(_0x1f3bf3=__getOwnPropDesc(_0x15a416,_0x1989d1))||_0x1f3bf3['enumerable']});}return _0x4cbd15;},__toESM=(_0x39ed5c,_0x3259c6,_0x27c5fe)=>(_0x27c5fe=_0x39ed5c!=null?__create(__getProtoOf(_0x39ed5c)):{},__copyProps(_0x3259c6||!_0x39ed5c||!_0x39ed5c['__esModule']?__defProp(_0x27c5fe,'default',{'value':_0x39ed5c,'enumerable':!![]}):_0x27c5fe,_0x39ed5c)),__async=(_0x4c12ba,_0x33dc1c,_0x14776b)=>{const _0x5f32e6={_0x30a4f4:0x129};return new Promise((_0x1a2e5a,_0x54d7fb)=>{const _0x2d4df6=_0x35c1;var _0x269212=_0x4db031=>{try{_0x4492b0(_0x14776b['next'](_0x4db031));}catch(_0x343140){_0x54d7fb(_0x343140);}},_0x46683d=_0xbc53a0=>{try{_0x4492b0(_0x14776b['throw'](_0xbc53a0));}catch(_0x328dfc){_0x54d7fb(_0x328dfc);}},_0x4492b0=_0x1c8fe3=>_0x1c8fe3[_0x2d4df6(0xc4)]?_0x1a2e5a(_0x1c8fe3[_0x2d4df6(0x100)]):Promise[_0x2d4df6(0xcf)](_0x1c8fe3[_0x2d4df6(0x100)])[_0x2d4df6(0xe5)](_0x269212,_0x46683d);_0x4492b0((_0x14776b=_0x14776b[_0x2d4df6(0x104)](_0x4c12ba,_0x33dc1c))[_0x2d4df6(_0x5f32e6._0x30a4f4)]());});},import_cheerio_without_node_native=__toESM(require(_0x242fc1(0x102))),PROVIDER_NAME=_0x242fc1(0xce),BASE_URL='https://4khdhub.one',TMDB_URL=_0x242fc1(0x111),TMDB_KEY='439c478a771f35c05022f9feabcca01c',USER_AGENT=_0x242fc1(0x12f),HEADERS={'User-Agent':USER_AGENT,'Referer':BASE_URL+'/'};function getInvertedSortTag(_0x368260,_0x392912=0xf423f){const _0x3fca6c={_0x4f6a2d:0xf5},_0xe3375f=_0x242fc1,_0x2c6b4d=Math[_0xe3375f(0xf6)](0x0,parseInt(_0x368260,0xa)||0x0),_0x1aaba3=Math[_0xe3375f(0xf6)](0x0,_0x392912-_0x2c6b4d),_0x5cc5d7=_0x1aaba3[_0xe3375f(0xc6)](0x2)[_0xe3375f(_0x3fca6c._0x4f6a2d)](0x14,'0');return _0x5cc5d7[_0xe3375f(0xf9)]('')['map'](_0x3fbe34=>_0x3fbe34==='1'?'\ufeff':'')['join']('');}function resolveSettings(_0x1910f8){const _0x1c8f73={_0x4dea26:0xda,_0xd7994c:0xbf,_0x58a36a:0xd0,_0x13172f:0xde,_0x42cca7:0x108,_0x10b3c2:0xf2,_0xe839ba:0xe0,_0x4a0d2e:0x108},_0x552eb6=_0x242fc1;let _0x34e00e={'sortBy':_0x552eb6(_0x1c8f73._0x4dea26)};try{let _0x1ec629=_0x1910f8;!_0x1ec629&&typeof globalThis!==_0x552eb6(_0x1c8f73._0xd7994c)&&(_0x1ec629=globalThis['SCRAPER_SETTINGS']||globalThis[_0x552eb6(_0x1c8f73._0x58a36a)]||globalThis['settings']);!_0x1ec629&&typeof global!=='undefined'&&(_0x1ec629=global['SCRAPER_SETTINGS']||global['SETTINGS']||global['settings']);!_0x1ec629&&typeof window!=='undefined'&&(_0x1ec629=window[_0x552eb6(_0x1c8f73._0x13172f)]||window[_0x552eb6(_0x1c8f73._0x58a36a)]||window['settings']);if(_0x1ec629){var _0x269144=_0x1ec629[_0x552eb6(_0x1c8f73._0x42cca7)]||_0x1ec629['sort_by']||_0x1ec629[_0x552eb6(0xf4)]||'';typeof _0x269144===_0x552eb6(_0x1c8f73._0x10b3c2)&&_0x269144!==null&&(_0x269144=_0x269144[_0x552eb6(0x100)]||_0x269144[_0x552ebLine truncated
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __defProps = Object.defineProperties;
|
||||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
||||
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||
var __spreadValues = (a, b) => {
|
||||
for (var prop in b || (b = {}))
|
||||
if (__hasOwnProp.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
if (__getOwnPropSymbols)
|
||||
for (var prop of __getOwnPropSymbols(b)) {
|
||||
if (__propIsEnum.call(b, prop))
|
||||
__defNormalProp(a, prop, b[prop]);
|
||||
}
|
||||
return a;
|
||||
};
|
||||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
||||
var __async = (__this, __arguments, generator) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
var fulfilled = (value) => {
|
||||
try {
|
||||
step(generator.next(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
};
|
||||
var rejected = (value) => {
|
||||
try {
|
||||
step(generator.throw(value));
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
};
|
||||
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
||||
step((generator = generator.apply(__this, __arguments)).next());
|
||||
});
|
||||
};
|
||||
var BASE_URL = "https://4khdhub.click";
|
||||
var TMDB_API_KEY = "439c478a771f35c05022f9feabcca01c";
|
||||
var USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36";
|
||||
var DOMAINS_URL = "https://raw.githubusercontent.com/phisher98/TVVVV/refs/heads/main/domains.json";
|
||||
var domainCache = { url: BASE_URL, ts: 0 };
|
||||
function fetchLatestDomain() {
|
||||
return __async(this, null, function* () {
|
||||
const now = Date.now();
|
||||
if (now - domainCache.ts < 36e5)
|
||||
return domainCache.url;
|
||||
try {
|
||||
const response = yield fetch(DOMAINS_URL);
|
||||
const data = yield response.json();
|
||||
if (data && data["4khdhub"]) {
|
||||
domainCache.url = data["4khdhub"];
|
||||
domainCache.ts = now;
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
return domainCache.url;
|
||||
});
|
||||
}
|
||||
function fetchText(_0) {
|
||||
return __async(this, arguments, function* (url, options = {}) {
|
||||
const retries = options.retries !== void 0 ? options.retries : 2;
|
||||
const delay = options.delay !== void 0 ? options.delay : 1e3;
|
||||
for (let i = 0; i <= retries; i++) {
|
||||
try {
|
||||
const response = yield fetch(url, {
|
||||
headers: __spreadValues({
|
||||
"User-Agent": USER_AGENT
|
||||
}, options.headers)
|
||||
});
|
||||
return yield response.text();
|
||||
} catch (err) {
|
||||
console.log(`[4KHDHub] Request failed for ${url}: ${err.message}${i < retries ? `, retrying (${i + 1}/${retries})...` : ""}`);
|
||||
}
|
||||
if (i < retries) {
|
||||
yield new Promise((r) => setTimeout(r, delay * Math.pow(2, i)));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
function getTmdbDetails(tmdbId, type) {
|
||||
return __async(this, null, function* () {
|
||||
const isSeries = type === "series" || type === "tv";
|
||||
const endpoint = isSeries ? "tv" : "movie";
|
||||
const url = `https://api.themoviedb.org/3/${endpoint}/${tmdbId}?api_key=${TMDB_API_KEY}`;
|
||||
console.log(`[4KHDHub] Fetching TMDB details from: ${url}`);
|
||||
try {
|
||||
const response = yield fetch(url);
|
||||
const data = yield response.json();
|
||||
if (isSeries) {
|
||||
return {
|
||||
title: data.name,
|
||||
year: data.first_air_date ? parseInt(data.first_air_date.split("-")[0]) : 0
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
title: data.title,
|
||||
year: data.release_date ? parseInt(data.release_date.split("-")[0]) : 0
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`[4KHDHub] TMDB request failed: ${error.message}`);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
function atob(input) {
|
||||
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
let str = String(input).replace(/=+$/, "");
|
||||
if (str.length % 4 === 1) {
|
||||
throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");
|
||||
}
|
||||
let output = "";
|
||||
for (let bc = 0, bs, buffer, i = 0; buffer = str.charAt(i++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {
|
||||
buffer = chars.indexOf(buffer);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
function rot13Cipher(str) {
|
||||
return str.replace(/[a-zA-Z]/g, function(c) {
|
||||
return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
|
||||
});
|
||||
}
|
||||
function levenshteinDistance(s, t) {
|
||||
if (s === t)
|
||||
return 0;
|
||||
const n = s.length;
|
||||
const m = t.length;
|
||||
if (n === 0)
|
||||
return m;
|
||||
if (m === 0)
|
||||
return n;
|
||||
const d = [];
|
||||
for (let i = 0; i <= n; i++) {
|
||||
d[i] = [];
|
||||
d[i][0] = i;
|
||||
}
|
||||
for (let j = 0; j <= m; j++) {
|
||||
d[0][j] = j;
|
||||
}
|
||||
for (let i = 1; i <= n; i++) {
|
||||
for (let j = 1; j <= m; j++) {
|
||||
const cost = s.charAt(i - 1) === t.charAt(j - 1) ? 0 : 1;
|
||||
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
|
||||
}
|
||||
}
|
||||
return d[n][m];
|
||||
}
|
||||
function parseBytes(val) {
|
||||
if (typeof val === "number")
|
||||
return val;
|
||||
if (!val)
|
||||
return 0;
|
||||
const match = val.match(/^([0-9.]+)\s*([a-zA-Z]+)$/);
|
||||
if (!match)
|
||||
return 0;
|
||||
const num = parseFloat(match[1]);
|
||||
const unit = match[2].toLowerCase();
|
||||
let multiplier = 1;
|
||||
if (unit.indexOf("k") === 0)
|
||||
multiplier = 1024;
|
||||
else if (unit.indexOf("m") === 0)
|
||||
multiplier = 1024 * 1024;
|
||||
else if (unit.indexOf("g") === 0)
|
||||
multiplier = 1024 * 1024 * 1024;
|
||||
else if (unit.indexOf("t") === 0)
|
||||
multiplier = 1024 * 1024 * 1024 * 1024;
|
||||
return num * multiplier;
|
||||
}
|
||||
function formatBytes(val) {
|
||||
if (val === 0)
|
||||
return "0 B";
|
||||
const k = 1024;
|
||||
const sizes = ["B", "KB", "MB", "GB", "TB"];
|
||||
let i = Math.floor(Math.log(val) / Math.log(k));
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
return parseFloat((val / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
||||
}
|
||||
var cheerio = require("cheerio-without-node-native");
|
||||
function fetchPageUrl(name, year, isSeries) {
|
||||
return __async(this, null, function* () {
|
||||
const domain = yield fetchLatestDomain();
|
||||
const searchUrl = `${domain}/?s=${encodeURIComponent(name + " " + year)}`;
|
||||
console.log(`[4KHDHub] Search Request URL: ${searchUrl}`);
|
||||
const html = yield fetchText(searchUrl);
|
||||
if (!html) {
|
||||
console.log("[4KHDHub] Search failed: No HTML response");
|
||||
return null;
|
||||
}
|
||||
const $ = cheerio.load(html);
|
||||
const targetType = isSeries ? "Series" : "Movies";
|
||||
console.log(`[4KHDHub] Parsing search results for type: ${targetType}`);
|
||||
const matchingCards = $(".movie-card").filter((_, el) => {
|
||||
const hasFormat = $(el).find(`.movie-card-format:contains("${targetType}")`).length > 0;
|
||||
if (!hasFormat) {
|
||||
}
|
||||
return hasFormat;
|
||||
}).filter((_, el) => {
|
||||
const metaText = $(el).find(".movie-card-meta").text();
|
||||
const movieCardYear = parseInt(metaText);
|
||||
const yearMatch = !isNaN(movieCardYear) && Math.abs(movieCardYear - year) <= 1;
|
||||
if (!yearMatch) {
|
||||
console.log(`[4KHDHub] Skip: Year mismatch (${movieCardYear} vs ${year}) - ${$(el).find(".movie-card-title").text().trim()}`);
|
||||
}
|
||||
return yearMatch;
|
||||
}).filter((_, el) => {
|
||||
const movieCardTitle = $(el).find(".movie-card-title").text().replace(/\[.*?]/g, "").trim();
|
||||
const distance = levenshteinDistance(movieCardTitle.toLowerCase(), name.toLowerCase());
|
||||
const match = distance < 5;
|
||||
console.log(`[4KHDHub] Checking: "${movieCardTitle}" (Dist: ${distance}) vs "${name}"`);
|
||||
return match;
|
||||
}).map((_, el) => {
|
||||
let href = $(el).attr("href");
|
||||
if (href && !href.startsWith("http")) {
|
||||
href = domain + (href.startsWith("/") ? "" : "/") + href;
|
||||
}
|
||||
return href;
|
||||
}).get();
|
||||
if (matchingCards.length === 0) {
|
||||
console.log("[4KHDHub] No matching cards found after filtering");
|
||||
} else {
|
||||
console.log(`[4KHDHub] Found ${matchingCards.length} matching cards`);
|
||||
}
|
||||
return matchingCards.length > 0 ? matchingCards[0] : null;
|
||||
});
|
||||
}
|
||||
var cheerio2 = require("cheerio-without-node-native");
|
||||
function resolveRedirectUrl(redirectUrl) {
|
||||
return __async(this, null, function* () {
|
||||
if (redirectUrl.includes("hubcloud.") || redirectUrl.includes("hubdrive.")) {
|
||||
return redirectUrl;
|
||||
}
|
||||
const redirectHtml = yield fetchText(redirectUrl);
|
||||
if (!redirectHtml)
|
||||
return redirectUrl;
|
||||
try {
|
||||
const redirectDataMatch = redirectHtml.match(/'o','(.*?)'/);
|
||||
if (!redirectDataMatch)
|
||||
return redirectUrl;
|
||||
const step1 = atob(redirectDataMatch[1]);
|
||||
const step2 = atob(step1);
|
||||
const step3 = rot13Cipher(step2);
|
||||
const step4 = atob(step3);
|
||||
const redirectData = JSON.parse(step4);
|
||||
if (redirectData && redirectData.o) {
|
||||
return atob(redirectData.o);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(`[4KHDHub] Error resolving redirect: ${e.message}`);
|
||||
}
|
||||
return redirectUrl;
|
||||
});
|
||||
}
|
||||
function extractSourceResults($, el) {
|
||||
return __async(this, null, function* () {
|
||||
const localHtml = $(el).html();
|
||||
const sizeMatch = localHtml.match(/([\d.]+ ?[GM]B)/);
|
||||
const heightMatch = localHtml.match(/\d{3,}p/);
|
||||
const title = $(el).find(".file-title, .episode-file-title").text().trim();
|
||||
let height = heightMatch ? parseInt(heightMatch[0]) : 0;
|
||||
if (height === 0 && (title.includes("4K") || title.includes("4k") || localHtml.includes("4K") || localHtml.includes("4k"))) {
|
||||
height = 2160;
|
||||
}
|
||||
const meta = {
|
||||
bytes: sizeMatch ? parseBytes(sizeMatch[1]) : 0,
|
||||
height,
|
||||
title
|
||||
};
|
||||
const hblinksLink = $(el).find("a").filter((_, a) => {
|
||||
const href = $(a).attr("href") || "";
|
||||
return href.includes("hblinks") || href.includes("hubstream.dad");
|
||||
}).attr("href");
|
||||
if (hblinksLink) {
|
||||
return { url: new URL(hblinksLink, BASE_URL).toString(), meta, extractor: "hblinks" };
|
||||
}
|
||||
const hubCloudLink = $(el).find("a").filter((_, a) => {
|
||||
const text = $(a).text();
|
||||
const href = $(a).attr("href") || "";
|
||||
return text.includes("HubCloud") || href.includes("hubcloud.") || href.includes("hubcloud/");
|
||||
}).attr("href");
|
||||
if (hubCloudLink) {
|
||||
const resolved = yield resolveRedirectUrl(hubCloudLink);
|
||||
return { url: resolved, meta };
|
||||
}
|
||||
const hubDriveLink = $(el).find("a").filter((_, a) => {
|
||||
const text = $(a).text();
|
||||
const href = $(a).attr("href") || "";
|
||||
return text.includes("HubDrive") || href.includes("hubdrive.") || href.includes("hubdrive/");
|
||||
}).attr("href");
|
||||
if (hubDriveLink) {
|
||||
const resolvedDrive = yield resolveRedirectUrl(hubDriveLink);
|
||||
if (resolvedDrive) {
|
||||
const hubDriveHtml = yield fetchText(resolvedDrive);
|
||||
if (hubDriveHtml) {
|
||||
const $2 = cheerio2.load(hubDriveHtml);
|
||||
const innerCloudLink = $2('a:contains("HubCloud")').attr("href") || $2("a").filter((_, a) => {
|
||||
const text = $2(a).text();
|
||||
const href = $2(a).attr("href") || "";
|
||||
return text.includes("HubCloud") || href.includes("hubcloud.") || href.includes("hubcloud/");
|
||||
}).attr("href");
|
||||
if (innerCloudLink) {
|
||||
return { url: innerCloudLink, meta };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
function extractHubCloud(hubCloudUrl, baseMeta) {
|
||||
return __async(this, null, function* () {
|
||||
if (!hubCloudUrl)
|
||||
return [];
|
||||
const redirectHtml = yield fetchText(hubCloudUrl, { headers: { Referer: hubCloudUrl } });
|
||||
if (!redirectHtml)
|
||||
return [];
|
||||
const redirectUrlMatch = redirectHtml.match(/var url ?= ?'(.*?)'/);
|
||||
if (!redirectUrlMatch)
|
||||
return [];
|
||||
const finalLinksUrl = redirectUrlMatch[1];
|
||||
const linksHtml = yield fetchText(finalLinksUrl, { headers: { Referer: hubCloudUrl } });
|
||||
if (!linksHtml)
|
||||
return [];
|
||||
const $ = cheerio2.load(linksHtml);
|
||||
const results = [];
|
||||
const sizeText = $("#size").text();
|
||||
const titleText = $("title").text().trim();
|
||||
const currentMeta = __spreadProps(__spreadValues({}, baseMeta), {
|
||||
bytes: parseBytes(sizeText) || baseMeta.bytes,
|
||||
title: titleText || baseMeta.title
|
||||
});
|
||||
$("a").each((_, el) => {
|
||||
const text = $(el).text().trim();
|
||||
const href = $(el).attr("href");
|
||||
if (!href)
|
||||
return;
|
||||
if (text.includes("10Gbps") || text.includes("PixelServer") || href.includes("hubcloud.cx")) {
|
||||
results.push({
|
||||
source: "HubCloud 10Gbps",
|
||||
url: href,
|
||||
meta: currentMeta
|
||||
});
|
||||
} else if (text.includes("Download File") || href.includes("r2.dev")) {
|
||||
results.push({
|
||||
source: "Direct R2",
|
||||
url: href,
|
||||
meta: currentMeta
|
||||
});
|
||||
} else if (text.includes("ZipDisk") || href.includes("workers.dev")) {
|
||||
results.push({
|
||||
source: "ZipDisk Server",
|
||||
url: href,
|
||||
meta: currentMeta
|
||||
});
|
||||
} else if (text.includes("FSL")) {
|
||||
results.push({
|
||||
source: "FSL",
|
||||
url: href,
|
||||
meta: currentMeta
|
||||
});
|
||||
}
|
||||
});
|
||||
return results;
|
||||
});
|
||||
}
|
||||
function extractHblinks(hblinksUrl, baseMeta, depth = 0) {
|
||||
return __async(this, null, function* () {
|
||||
if (!hblinksUrl || depth > 2)
|
||||
return [];
|
||||
try {
|
||||
const html = yield fetchText(hblinksUrl, { headers: { Referer: hblinksUrl } });
|
||||
if (!html)
|
||||
return [];
|
||||
const $ = cheerio2.load(html);
|
||||
const links = [...new Set($("h3 a, h5 a, div.entry-content p a, div.entry-content a").map((_, el) => $(el).attr("href")).get().filter(Boolean))];
|
||||
const results = [];
|
||||
for (const rawLink of links) {
|
||||
try {
|
||||
const absoluteLink = new URL(rawLink, hblinksUrl).toString();
|
||||
const resolvedLink = yield resolveRedirectUrl(absoluteLink);
|
||||
const link = resolvedLink || absoluteLink;
|
||||
const hostname = new URL(link).hostname.toLowerCase();
|
||||
if (hostname.includes("hblinks") || hostname.includes("hubstream.dad")) {
|
||||
const nestedResults = yield extractHblinks(link, baseMeta, depth + 1);
|
||||
results.push(...nestedResults);
|
||||
} else if (hostname.includes("hubcloud")) {
|
||||
const cloudResults = yield extractHubCloud(link, baseMeta);
|
||||
results.push(...cloudResults);
|
||||
} else if (hostname.includes("hubdrive")) {
|
||||
const driveHtml = yield fetchText(link, { headers: { Referer: hblinksUrl } });
|
||||
if (driveHtml) {
|
||||
const $drive = cheerio2.load(driveHtml);
|
||||
const cloudLink = $drive("a").filter((_, a) => {
|
||||
const text = $drive(a).text();
|
||||
const href = $drive(a).attr("href") || "";
|
||||
return text.includes("HubCloud") || href.includes("hubcloud.") || href.includes("hubcloud/");
|
||||
}).attr("href");
|
||||
if (cloudLink) {
|
||||
const absoluteCloudLink = new URL(cloudLink, link).toString();
|
||||
const cloudResults = yield extractHubCloud(absoluteCloudLink, baseMeta);
|
||||
results.push(...cloudResults);
|
||||
}
|
||||
}
|
||||
} else if (/\.(m3u8|mpd|mp4|mkv)(?:$|\?)/i.test(link)) {
|
||||
results.push({ source: "Hblinks Direct", url: link, meta: baseMeta });
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
return results;
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
var cheerio3 = require("cheerio-without-node-native");
|
||||
function getStreams(tmdbId, type, season, episode) {
|
||||
return __async(this, null, function* () {
|
||||
const tmdbDetails = yield getTmdbDetails(tmdbId, type);
|
||||
if (!tmdbDetails)
|
||||
return [];
|
||||
const { title, year } = tmdbDetails;
|
||||
console.log(`[4KHDHub] Search: ${title} (${year})`);
|
||||
const isSeries = type === "series" || type === "tv";
|
||||
const pageUrl = yield fetchPageUrl(title, year, isSeries);
|
||||
if (!pageUrl) {
|
||||
console.log("[4KHDHub] Page not found");
|
||||
return [];
|
||||
}
|
||||
console.log(`[4KHDHub] Found page: ${pageUrl}`);
|
||||
const html = yield fetchText(pageUrl);
|
||||
if (!html)
|
||||
return [];
|
||||
const $ = cheerio3.load(html);
|
||||
const itemsToProcess = [];
|
||||
if (isSeries && season && episode) {
|
||||
const seasonStr = "S" + String(season).padStart(2, "0");
|
||||
const episodeStr = "Episode-" + String(episode).padStart(2, "0");
|
||||
$(".episode-item").each((_, el) => {
|
||||
if ($(".episode-title", el).text().includes(seasonStr)) {
|
||||
const downloadItems = $(".episode-download-item", el).filter((_2, item) => $(item).text().includes(episodeStr));
|
||||
downloadItems.each((_2, item) => {
|
||||
itemsToProcess.push(item);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$(".download-item").each((_, el) => {
|
||||
itemsToProcess.push(el);
|
||||
});
|
||||
}
|
||||
console.log(`[4KHDHub] Processing ${itemsToProcess.length} items`);
|
||||
const streamPromises = itemsToProcess.map((item) => __async(this, null, function* () {
|
||||
try {
|
||||
const sourceResult = yield extractSourceResults($, item);
|
||||
if (sourceResult && sourceResult.url) {
|
||||
console.log(`[4KHDHub] Extracting from ${sourceResult.extractor === "hblinks" ? "Hblinks" : "HubCloud"}: ${sourceResult.url}`);
|
||||
let extractedLinks;
|
||||
if (sourceResult.extractor === "hblinks") {
|
||||
extractedLinks = yield extractHblinks(sourceResult.url, sourceResult.meta);
|
||||
} else {
|
||||
extractedLinks = yield extractHubCloud(sourceResult.url, sourceResult.meta);
|
||||
}
|
||||
return extractedLinks.map((link) => ({
|
||||
name: `4KHDHub - ${link.source}${sourceResult.meta.height ? ` ${sourceResult.meta.height}p` : ""}`,
|
||||
title: `${link.meta.title}
|
||||
${formatBytes(link.meta.bytes || 0)}`,
|
||||
url: link.url,
|
||||
quality: sourceResult.meta.height ? `${sourceResult.meta.height}p` : void 0,
|
||||
behaviorHints: {
|
||||
bingeGroup: `4khdhub-${link.source}`
|
||||
}
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
} catch (err) {
|
||||
console.log(`[4KHDHub] Item processing error: ${err.message}`);
|
||||
return [];
|
||||
}
|
||||
}));
|
||||
const results = yield Promise.all(streamPromises);
|
||||
return results.reduce((acc, val) => acc.concat(val), []);
|
||||
});
|
||||
}
|
||||
module.exports = { getStreams };
|
||||
Reference in new issue
Block a user