This commit is contained in:
himanshu8443
2025-06-16 22:26:38 +05:30
parent 3f3e12f5df
commit 2a4aa2a680
185 changed files with 4645 additions and 3952 deletions

View File

@@ -0,0 +1,61 @@
export const catalog = [
{
title: "Latest",
filter: "",
},
{
title: "Web Series",
filter: "/category/web-series",
},
{
title: "Hollywood ",
filter: "/category/hollywood-movies",
},
{
title: "South Movies",
filter: "/category/south-hindi-movies",
},
];
export const genres = [
{
title: "Action",
filter: "/category/action",
},
{
title: "Crime",
filter: "/category/crime",
},
{
title: "Comedy",
filter: "/category/comedy",
},
{
title: "Drama",
filter: "/category/drama",
},
{
title: "Horror",
filter: "/category/horror",
},
{
title: "Family",
filter: "/category/family",
},
{
title: "Sci-Fi",
filter: "/category/sifi",
},
{
title: "Thriller",
filter: "/category/triller",
},
{
title: "Romance",
filter: "/category/romance",
},
{
title: "Fight",
filter: "/category/fight",
},
];

View File

@@ -1,61 +0,0 @@
export const hdhub4uCatalog = [
{
title: 'Latest',
filter: '',
},
{
title: 'Web Series',
filter: '/category/web-series',
},
{
title: 'Hollywood ',
filter: '/category/hollywood-movies',
},
{
title: 'South Movies',
filter: '/category/south-hindi-movies',
},
];
export const hdhub4uGenresList = [
{
title: 'Action',
filter: '/category/action',
},
{
title: 'Crime',
filter: '/category/crime',
},
{
title: 'Comedy',
filter: '/category/comedy',
},
{
title: 'Drama',
filter: '/category/drama',
},
{
title: 'Horror',
filter: '/category/horror',
},
{
title: 'Family',
filter: '/category/family',
},
{
title: 'Sci-Fi',
filter: '/category/sifi',
},
{
title: 'Thriller',
filter: '/category/triller',
},
{
title: 'Romance',
filter: '/category/romance',
},
{
title: 'Fight',
filter: '/category/fight',
},
];

View File

@@ -1,14 +0,0 @@
import {hdhub4uCatalog, hdhub4uGenresList} from './hdhubCatalog';
import {hdhub4uGetInfo} from './hdhubGetInfo';
import {hdhub4uGetStream} from './hdhub4uGetSteam';
import {hdhubGetPosts, hdhubGetPostsSearch} from './hdhubGetPosts';
import {ProviderType} from '../types';
export const hdhub4uProvider: ProviderType = {
catalog: hdhub4uCatalog,
genres: hdhub4uGenresList,
GetMetaData: hdhub4uGetInfo,
GetStream: hdhub4uGetStream,
GetHomePosts: hdhubGetPosts,
GetSearchPosts: hdhubGetPostsSearch,
};

View File

