mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
init
This commit is contained in:
16
providers/filmyfly/ffCatalog.ts
Normal file
16
providers/filmyfly/ffCatalog.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export const ffCatalog = [
|
||||
{
|
||||
title: 'Home',
|
||||
filter: '',
|
||||
},
|
||||
{
|
||||
title: 'Web Series',
|
||||
filter: '/page-cat/42/Web-Series.html',
|
||||
},
|
||||
{
|
||||
title: 'Hollywood',
|
||||
filter: '/page-cat/9/New-Hollywood-Hindi-Dubbed-Movie-2016-2025.html',
|
||||
},
|
||||
];
|
||||
|
||||
export const ffGenresList = [];
|
||||
38
providers/filmyfly/ffGetEpisodes.ts
Normal file
38
providers/filmyfly/ffGetEpisodes.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import {EpisodeLink, ProviderContext} from '../types';
|
||||
|
||||
export const ffEpisodeLinks = async function ({
|
||||
url,
|
||||
providerContext,
|
||||
}: {
|
||||
url: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<EpisodeLink[]> {
|
||||
try {
|
||||
const headers = providerContext.commonHeaders;
|
||||
const {axios, cheerio} = providerContext;
|
||||
const res = await axios.get(url, {headers});
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const episodeLinks: EpisodeLink[] = [];
|
||||
|
||||
$('.dlink.dl').map((i, element) => {
|
||||
const title = $(element)
|
||||
.find('a')
|
||||
.text()
|
||||
?.replace('Download', '')
|
||||
?.trim();
|
||||
const link = $(element).find('a').attr('href');
|
||||
|
||||
if (title && link) {
|
||||
episodeLinks.push({
|
||||
title,
|
||||
link,
|
||||
});
|
||||
}
|
||||
});
|
||||
return episodeLinks;
|
||||
} catch (err) {
|
||||
console.error('cl episode links', err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
56
providers/filmyfly/ffGetMeta.ts
Normal file
56
providers/filmyfly/ffGetMeta.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import {Info, Link, ProviderContext} from '../types';
|
||||
|
||||
export const ffGetInfo = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
link: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Info> {
|
||||
try {
|
||||
const {axios, cheerio, commonHeaders: headers} = providerContext;
|
||||
const url = link;
|
||||
const res = await axios.get(url, {headers});
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const type = url.includes('tvshows') ? 'series' : 'movie';
|
||||
const imdbId = '';
|
||||
const title = $('.fname:contains("Name")').find('.colora').text().trim();
|
||||
const image = $('.ss').find('img').attr('src') || '';
|
||||
const synopsis = $('.fname:contains("Description")')
|
||||
.find('.colorg')
|
||||
.text()
|
||||
.trim();
|
||||
const tags =
|
||||
$('.fname:contains("Genre")').find('.colorb').text().split(',') || [];
|
||||
const rating = '';
|
||||
const links: Link[] = [];
|
||||
const downloadLink = $('.dlbtn').find('a').attr('href');
|
||||
if (downloadLink) {
|
||||
links.push({
|
||||
title: title,
|
||||
episodesLink: downloadLink,
|
||||
});
|
||||
}
|
||||
return {
|
||||
title,
|
||||
tags,
|
||||
rating,
|
||||
synopsis,
|
||||
image,
|
||||
imdbId,
|
||||
type,
|
||||
linkList: links,
|
||||
};
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: '',
|
||||
synopsis: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
type: 'movie',
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
77
providers/filmyfly/ffGetPosts.ts
Normal file
77
providers/filmyfly/ffGetPosts.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import {Post, ProviderContext} from '../types';
|
||||
|
||||
export const ffGetPosts = 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('filmyfly');
|
||||
const url = `${baseUrl + filter}/${page}`;
|
||||
return posts({url, signal, baseUrl, providerContext});
|
||||
};
|
||||
|
||||
export const ffGetPostsSearch = 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('filmyfly');
|
||||
const url = `${baseUrl}/site-1.html?to-search=${searchQuery}`;
|
||||
if (page > 1) {
|
||||
return [];
|
||||
}
|
||||
return posts({url, signal, baseUrl, providerContext});
|
||||
};
|
||||
|
||||
async function posts({
|
||||
url,
|
||||
signal,
|
||||
baseUrl,
|
||||
providerContext,
|
||||
}: {
|
||||
url: string;
|
||||
signal: AbortSignal;
|
||||
baseUrl: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
try {
|
||||
const {cheerio, commonHeaders: headers} = providerContext;
|
||||
const res = await fetch(url, {headers, signal});
|
||||
const data = await res.text();
|
||||
const $ = cheerio.load(data);
|
||||
const catalog: Post[] = [];
|
||||
$('.A2,.A10,.fl').map((i, element) => {
|
||||
const title =
|
||||
$(element).find('a').eq(1).text() || $(element).find('b').text();
|
||||
const link = $(element).find('a').attr('href');
|
||||
const image = $(element).find('img').attr('src');
|
||||
if (title && link && image) {
|
||||
catalog.push({
|
||||
title: title,
|
||||
link: baseUrl + link,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
return catalog;
|
||||
} catch (err) {
|
||||
console.error('ff error ', err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
51
providers/filmyfly/ffGetStream.ts
Normal file
51
providers/filmyfly/ffGetStream.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import {Stream, ProviderContext} from '../types';
|
||||
|
||||
export const ffGetStream = async function ({
|
||||
link,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
link: string;
|
||||
type: string;
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Stream[]> {
|
||||
try {
|
||||
const res = await providerContext.axios.get(link, {signal});
|
||||
const data = res.data;
|
||||
const $ = providerContext.cheerio.load(data);
|
||||
const streams: Stream[] = [];
|
||||
const elements = $('.button2,.button1,.button3,.button4,.button').toArray();
|
||||
const promises = elements.map(async element => {
|
||||
const title = $(element).text();
|
||||
let link = $(element).attr('href');
|
||||
if (title.includes('GDFLIX') && link) {
|
||||
const gdLinks = await providerContext.extractors.gdFlixExtracter(
|
||||
link,
|
||||
signal,
|
||||
);
|
||||
streams.push(...gdLinks);
|
||||
}
|
||||
const alreadyAdded = streams.find(s => s.link === link);
|
||||
if (
|
||||
title &&
|
||||
link &&
|
||||
!title.includes('Watch') &&
|
||||
!title.includes('Login') &&
|
||||
!title.includes('GoFile') &&
|
||||
!alreadyAdded
|
||||
) {
|
||||
streams.push({
|
||||
server: title,
|
||||
link: link,
|
||||
type: 'mkv',
|
||||
});
|
||||
}
|
||||
});
|
||||
await Promise.all(promises);
|
||||
return streams;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
16
providers/filmyfly/index.ts
Normal file
16
providers/filmyfly/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import {ProviderType} from '../types';
|
||||
import {ffCatalog, ffGenresList} from './ffCatalog';
|
||||
import {ffEpisodeLinks} from './ffGetEpisodes';
|
||||
import {ffGetInfo} from './ffGetMeta';
|
||||
import {ffGetPosts, ffGetPostsSearch} from './ffGetPosts';
|
||||
import {ffGetStream} from './ffGetStream';
|
||||
|
||||
export const filmyfly: ProviderType = {
|
||||
catalog: ffCatalog,
|
||||
genres: ffGenresList,
|
||||
GetHomePosts: ffGetPosts,
|
||||
GetMetaData: ffGetInfo,
|
||||
GetSearchPosts: ffGetPostsSearch,
|
||||
GetEpisodeLinks: ffEpisodeLinks,
|
||||
GetStream: ffGetStream,
|
||||
};
|
||||
Reference in New Issue
Block a user