mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
renaming
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
export const vadapavCatalogList = [
|
||||
{
|
||||
title: 'Movies',
|
||||
filter: '/608c853f-704e-48f0-b785-4ae1f48ea70d',
|
||||
},
|
||||
{
|
||||
title: 'Tv Shows',
|
||||
filter: '/72983eef-a12f-4be4-99a7-e8f6afa568c1',
|
||||
},
|
||||
{
|
||||
title: 'Anime',
|
||||
filter: '/36abf81c-1032-4fbf-9a55-347a05ce2ca3',
|
||||
},
|
||||
];
|
||||
|
||||
export const vadapavGenresList = [];
|
||||
16
providers/vadapav/catalog.ts
Normal file
16
providers/vadapav/catalog.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export const catalog = [
|
||||
{
|
||||
title: "Movies",
|
||||
filter: "/608c853f-704e-48f0-b785-4ae1f48ea70d",
|
||||
},
|
||||
{
|
||||
title: "Tv Shows",
|
||||
filter: "/72983eef-a12f-4be4-99a7-e8f6afa568c1",
|
||||
},
|
||||
{
|
||||
title: "Anime",
|
||||
filter: "/36abf81c-1032-4fbf-9a55-347a05ce2ca3",
|
||||
},
|
||||
];
|
||||
|
||||
export const genres = [];
|
||||
@@ -1,31 +1,31 @@
|
||||
import {EpisodeLink, ProviderContext} from '../types';
|
||||
import { EpisodeLink, ProviderContext } from "../types";
|
||||
|
||||
export const vadapavGetEpisodeLinks = async function ({
|
||||
export const getEpisodes = async function ({
|
||||
url,
|
||||
providerContext,
|
||||
}: {
|
||||
url: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<EpisodeLink[]> {
|
||||
const {axios, cheerio} = providerContext;
|
||||
const { axios, cheerio } = providerContext;
|
||||
try {
|
||||
const baseUrl = url?.split('/').slice(0, 3).join('/');
|
||||
const baseUrl = url?.split("/").slice(0, 3).join("/");
|
||||
const res = await axios.get(url);
|
||||
const html = res.data;
|
||||
let $ = cheerio.load(html);
|
||||
const episodeLinks: EpisodeLink[] = [];
|
||||
|
||||
$('.file-entry:not(:contains("Parent Directory"))').map((i, element) => {
|
||||
const link = $(element).attr('href');
|
||||
const link = $(element).attr("href");
|
||||
if (
|
||||
link &&
|
||||
($(element).text()?.includes('.mp4') ||
|
||||
$(element).text()?.includes('.mkv'))
|
||||
($(element).text()?.includes(".mp4") ||
|
||||
$(element).text()?.includes(".mkv"))
|
||||
) {
|
||||
episodeLinks.push({
|
||||
title:
|
||||
$(element).text()?.match(/E\d+/)?.[0]?.replace('E', 'Episode ') ||
|
||||
i + 1 + '. ' + $(element).text()?.replace('.mkv', ''),
|
||||
$(element).text()?.match(/E\d+/)?.[0]?.replace("E", "Episode ") ||
|
||||
i + 1 + ". " + $(element).text()?.replace(".mkv", ""),
|
||||
link: baseUrl + link,
|
||||
});
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import {vadapavGetPosts, vadapavGetPostsSearch} from './vadapavGetPosts';
|
||||
import {vadapavCatalogList, vadapavGenresList} from './VagapavCatalog';
|
||||
import {ProviderType} from '../types';
|
||||
import {vadapavGetInfo} from './vadapavGetInfo';
|
||||
import {vadapavGetStream} from './vadapavGetStream';
|
||||
import {vadapavGetEpisodeLinks} from './vadapavGetEpisodes';
|
||||
|
||||
export const vadapavProvider: ProviderType = {
|
||||
catalog: vadapavCatalogList,
|
||||
genres: vadapavGenresList,
|
||||
GetHomePosts: vadapavGetPosts,
|
||||
GetEpisodeLinks: vadapavGetEpisodeLinks,
|
||||
GetMetaData: vadapavGetInfo,
|
||||
GetStream: vadapavGetStream,
|
||||
GetSearchPosts: vadapavGetPostsSearch,
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import {EpisodeLink, Info, Link, ProviderContext} from '../types';
|
||||
import { EpisodeLink, Info, Link, ProviderContext } from "../types";
|
||||
|
||||
export const vadapavGetInfo = async function ({
|
||||
export const getMeta = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
@@ -8,68 +8,68 @@ export const vadapavGetInfo = async function ({
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Info> {
|
||||
try {
|
||||
const {axios, cheerio} = providerContext;
|
||||
const baseUrl = link?.split('/').slice(0, 3).join('/');
|
||||
const { axios, cheerio } = providerContext;
|
||||
const baseUrl = link?.split("/").slice(0, 3).join("/");
|
||||
const url = link;
|
||||
const res = await axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const title =
|
||||
$('.directory')
|
||||
$(".directory")
|
||||
.children()
|
||||
.first()
|
||||
.text()
|
||||
.trim()
|
||||
?.split('/')
|
||||
?.split("/")
|
||||
.pop()
|
||||
?.trim() || '';
|
||||
?.trim() || "";
|
||||
const links: Link[] = [];
|
||||
$('.directory-entry:not(:contains("Parent Directory"))').map(
|
||||
(i, element) => {
|
||||
const link = $(element).attr('href');
|
||||
const link = $(element).attr("href");
|
||||
if (link) {
|
||||
links.push({
|
||||
episodesLink: baseUrl + link,
|
||||
title: $(element).text(),
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
const directLinks: EpisodeLink[] = [];
|
||||
$('.file-entry:not(:contains("Parent Directory"))').map((i, element) => {
|
||||
const link = $(element).attr('href');
|
||||
const link = $(element).attr("href");
|
||||
if (
|
||||
link &&
|
||||
($(element).text()?.includes('.mp4') ||
|
||||
$(element).text()?.includes('.mkv'))
|
||||
($(element).text()?.includes(".mp4") ||
|
||||
$(element).text()?.includes(".mkv"))
|
||||
) {
|
||||
directLinks.push({
|
||||
title: i + 1 + '. ' + $(element).text(),
|
||||
title: i + 1 + ". " + $(element).text(),
|
||||
link: baseUrl + link,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (directLinks.length > 0) {
|
||||
links.push({
|
||||
title: title + ' DL',
|
||||
title: title + " DL",
|
||||
directLinks: directLinks,
|
||||
});
|
||||
}
|
||||
return {
|
||||
title: title,
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: links,
|
||||
};
|
||||
} catch (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 vadapavGetPosts = async function ({
|
||||
export const getPosts = async function ({
|
||||
filter,
|
||||
page,
|
||||
// providerValue,
|
||||
@@ -13,16 +13,16 @@ export const vadapavGetPosts = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl, axios, cheerio} = providerContext;
|
||||
const baseUrl = await getBaseUrl('vadapav');
|
||||
const { getBaseUrl, axios, cheerio } = providerContext;
|
||||
const baseUrl = await getBaseUrl("vadapav");
|
||||
if (page > 1) {
|
||||
return [];
|
||||
}
|
||||
const url = `${baseUrl + filter}`;
|
||||
return posts({baseUrl, url, signal, axios, cheerio});
|
||||
return posts({ baseUrl, url, signal, axios, cheerio });
|
||||
};
|
||||
|
||||
export const vadapavGetPostsSearch = async function ({
|
||||
export const getSearchPosts = async function ({
|
||||
searchQuery,
|
||||
page,
|
||||
// providerValue,
|
||||
@@ -35,13 +35,13 @@ export const vadapavGetPostsSearch = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl, axios, cheerio} = providerContext;
|
||||
const baseUrl = await getBaseUrl('vadapav');
|
||||
const { getBaseUrl, axios, cheerio } = providerContext;
|
||||
const baseUrl = await getBaseUrl("vadapav");
|
||||
if (page > 1) {
|
||||
return [];
|
||||
}
|
||||
const url = `${baseUrl}/s/${searchQuery}`;
|
||||
return posts({baseUrl, url, signal, axios, cheerio});
|
||||
return posts({ baseUrl, url, signal, axios, cheerio });
|
||||
};
|
||||
|
||||
async function posts({
|
||||
@@ -54,24 +54,24 @@ async function posts({
|
||||
baseUrl: string;
|
||||
url: string;
|
||||
signal: AbortSignal;
|
||||
axios: ProviderContext['axios'];
|
||||
cheerio: ProviderContext['cheerio'];
|
||||
axios: ProviderContext["axios"];
|
||||
cheerio: ProviderContext["cheerio"];
|
||||
}): Promise<Post[]> {
|
||||
try {
|
||||
const res = await axios.get(url, {signal});
|
||||
const res = await axios.get(url, { signal });
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const catalog: Post[] = [];
|
||||
$('.directory-entry:not(:contains("Parent Directory"))').map(
|
||||
(i, element) => {
|
||||
const title = $(element).text();
|
||||
const link = $(element).attr('href');
|
||||
const link = $(element).attr("href");
|
||||
const imageTitle =
|
||||
title?.length > 30
|
||||
? title?.slice(0, 30)?.replaceAll('.', ' ')
|
||||
: title?.replaceAll('.', ' ');
|
||||
? title?.slice(0, 30)?.replace(/\./g, " ")
|
||||
: title?.replace(/\./g, " ");
|
||||
const image = `https://placehold.jp/23/000000/ffffff/200x400.png?text=${encodeURIComponent(
|
||||
imageTitle,
|
||||
imageTitle
|
||||
)}&css=%7B%22background%22%3A%22%20-webkit-gradient(linear%2C%20left%20bottom%2C%20left%20top%2C%20from(%233f3b3b)%2C%20to(%23000000))%22%2C%22text-transform%22%3A%22%20capitalize%22%7D`;
|
||||
if (title && link) {
|
||||
catalog.push({
|
||||
@@ -80,7 +80,7 @@ async function posts({
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
return catalog;
|
||||
} catch (err) {
|
||||
21
providers/vadapav/stream.ts
Normal file
21
providers/vadapav/stream.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Stream, ProviderContext } from "../types";
|
||||
|
||||
export const getStream = async function ({
|
||||
link: url, // type, // providerContext,
|
||||
}: {
|
||||
link: string;
|
||||
type: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Stream[]> {
|
||||
try {
|
||||
const stream: Stream[] = [];
|
||||
stream.push({
|
||||
server: "vadapav",
|
||||
link: url,
|
||||
type: url?.split(".").pop() || "mkv",
|
||||
});
|
||||
return stream;
|
||||
} catch (err) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
import {Stream, ProviderContext} from '../types';
|
||||
|
||||
export const vadapavGetStream = async function ({
|
||||
link: url, // type,
|
||||
} // providerContext,
|
||||
: {
|
||||
link: string;
|
||||
type: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Stream[]> {
|
||||
try {
|
||||
const stream: Stream[] = [];
|
||||
stream.push({
|
||||
server: 'vadapav',
|
||||
link: url,
|
||||
type: url?.split('.').pop() || 'mkv',
|
||||
});
|
||||
return stream;
|
||||
} catch (err) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user