@@ -1,12 +1,12 @@
import {Info, Link, ProviderContext} from '../types';
import { Info, Link, ProviderContext } from "../types";
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',
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",
};
export const hdhub4uGetInfo = async function ({
export const getMeta = async function ({
link,
providerContext,
}: {
@@ -14,35 +14,35 @@ export const hdhub4uGetInfo = async function ({
providerContext: ProviderContext;
}): Promise<Info> {
try {
const {axios, cheerio} = providerContext;
const { axios, cheerio } = providerContext;
const url = link;
const res = await axios.get(url, {headers: hdbHeaders});
const res = await axios.get(url, { headers: hdbHeaders });
const data = res.data;
const $ = cheerio.load(data);
const container = $('.page-body');
const container = $(".page-body");
const imdbId =
container
.find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])')
.attr('href')
?.split('/')[4] || '';
.attr("href")
?.split("/")[4] || "";
const title = container
.find(
'h2[data-ved="2ahUKEwjL0NrBk4vnAhWlH7cAHRCeAlwQ3B0oATAfegQIFBAM"],h2[data-ved="2ahUKEwiP0pGdlermAhUFYVAKHV8tAmgQ3B0oATAZegQIDhAM"]',
'h2[data-ved="2ahUKEwjL0NrBk4vnAhWlH7cAHRCeAlwQ3B0oATAfegQIFBAM"],h2[data-ved="2ahUKEwiP0pGdlermAhUFYVAKHV8tAmgQ3B0oATAZegQIDhAM"]'
)
.text();
const type = title.toLocaleLowerCase().includes('season')
? 'series'
: 'movie';
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') || '';
.replace("DESCRIPTION:", "");
const image = container.find('img[decoding="async"]').attr("src") || "";
// Links
const links: Link[] = [];
const directLink: Link['directLinks'] = [];
const directLink: Link["directLinks"] = [];
// direct link type
$('strong:contains("EPiSODE")').map((i, element) => {
@@ -54,9 +54,9 @@ export const hdhub4uGetInfo = async function ({
.parent()
.next()
.next()
.find('a')
.attr('href') ||
$(element).parent().parent().parent().next().find('a').attr('href');
.find("a")
.attr("href") ||
$(element).parent().parent().parent().next().find("a").attr("href");
if (episodesLink && episodesLink) {
directLink.push({
@@ -69,7 +69,7 @@ export const hdhub4uGetInfo = async function ({
if (directLink.length === 0) {
container.find('a:contains("EPiSODE")').map((i, element) => {
const epTitle = $(element).text();
const episodesLink = $(element).attr('href');
const episodesLink = $(element).attr("href");
if (episodesLink) {
directLink.push({
title: epTitle.toLocaleUpperCase(),
@@ -87,18 +87,20 @@ export const hdhub4uGetInfo = async function ({
if (directLink.length === 0) {
container
.find(
'a:contains("480"),a:contains("720"),a:contains("1080"),a:contains("2160"),a:contains("4K")',
'a:contains("480"),a:contains("720"),a:contains("1080"),a:contains("2160"),a:contains("4K")'
)
.map((i, element) => {
const quality =
$(element)
.text()
.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || '';
const movieLinks = $(element).attr('href');
.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || "";
const movieLinks = $(element).attr("href");
const title = $(element).text();
if (movieLinks) {
links.push({
directLinks: [{link: movieLinks, title: 'Movie', type: 'movie'}],
directLinks: [
{ link: movieLinks, title: "Movie", type: "movie" },
],
quality: quality,
title: title,
});
@@ -118,11 +120,11 @@ export const hdhub4uGetInfo = async function ({
} catch (err) {
console.error(err);
return {
title: '',
synopsis: '',
image: '',
imdbId: '',
type: 'movie',
title: "",
synopsis: "",
image: "",
imdbId: "",
type: "movie",
linkList: [],
};
}

View File

@@ -1,13 +1,13 @@
import {Post, ProviderContext} from '../types';
import { Post, ProviderContext } from "../types";
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',
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",
};
export const hdhubGetPosts = async function ({
export const getPosts = async function ({
filter,
page,
signal,
@@ -19,13 +19,13 @@ export const hdhubGetPosts = async function ({
providerContext: ProviderContext;
signal: AbortSignal;
}): Promise<Post[]> {
const {getBaseUrl} = providerContext;
const baseUrl = await getBaseUrl('hdhub');
const { getBaseUrl } = providerContext;
const baseUrl = await getBaseUrl("hdhub");
const url = `${baseUrl + filter}/page/${page}/`;
return posts({url, signal, providerContext});
return posts({ url, signal, providerContext });
};
export const hdhubGetPostsSearch = async function ({
export const getSearchPosts = async function ({
searchQuery,
page,
signal,
@@ -37,10 +37,10 @@ export const hdhubGetPostsSearch = async function ({
providerContext: ProviderContext;
signal: AbortSignal;
}): Promise<Post[]> {
const {getBaseUrl} = providerContext;
const baseUrl = await getBaseUrl('hdhub');
const { getBaseUrl } = providerContext;
const baseUrl = await getBaseUrl("hdhub");
const url = `${baseUrl}/page/${page}/?s=${searchQuery}`;
return posts({url, signal, providerContext});
return posts({ url, signal, providerContext });
};
async function posts({
@@ -52,7 +52,7 @@ async function posts({
signal: AbortSignal;
providerContext: ProviderContext;
}): Promise<Post[]> {
const {cheerio} = providerContext;
const { cheerio } = providerContext;
try {
const res = await fetch(url, {
headers: hdbHeaders,
@@ -61,16 +61,16 @@ async function posts({
const data = await res.text();
const $ = cheerio.load(data);
const catalog: Post[] = [];
$('.recent-movies')
$(".recent-movies")
.children()
.map((i, element) => {
const title = $(element).find('figure').find('img').attr('alt');
const link = $(element).find('a').attr('href');
const image = $(element).find('figure').find('img').attr('src');
const title = $(element).find("figure").find("img").attr("alt");
const link = $(element).find("a").attr("href");
const image = $(element).find("figure").find("img").attr("src");
if (title && link && image) {
catalog.push({
title: title.replace('Download', '').trim(),
title: title.replace("Download", "").trim(),
link: link,
image: image,
});
@@ -78,7 +78,7 @@ async function posts({
});
return catalog;
} catch (err) {
console.error('hdhubGetPosts error ', err);
console.error("hdhubGetPosts error ", err);
return [];
}
}

View File

@@ -1,6 +1,6 @@
import {ProviderContext} from '../types';
import { ProviderContext } from "../types";
export async function hdhub4uGetStream({
export async function getStream({
link,
signal,
providerContext,
@@ -10,49 +10,54 @@ export async function hdhub4uGetStream({
signal: AbortSignal;
providerContext: ProviderContext;
}) {
const {axios, cheerio, extractors, commonHeaders: headers} = providerContext;
const {hubcloudExtracter} = extractors;
let hubdriveLink = '';
if (link.includes('hubdrive')) {
const hubdriveRes = await axios.get(link, {headers, signal});
const {
axios,
cheerio,
extractors,
commonHeaders: headers,
} = providerContext;
const { hubcloudExtracter } = extractors;
let hubdriveLink = "";
if (link.includes("hubdrive")) {
const hubdriveRes = await axios.get(link, { headers, signal });
const hubdriveText = hubdriveRes.data;
const $ = cheerio.load(hubdriveText);
hubdriveLink =
$('.btn.btn-primary.btn-user.btn-success1.m-1').attr('href') || link;
$(".btn.btn-primary.btn-user.btn-success1.m-1").attr("href") || link;
} else {
const res = await axios.get(link, {headers, signal});
const res = await axios.get(link, { headers, signal });
const text = res.data;
const encryptedString = text.split("s('o','")?.[1]?.split("',180")?.[0];
const decodedString: any = decodeString(encryptedString);
link = atob(decodedString?.o);
const redirectLink = await getRedirectLinks(link, signal, headers);
const redirectLinkRes = await axios.get(redirectLink, {headers, signal});
const redirectLinkRes = await axios.get(redirectLink, { headers, signal });
const redirectLinkText = redirectLinkRes.data;
const $ = cheerio.load(redirectLinkText);
hubdriveLink =
$('h3:contains("1080p")').find('a').attr('href') ||
$('h3:contains("1080p")').find("a").attr("href") ||
redirectLinkText.match(
/href="(https:\/\/hubcloud\.[^\/]+\/drive\/[^"]+)"/,
/href="(https:\/\/hubcloud\.[^\/]+\/drive\/[^"]+)"/
)[1];
if (hubdriveLink.includes('hubdrive')) {
const hubdriveRes = await axios.get(hubdriveLink, {headers, signal});
if (hubdriveLink.includes("hubdrive")) {
const hubdriveRes = await axios.get(hubdriveLink, { headers, signal });
const hubdriveText = hubdriveRes.data;
const $$ = cheerio.load(hubdriveText);
hubdriveLink =
$$('.btn.btn-primary.btn-user.btn-success1.m-1').attr('href') ||
$$(".btn.btn-primary.btn-user.btn-success1.m-1").attr("href") ||
hubdriveLink;
}
}
const hubdriveLinkRes = await axios.get(hubdriveLink, {headers, signal});
const hubdriveLinkRes = await axios.get(hubdriveLink, { headers, signal });
const hubcloudText = hubdriveLinkRes.data;
const hubcloudLink =
hubcloudText.match(
/<META HTTP-EQUIV="refresh" content="0; url=([^"]+)">/i,
/<META HTTP-EQUIV="refresh" content="0; url=([^"]+)">/i
)?.[1] || hubdriveLink;
try {
return await hubcloudExtracter(hubcloudLink, signal);
} catch (error: any) {
console.log('hd hub 4 getStream error: ', error);
console.log("hd hub 4 getStream error: ", error);
return [];
}
}
@@ -62,36 +67,36 @@ const encode = function (value: string) {
};
const decode = function (value: string) {
if (value === undefined) {
return '';
return "";
}
return atob(value.toString());
};
const pen = function (value: string) {
return value.replace(/[a-zA-Z]/g, function (_0x1a470e: any) {
return String.fromCharCode(
(_0x1a470e <= 'Z' ? 90 : 122) >=
(_0x1a470e <= "Z" ? 90 : 122) >=
(_0x1a470e = _0x1a470e.charCodeAt(0) + 13)
? _0x1a470e
: _0x1a470e - 26,
: _0x1a470e - 26
);
});
};
const abortableTimeout = (
ms: number,
{signal}: {signal?: AbortSignal} = {},
{ signal }: { signal?: AbortSignal } = {}
) => {
return new Promise((resolve, reject) => {
if (signal && signal.aborted) {
return reject(new Error('Aborted'));
return reject(new Error("Aborted"));
}
const timer = setTimeout(resolve, ms);
if (signal) {
signal.addEventListener('abort', () => {
signal.addEventListener("abort", () => {
clearTimeout(timer);
reject(new Error('Aborted'));
reject(new Error("Aborted"));
});
}
});
@@ -100,14 +105,14 @@ const abortableTimeout = (
export async function getRedirectLinks(
link: string,
signal: AbortSignal,
headers: any,
headers: any
) {
try {
const res = await fetch(link, {headers, signal});
const res = await fetch(link, { headers, signal });
const resText = await res.text();
var regex = /ck\('_wp_http_\d+','([^']+)'/g;
var combinedString = '';
var combinedString = "";
var match;
while ((match = regex.exec(resText)) !== null) {
@@ -120,23 +125,23 @@ export async function getRedirectLinks(
const data = JSON.parse(decodedString);
console.log(data);
const token = encode(data?.data);
const blogLink = data?.wp_http1 + '?re=' + token;
const blogLink = data?.wp_http1 + "?re=" + token;
// abort timeout on signal
let wait = abortableTimeout((Number(data?.total_time) + 3) * 1000, {
signal,
});
await wait;
console.log('blogLink', blogLink);
console.log("blogLink", blogLink);
let vcloudLink = 'Invalid Request';
while (vcloudLink.includes('Invalid Request')) {
const blogRes = await fetch(blogLink, {headers, signal});
let vcloudLink = "Invalid Request";
while (vcloudLink.includes("Invalid Request")) {
const blogRes = await fetch(blogLink, { headers, signal });
const blogResText = (await blogRes.text()) as any;
if (blogResText.includes('Invalid Request')) {
if (blogResText.includes("Invalid Request")) {
console.log(blogResText);
} else {
vcloudLink = blogResText.match(/var reurl = "([^"]+)"/) || '';
vcloudLink = blogResText.match(/var reurl = "([^"]+)"/) || "";
break;
}
}
@@ -144,7 +149,7 @@ export async function getRedirectLinks(
// console.log('vcloudLink', vcloudLink?.[1]);
return blogLink || link;
} catch (err) {
console.log('Error in getRedirectLinks', err);
console.log("Error in getRedirectLinks", err);
return link;
}
}
@@ -152,10 +157,10 @@ export async function getRedirectLinks(
function rot13(str: string) {
return str.replace(/[a-zA-Z]/g, function (char) {
const charCode = char.charCodeAt(0);
const isUpperCase = char <= 'Z';
const isUpperCase = char <= "Z";
const baseCharCode = isUpperCase ? 65 : 97;
return String.fromCharCode(
((charCode - baseCharCode + 13) % 26) + baseCharCode,
((charCode - baseCharCode + 13) % 26) + baseCharCode
);
});
}
@@ -177,7 +182,7 @@ export function decodeString(encryptedString: string) {
// Parse JSON
return JSON.parse(decoded);
} catch (error) {
console.error('Error decoding string:', error);
console.error("Error decoding string:", error);
return null;
}
}