This commit is contained in:
himanshu8443
2025-06-15 21:29:40 +05:30
commit 3f3e12f5df
299 changed files with 18729 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
export const driveCatalog = [
{
title: 'Latest',
filter: '',
},
{
title: 'Anime',
filter: 'category/anime/',
},
{
title: 'Netflix',
filter: 'category/netflix/',
},
{
title: '4K',
filter: 'category/2160p-4k/',
},
];
export const driveGenresList = [
{
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

@@ -0,0 +1,39 @@
import {EpisodeLink, ProviderContext} from '../types';
export const driveGetEpisodeLinks = async function ({
url,
providerContext,
}: {
url: string;
providerContext: ProviderContext;
}): Promise<EpisodeLink[]> {
try {
const {axios, cheerio} = providerContext;
const res = await axios.get(url);
const html = res.data;
let $ = cheerio.load(html);
const episodeLinks: EpisodeLink[] = [];
$('a:contains("HubCloud")').map((i, element) => {
const title = $(element).parent().prev().text();
const link = $(element).attr('href');
if (link && (title.includes('Ep') || title.includes('Download'))) {
episodeLinks.push({
title: title.includes('Download') ? 'Play' : title,
link,
});
}
});
// console.log(episodeLinks);
return episodeLinks;
} catch (err) {
console.error(err);
return [
{
title: 'Server 1',
link: url,
},
];
}
};

View File

@@ -0,0 +1,92 @@
import {Info, Link} from '../types';
export const driveGetInfo = async function ({
link,
providerContext,
}: {
link: string;
providerContext: {
axios: any;
cheerio: any;
getBaseUrl: (provider: string) => Promise<string>;
};
}): Promise<Info> {
try {
const {axios, cheerio} = providerContext;
const url = link;
const res = await axios.get(url);
const data = res.data;
const $ = cheerio.load(data);
const type = $('.left-wrapper')
.text()
.toLocaleLowerCase()
.includes('movie name')
? 'movie'
: 'series';
const imdbId = $('a:contains("IMDb")').attr('href')?.split('/')[4] || '';
const title =
$('.left-wrapper').find('strong:contains("Name")').next().text() ||
$('.left-wrapper')
.find('strong:contains("Name"),h5:contains("Name")')
.find('span:first')
.text();
const synopsis =
$('.left-wrapper')
.find(
'h2:contains("Storyline"),h3:contains("Storyline"),h5:contains("Storyline"),h4:contains("Storyline"),h4:contains("STORYLINE")',
)
.next()
.text() ||
$('.ipc-html-content-inner-div').text() ||
'';
const image =
$('img.entered.lazyloaded,img.entered,img.litespeed-loaded').attr(
'src',
) ||
$('img.aligncenter').attr('src') ||
'';
// Links
const links: Link[] = [];
$(
'a:contains("1080")a:not(:contains("Zip")),a:contains("720")a:not(:contains("Zip")),a:contains("480")a:not(:contains("Zip")),a:contains("2160")a:not(:contains("Zip")),a:contains("4k")a:not(:contains("Zip"))',
).map((i: number, element: any) => {
const title = $(element).parent('h5').prev().text();
const episodesLink = $(element).attr('href');
const quality = title.match(/\b(480p|720p|1080p|2160p)\b/i)?.[0] || '';
if (episodesLink && title) {
links.push({
title,
episodesLink: type === 'series' ? episodesLink : '',
directLinks:
type === 'movie'
? [{title: 'Movie', link: episodesLink, type: 'movie'}]
: [],
quality: quality,
});
}
});
// console.log('drive meta', title, synopsis, image, imdbId, type, links);
console.log('drive meta', links, type);
return {
title,
synopsis,
image,
imdbId,
type,
linkList: links,
};
} catch (err) {
console.error(err);
return {
title: '',
synopsis: '',
image: '',
imdbId: '',
type: 'movie',
linkList: [],
};
}
};

View File

@@ -0,0 +1,73 @@
import {Post, ProviderContext} from '../types';
export const driveGetPosts = async function ({
filter,
page,
signal,
providerContext,
}: {
filter: string;
page: number;
providerValue: string;
signal: AbortSignal;
providerContext: ProviderContext;
}): Promise<Post[]> {
const {getBaseUrl} = providerContext;
const baseUrl = await getBaseUrl('drive');
const url = `${baseUrl + filter}/page/${page}/`;
return posts({url, signal, providerContext});
};
export const driveGetSearchPost = async function ({
searchQuery,
page,
signal,
providerContext,
}: {
searchQuery: string;
page: number;
providerValue: string;
providerContext: ProviderContext;
signal: AbortSignal;
}): Promise<Post[]> {
const {getBaseUrl} = providerContext;
const baseUrl = await getBaseUrl('drive');
const url = `${baseUrl}page/${page}/?s=${searchQuery}`;
return posts({url, signal, providerContext});
};
async function posts({
url,
signal,
providerContext,
}: {
url: string;
signal: AbortSignal;
providerContext: ProviderContext;
}): Promise<Post[]> {
try {
const {cheerio} = providerContext;
const res = await fetch(url, {signal});
const data = await res.text();
const $ = cheerio.load(data);
const catalog: Post[] = [];
$('.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');
if (title && link && image) {
catalog.push({
title: title.replace('Download', '').trim(),
link: link,
image: image,
});
}
});
return catalog;
} catch (err) {
console.error('drive error ', err);
return [];
}
}

