mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
renaming
This commit is contained in:
@@ -1,61 +1,61 @@
|
||||
export const driveCatalog = [
|
||||
export const catalog = [
|
||||
{
|
||||
title: 'Latest',
|
||||
filter: '',
|
||||
title: "Latest",
|
||||
filter: "",
|
||||
},
|
||||
{
|
||||
title: 'Anime',
|
||||
filter: 'category/anime/',
|
||||
title: "Anime",
|
||||
filter: "category/anime/",
|
||||
},
|
||||
{
|
||||
title: 'Netflix',
|
||||
filter: 'category/netflix/',
|
||||
title: "Netflix",
|
||||
filter: "category/netflix/",
|
||||
},
|
||||
{
|
||||
title: '4K',
|
||||
filter: 'category/2160p-4k/',
|
||||
title: "4K",
|
||||
filter: "category/2160p-4k/",
|
||||
},
|
||||
];
|
||||
|
||||
export const driveGenresList = [
|
||||
export const genres = [
|
||||
{
|
||||
title: 'Action',
|
||||
filter: '/category/action',
|
||||
title: "Action",
|
||||
filter: "/category/action",
|
||||
},
|
||||
{
|
||||
title: 'Crime',
|
||||
filter: '/category/crime',
|
||||
title: "Crime",
|
||||
filter: "/category/crime",
|
||||
},
|
||||
{
|
||||
title: 'Comedy',
|
||||
filter: '/category/comedy',
|
||||
title: "Comedy",
|
||||
filter: "/category/comedy",
|
||||
},
|
||||
{
|
||||
title: 'Drama',
|
||||
filter: '/category/drama',
|
||||
title: "Drama",
|
||||
filter: "/category/drama",
|
||||
},
|
||||
{
|
||||
title: 'Horror',
|
||||
filter: '/category/horror',
|
||||
title: "Horror",
|
||||
filter: "/category/horror",
|
||||
},
|
||||
{
|
||||
title: 'Family',
|
||||
filter: '/category/family',
|
||||
title: "Family",
|
||||
filter: "/category/family",
|
||||
},
|
||||
{
|
||||
title: 'Sci-Fi',
|
||||
filter: '/category/sifi',
|
||||
title: "Sci-Fi",
|
||||
filter: "/category/sifi",
|
||||
},
|
||||
{
|
||||
title: 'Thriller',
|
||||
filter: '/category/triller',
|
||||
title: "Thriller",
|
||||
filter: "/category/triller",
|
||||
},
|
||||
{
|
||||
title: 'Romance',
|
||||
filter: '/category/romance',
|
||||
title: "Romance",
|
||||
filter: "/category/romance",
|
||||
},
|
||||
{
|
||||
title: 'Fight',
|
||||
filter: '/category/fight',
|
||||
title: "Fight",
|
||||
filter: "/category/fight",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {EpisodeLink, ProviderContext} from '../types';
|
||||
import { EpisodeLink, ProviderContext } from "../types";
|
||||
|
||||
export const driveGetEpisodeLinks = async function ({
|
||||
export const getEpisodes = async function ({
|
||||
url,
|
||||
providerContext,
|
||||
}: {
|
||||
@@ -8,7 +8,7 @@ export const driveGetEpisodeLinks = async function ({
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<EpisodeLink[]> {
|
||||
try {
|
||||
const {axios, cheerio} = providerContext;
|
||||
const { axios, cheerio } = providerContext;
|
||||
const res = await axios.get(url);
|
||||
const html = res.data;
|
||||
let $ = cheerio.load(html);
|
||||
@@ -16,10 +16,10 @@ export const driveGetEpisodeLinks = async function ({
|
||||
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'))) {
|
||||
const link = $(element).attr("href");
|
||||
if (link && (title.includes("Ep") || title.includes("Download"))) {
|
||||
episodeLinks.push({
|
||||
title: title.includes('Download') ? 'Play' : title,
|
||||
title: title.includes("Download") ? "Play" : title,
|
||||
link,
|
||||
});
|
||||
}
|
||||
@@ -31,7 +31,7 @@ export const driveGetEpisodeLinks = async function ({
|
||||
console.error(err);
|
||||
return [
|
||||
{
|
||||
title: 'Server 1',
|
||||
title: "Server 1",
|
||||
link: url,
|
||||
},
|
||||
];
|
||||
@@ -1,16 +0,0 @@
|
||||
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,
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Info, Link} from '../types';
|
||||
import { Info, Link } from "../types";
|
||||
|
||||
export const driveGetInfo = async function ({
|
||||
export const getMeta = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
@@ -12,56 +12,56 @@ export const driveGetInfo = async function ({
|
||||
};
|
||||
}): Promise<Info> {
|
||||
try {
|
||||
const {axios, cheerio} = providerContext;
|
||||
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')
|
||||
const type = $(".left-wrapper")
|
||||
.text()
|
||||
.toLocaleLowerCase()
|
||||
.includes('movie name')
|
||||
? 'movie'
|
||||
: 'series';
|
||||
const imdbId = $('a:contains("IMDb")').attr('href')?.split('/')[4] || '';
|
||||
.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')
|
||||
$(".left-wrapper").find('strong:contains("Name")').next().text() ||
|
||||
$(".left-wrapper")
|
||||
.find('strong:contains("Name"),h5:contains("Name")')
|
||||
.find('span:first')
|
||||
.find("span:first")
|
||||
.text();
|
||||
const synopsis =
|
||||
$('.left-wrapper')
|
||||
$(".left-wrapper")
|
||||
.find(
|
||||
'h2:contains("Storyline"),h3:contains("Storyline"),h5:contains("Storyline"),h4:contains("Storyline"),h4:contains("STORYLINE")',
|
||||
'h2:contains("Storyline"),h3:contains("Storyline"),h5:contains("Storyline"),h4:contains("Storyline"),h4:contains("STORYLINE")'
|
||||
)
|
||||
.next()
|
||||
.text() ||
|
||||
$('.ipc-html-content-inner-div').text() ||
|
||||
'';
|
||||
$(".ipc-html-content-inner-div").text() ||
|
||||
"";
|
||||
const image =
|
||||
$('img.entered.lazyloaded,img.entered,img.litespeed-loaded').attr(
|
||||
'src',
|
||||
$("img.entered.lazyloaded,img.entered,img.litespeed-loaded").attr(
|
||||
"src"
|
||||
) ||
|
||||
$('img.aligncenter').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"))',
|
||||
'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] || '';
|
||||
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 : '',
|
||||
episodesLink: type === "series" ? episodesLink : "",
|
||||
directLinks:
|
||||
type === 'movie'
|
||||
? [{title: 'Movie', link: episodesLink, type: 'movie'}]
|
||||
type === "movie"
|
||||
? [{ title: "Movie", link: episodesLink, type: "movie" }]
|
||||
: [],
|
||||
quality: quality,
|
||||
});
|
||||
@@ -69,7 +69,7 @@ export const driveGetInfo = async function ({
|
||||
});
|
||||
|
||||
// console.log('drive meta', title, synopsis, image, imdbId, type, links);
|
||||
console.log('drive meta', links, type);
|
||||
console.log("drive meta", links, type);
|
||||
return {
|
||||
title,
|
||||
synopsis,
|
||||
@@ -81,11 +81,11 @@ export const driveGetInfo = async function ({
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: '',
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Post, ProviderContext} from '../types';
|
||||
import { Post, ProviderContext } from "../types";
|
||||
|
||||
export const driveGetPosts = async function ({
|
||||
export const getPosts = async function ({
|
||||
filter,
|
||||
page,
|
||||
signal,
|
||||
@@ -12,13 +12,13 @@ export const driveGetPosts = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl} = providerContext;
|
||||
const baseUrl = await getBaseUrl('drive');
|
||||
const { getBaseUrl } = providerContext;
|
||||
const baseUrl = await getBaseUrl("drive");
|
||||
const url = `${baseUrl + filter}/page/${page}/`;
|
||||
return posts({url, signal, providerContext});
|
||||
return posts({ url, signal, providerContext });
|
||||
};
|
||||
|
||||
export const driveGetSearchPost = async function ({
|
||||
export const getSearchPosts = async function ({
|
||||
searchQuery,
|
||||
page,
|
||||
signal,
|
||||
@@ -30,10 +30,10 @@ export const driveGetSearchPost = async function ({
|
||||
providerContext: ProviderContext;
|
||||
signal: AbortSignal;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl} = providerContext;
|
||||
const baseUrl = await getBaseUrl('drive');
|
||||
const { getBaseUrl } = providerContext;
|
||||
const baseUrl = await getBaseUrl("drive");
|
||||
const url = `${baseUrl}page/${page}/?s=${searchQuery}`;
|
||||
return posts({url, signal, providerContext});
|
||||
return posts({ url, signal, providerContext });
|
||||
};
|
||||
|
||||
async function posts({
|
||||
@@ -46,20 +46,20 @@ async function posts({
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
try {
|
||||
const {cheerio} = providerContext;
|
||||
const res = await fetch(url, {signal});
|
||||
const { cheerio } = providerContext;
|
||||
const res = await fetch(url, { signal });
|
||||
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,
|
||||
});
|
||||
@@ -67,7 +67,7 @@ async function posts({
|
||||
});
|
||||
return catalog;
|
||||
} catch (err) {
|
||||
console.error('drive error ', err);
|
||||
console.error("drive error ", err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Stream, ProviderContext} from '../types';
|
||||
import { Stream, ProviderContext } from "../types";
|
||||
|
||||
export const driveGetStream = async function ({
|
||||
export const getStream = async function ({
|
||||
link: url,
|
||||
type,
|
||||
signal,
|
||||
@@ -13,35 +13,35 @@ export const driveGetStream = async function ({
|
||||
}): Promise<Stream[]> {
|
||||
const headers = providerContext.commonHeaders;
|
||||
try {
|
||||
if (type === 'movie') {
|
||||
const res = await providerContext.axios.get(url, {headers});
|
||||
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');
|
||||
const link = $('a:contains("HubCloud")').attr("href");
|
||||
url = link || url;
|
||||
}
|
||||
const res = await providerContext.axios.get(url, {headers});
|
||||
const res = await providerContext.axios.get(url, { headers });
|
||||
let redirectUrl = res.data.match(
|
||||
/<meta\s+http-equiv="refresh"\s+content="[^"]*?;\s*url=([^"]+)"\s*\/?>/i,
|
||||
/<meta\s+http-equiv="refresh"\s+content="[^"]*?;\s*url=([^"]+)"\s*\/?>/i
|
||||
)?.[1];
|
||||
if (url.includes('/archives/')) {
|
||||
if (url.includes("/archives/")) {
|
||||
redirectUrl = res.data.match(
|
||||
/<a\s+[^>]*href="(https:\/\/hubcloud\.[^\/]+\/[^"]+)"/i,
|
||||
/<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 res2 = await providerContext.axios.get(redirectUrl, { headers });
|
||||
const data = res2.data;
|
||||
const $ = providerContext.cheerio.load(data);
|
||||
const hubcloudLink = $('.fa-file-download').parent().attr('href');
|
||||
const hubcloudLink = $(".fa-file-download").parent().attr("href");
|
||||
return await providerContext.extractors.hubcloudExtracter(
|
||||
hubcloudLink?.includes('https://hubcloud') ? hubcloudLink : redirectUrl,
|
||||
signal,
|
||||
hubcloudLink?.includes("https://hubcloud") ? hubcloudLink : redirectUrl,
|
||||
signal
|
||||
);
|
||||
} catch (err) {
|
||||
console.error('Movies Drive err', err);
|
||||
console.error("Movies Drive err", err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user