View File

@@ -0,0 +1,47 @@
import {Stream, ProviderContext} from '../types';
export const driveGetStream = async function ({
link: url,
type,
signal,
providerContext,
}: {
link: string;
type: string;
signal: AbortSignal;
providerContext: ProviderContext;
}): Promise<Stream[]> {
const headers = providerContext.commonHeaders;
try {
if (type === 'movie') {
const res = await providerContext.axios.get(url, {headers});
const html = res.data;
const $ = providerContext.cheerio.load(html);
const link = $('a:contains("HubCloud")').attr('href');
url = link || url;
}
const res = await providerContext.axios.get(url, {headers});
let redirectUrl = res.data.match(
/<meta\s+http-equiv="refresh"\s+content="[^"]*?;\s*url=([^"]+)"\s*\/?>/i,
)?.[1];
if (url.includes('/archives/')) {
redirectUrl = res.data.match(
/<a\s+[^>]*href="(https:\/\/hubcloud\.[^\/]+\/[^"]+)"/i,
)?.[1];
}
if (!redirectUrl) {
return await providerContext.extractors.hubcloudExtracter(url, signal);
}
const res2 = await providerContext.axios.get(redirectUrl, {headers});
const data = res2.data;
const $ = providerContext.cheerio.load(data);
const hubcloudLink = $('.fa-file-download').parent().attr('href');
return await providerContext.extractors.hubcloudExtracter(
hubcloudLink?.includes('https://hubcloud') ? hubcloudLink : redirectUrl,
signal,
);
} catch (err) {
console.error('Movies Drive err', err);
return [];
}
};

16
providers/drive/index.ts Normal file
View File

@@ -0,0 +1,16 @@
import {ProviderType} from '../../Manifest';
import {driveCatalog, driveGenresList} from './catalog';
import {driveGetEpisodeLinks} from './driveGetEpisodesList';
import {driveGetInfo} from './driveGetInfo';
import {driveGetPosts, driveGetSearchPost} from './driveGetPosts';
import {driveGetStream} from './driveGetStream';
export const moviesDrive: ProviderType = {
catalog: driveCatalog,
genres: driveGenresList,
GetMetaData: driveGetInfo,
GetHomePosts: driveGetPosts,
GetStream: driveGetStream,
GetEpisodeLinks: driveGetEpisodeLinks,
GetSearchPosts: driveGetSearchPost,
};