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:
16
providers/primewire/catalog.ts
Normal file
16
providers/primewire/catalog.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export const catalog = [
|
||||
{
|
||||
title: "Recently Added",
|
||||
filter: "/filter?sort=Just+Added&free_links=true",
|
||||
},
|
||||
{
|
||||
title: "TV Shows",
|
||||
filter: "/filter?sort=Trending+Today&type=tv",
|
||||
},
|
||||
{
|
||||
title: "Movies",
|
||||
filter: "/filter?sort=Trending+Today&type=movie",
|
||||
},
|
||||
];
|
||||
|
||||
export const genres = [];
|
||||
@@ -1,14 +0,0 @@
|
||||
import {pwCatalogList, pwGenresList} from './pwCatalogl';
|
||||
import {pwGetPosts, pwGetPostsSearch} from './pwGetPosts';
|
||||
import {pwGetInfo} from './pwGetInfo';
|
||||
import {pwGetStream} from './pwGetStream';
|
||||
import {ProviderType} from '../types';
|
||||
|
||||
export const primewire: ProviderType = {
|
||||
catalog: pwCatalogList,
|
||||
genres: pwGenresList,
|
||||
GetMetaData: pwGetInfo,
|
||||
GetHomePosts: pwGetPosts,
|
||||
GetStream: pwGetStream,
|
||||
GetSearchPosts: pwGetPostsSearch,
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Info, Link, ProviderContext} from '../types';
|
||||
import { Info, Link, ProviderContext } from "../types";
|
||||
|
||||
export const pwGetInfo = async function ({
|
||||
export const getMeta = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
@@ -8,34 +8,34 @@ export const pwGetInfo = async function ({
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Info> {
|
||||
try {
|
||||
const {axios, cheerio} = providerContext;
|
||||
const { axios, cheerio } = providerContext;
|
||||
const url = link;
|
||||
const baseUrl = link.split('/').slice(0, 3).join('/');
|
||||
const baseUrl = link.split("/").slice(0, 3).join("/");
|
||||
const res = await axios.get(url);
|
||||
const html = await res.data;
|
||||
const $ = cheerio.load(html);
|
||||
const imdbId =
|
||||
$('.movie_info')
|
||||
$(".movie_info")
|
||||
.find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])')
|
||||
.attr('href')
|
||||
?.split('/')[4] || '';
|
||||
const type = $('.show_season').html() ? 'series' : 'movie';
|
||||
.attr("href")
|
||||
?.split("/")[4] || "";
|
||||
const type = $(".show_season").html() ? "series" : "movie";
|
||||
const linkList: Link[] = [];
|
||||
$('.show_season').each((i, element) => {
|
||||
const seasonTitle = 'Season ' + $(element).attr('data-id');
|
||||
const episodes: Link['directLinks'] = [];
|
||||
$(".show_season").each((i, element) => {
|
||||
const seasonTitle = "Season " + $(element).attr("data-id");
|
||||
const episodes: Link["directLinks"] = [];
|
||||
$(element)
|
||||
.children()
|
||||
.each((i, element2) => {
|
||||
const episodeTitle = $(element2)
|
||||
.find('a')
|
||||
.find("a")
|
||||
.children()
|
||||
.remove()
|
||||
.end()
|
||||
.text()
|
||||
.trim()
|
||||
.replace('E', 'Epiosode ');
|
||||
const episodeLink = baseUrl + $(element2).find('a').attr('href');
|
||||
.replace("E", "Epiosode ");
|
||||
const episodeLink = baseUrl + $(element2).find("a").attr("href");
|
||||
if (episodeTitle && episodeLink) {
|
||||
episodes.push({
|
||||
title: episodeTitle,
|
||||
@@ -48,35 +48,35 @@ export const pwGetInfo = async function ({
|
||||
directLinks: episodes,
|
||||
});
|
||||
});
|
||||
if (type === 'movie') {
|
||||
if (type === "movie") {
|
||||
linkList.push({
|
||||
title: 'Movie',
|
||||
title: "Movie",
|
||||
directLinks: [
|
||||
{
|
||||
link: link,
|
||||
title: 'Movie',
|
||||
type: 'movie',
|
||||
title: "Movie",
|
||||
type: "movie",
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
return {
|
||||
title: '',
|
||||
image: '',
|
||||
title: "",
|
||||
image: "",
|
||||
imdbId: imdbId,
|
||||
synopsis: '',
|
||||
synopsis: "",
|
||||
type: type,
|
||||
linkList: linkList,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return {
|
||||
title: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
synopsis: '',
|
||||
title: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
synopsis: "",
|
||||
linkList: [],
|
||||
type: 'uhd',
|
||||
type: "uhd",
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Post, ProviderContext} from '../types';
|
||||
import { Post, ProviderContext } from "../types";
|
||||
|
||||
export const pwGetPosts = async function ({
|
||||
export const getPosts = async function ({
|
||||
filter,
|
||||
page,
|
||||
signal,
|
||||
@@ -12,14 +12,14 @@ export const pwGetPosts = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl, axios, cheerio} = providerContext;
|
||||
const { getBaseUrl, axios, cheerio } = providerContext;
|
||||
|
||||
const baseUrl = await getBaseUrl('primewire');
|
||||
const baseUrl = await getBaseUrl("primewire");
|
||||
const url = `${baseUrl + filter}&page=${page}`;
|
||||
return posts({baseUrl, url, signal, axios, cheerio});
|
||||
return posts({ baseUrl, url, signal, axios, cheerio });
|
||||
};
|
||||
|
||||
export const pwGetPostsSearch = async function ({
|
||||
export const getSearchPosts = async function ({
|
||||
searchQuery,
|
||||
page,
|
||||
signal,
|
||||
@@ -31,17 +31,17 @@ export const pwGetPostsSearch = async function ({
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
const {getBaseUrl, axios, cheerio, Aes} = providerContext;
|
||||
const { getBaseUrl, axios, cheerio, Aes } = providerContext;
|
||||
const getSHA256ofJSON = async function (input: any) {
|
||||
return await Aes.sha1(input);
|
||||
};
|
||||
const baseUrl = await getBaseUrl('primewire');
|
||||
const hash = await getSHA256ofJSON(searchQuery + 'JyjId97F9PVqUPuMO0');
|
||||
const baseUrl = await getBaseUrl("primewire");
|
||||
const hash = await getSHA256ofJSON(searchQuery + "JyjId97F9PVqUPuMO0");
|
||||
const url = `${baseUrl}/filter?s=${searchQuery}&page=${page}&ds=${hash.slice(
|
||||
0,
|
||||
10,
|
||||
10
|
||||
)}`;
|
||||
return posts({baseUrl, url, signal, axios, cheerio});
|
||||
return posts({ baseUrl, url, signal, axios, cheerio });
|
||||
};
|
||||
|
||||
async function posts({
|
||||
@@ -54,18 +54,18 @@ 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[] = [];
|
||||
$('.index_item.index_item_ie').map((i, element) => {
|
||||
const title = $(element).find('a').attr('title');
|
||||
const link = $(element).find('a').attr('href');
|
||||
const image = $(element).find('img').attr('src') || '';
|
||||
$(".index_item.index_item_ie").map((i, element) => {
|
||||
const title = $(element).find("a").attr("title");
|
||||
const link = $(element).find("a").attr("href");
|
||||
const image = $(element).find("img").attr("src") || "";
|
||||
if (title && link) {
|
||||
catalog.push({
|
||||
title: title,
|
||||
@@ -76,7 +76,7 @@ async function posts({
|
||||
});
|
||||
return catalog;
|
||||
} catch (err) {
|
||||
console.error('primewire error ', err);
|
||||
console.error("primewire error ", err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
export const pwCatalogList = [
|
||||
{
|
||||
title: 'Recently Added',
|
||||
filter: '/filter?sort=Just+Added&free_links=true',
|
||||
},
|
||||
{
|
||||
title: 'TV Shows',
|
||||
filter: '/filter?sort=Trending+Today&type=tv',
|
||||
},
|
||||
{
|
||||
title: 'Movies',
|
||||
filter: '/filter?sort=Trending+Today&type=movie',
|
||||
},
|
||||
];
|
||||
|
||||
export const pwGenresList = [];
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Stream, ProviderContext} from '../types';
|
||||
import { Stream, ProviderContext } from "../types";
|
||||
|
||||
export const pwGetStream = async function ({
|
||||
export const getStream = async function ({
|
||||
link: url,
|
||||
type,
|
||||
providerContext,
|
||||
@@ -9,48 +9,48 @@ export const pwGetStream = async function ({
|
||||
type: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Stream[]> {
|
||||
const {axios, cheerio} = providerContext;
|
||||
const { axios, cheerio } = providerContext;
|
||||
try {
|
||||
console.log('pwGetStream', type, url);
|
||||
const baseUrl = url.split('/').slice(0, 3).join('/');
|
||||
console.log("pwGetStream", type, url);
|
||||
const baseUrl = url.split("/").slice(0, 3).join("/");
|
||||
const streamLinks: Stream[] = [];
|
||||
const urls: {id: string; size: string}[] = [];
|
||||
const urls: { id: string; size: string }[] = [];
|
||||
const res = await axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
$('tr:contains("mixdrop")').map((i, element) => {
|
||||
const id = $(element).find('.wp-menu-btn').attr('data-wp-menu');
|
||||
const size = $(element).find('.wp-menu-btn').next().text();
|
||||
const id = $(element).find(".wp-menu-btn").attr("data-wp-menu");
|
||||
const size = $(element).find(".wp-menu-btn").next().text();
|
||||
if (id) {
|
||||
urls.push({id: baseUrl + '/links/go/' + id, size});
|
||||
urls.push({ id: baseUrl + "/links/go/" + id, size });
|
||||
}
|
||||
});
|
||||
|
||||
console.log('urls', urls);
|
||||
console.log("urls", urls);
|
||||
|
||||
for (const url of urls) {
|
||||
const res2 = await axios.head(url.id);
|
||||
const location = res2.request?.responseURL.replace('/f/', '/e/');
|
||||
const location = res2.request?.responseURL.replace("/f/", "/e/");
|
||||
|
||||
const res3 = await fetch(location, {
|
||||
credentials: 'include',
|
||||
credentials: "include",
|
||||
headers: {
|
||||
'User-Agent':
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0',
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",
|
||||
Accept:
|
||||
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
|
||||
'Accept-Language': 'en-US,en;q=0.5',
|
||||
'Upgrade-Insecure-Requests': '1',
|
||||
'Sec-Fetch-Dest': 'iframe',
|
||||
'Sec-Fetch-Mode': 'navigate',
|
||||
'Sec-Fetch-Site': 'same-origin',
|
||||
Pragma: 'no-cache',
|
||||
'Cache-Control': 'no-cache',
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"Sec-Fetch-Dest": "iframe",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "same-origin",
|
||||
Pragma: "no-cache",
|
||||
"Cache-Control": "no-cache",
|
||||
referer: res2.request?.responseURL,
|
||||
},
|
||||
referrer: res2.request?.responseURL,
|
||||
method: 'GET',
|
||||
mode: 'cors',
|
||||
method: "GET",
|
||||
mode: "cors",
|
||||
});
|
||||
const data3 = await res3.text();
|
||||
|
||||
@@ -59,26 +59,26 @@ export const pwGetStream = async function ({
|
||||
var functionRegex =
|
||||
/eval\(function\((.*?)\)\{.*?return p\}.*?\('(.*?)'\.split/;
|
||||
var match = functionRegex.exec(data3);
|
||||
let p = '';
|
||||
let p = "";
|
||||
if (match) {
|
||||
// var params = match[1].split(',').map(param => param.trim());
|
||||
var encodedString = match[2];
|
||||
console.log('Encoded String:', encodedString);
|
||||
console.log("Encoded String:", encodedString);
|
||||
|
||||
// console.log('Parameters:', params);
|
||||
// console.log('Encoded String:', encodedString.split("',36,")[0], '🔥🔥');
|
||||
|
||||
const base = Number(
|
||||
encodedString.split(",'|MDCore|")[0].split(',')[
|
||||
encodedString.split(",'|MDCore|")[0].split(',').length - 1
|
||||
],
|
||||
encodedString.split(",'|MDCore|")[0].split(",")[
|
||||
encodedString.split(",'|MDCore|")[0].split(",").length - 1
|
||||
]
|
||||
);
|
||||
console.log('Base:', base);
|
||||
console.log("Base:", base);
|
||||
|
||||
p = encodedString.split(`',${base},`)?.[0].trim();
|
||||
let a = base;
|
||||
let c = encodedString.split(`',${base},`)[1].slice(2).split('|').length;
|
||||
let k = encodedString.split(`',${base},`)[1].slice(2).split('|');
|
||||
let c = encodedString.split(`',${base},`)[1].slice(2).split("|").length;
|
||||
let k = encodedString.split(`',${base},`)[1].slice(2).split("|");
|
||||
|
||||
// console.log('p:', p);
|
||||
// console.log('a:', a);
|
||||
@@ -91,12 +91,12 @@ export const pwGetStream = async function ({
|
||||
c: any,
|
||||
k: any,
|
||||
e: any,
|
||||
d: any,
|
||||
d: any
|
||||
) {
|
||||
e = function (c: any) {
|
||||
return c.toString(36);
|
||||
};
|
||||
if (!''.replace(/^/, String)) {
|
||||
if (!"".replace(/^/, String)) {
|
||||
while (c--) {
|
||||
d[c.toString(a)] = k[c] || c.toString(a);
|
||||
}
|
||||
@@ -106,13 +106,13 @@ export const pwGetStream = async function ({
|
||||
},
|
||||
];
|
||||
e = function () {
|
||||
return '\\w+';
|
||||
return "\\w+";
|
||||
};
|
||||
c = 1;
|
||||
}
|
||||
while (c--) {
|
||||
if (k[c]) {
|
||||
p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
|
||||
p = p.replace(new RegExp("\\b" + e(c) + "\\b", "g"), k[c]);
|
||||
}
|
||||
}
|
||||
return p;
|
||||
@@ -121,30 +121,30 @@ export const pwGetStream = async function ({
|
||||
const decoded = decode(p, a, c, k, 0, {});
|
||||
// get MDCore.wurl=
|
||||
const wurl = decoded.match(/MDCore\.wurl="([^"]+)"/)?.[1];
|
||||
console.log('wurl:', wurl);
|
||||
const streamUrl = 'https:' + wurl;
|
||||
console.log('streamUrl:', streamUrl);
|
||||
console.log("wurl:", wurl);
|
||||
const streamUrl = "https:" + wurl;
|
||||
console.log("streamUrl:", streamUrl);
|
||||
streamLinks.push({
|
||||
server: 'Mixdrop ' + url.size,
|
||||
server: "Mixdrop " + url.size,
|
||||
link: streamUrl,
|
||||
type: 'mp4',
|
||||
type: "mp4",
|
||||
headers: {
|
||||
'User-Agent':
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0',
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0",
|
||||
Accept:
|
||||
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
|
||||
'Accept-Language': 'en-US,en;q=0.5',
|
||||
'Upgrade-Insecure-Requests': '1',
|
||||
'Sec-Fetch-Dest': 'iframe',
|
||||
'Sec-Fetch-Mode': 'navigate',
|
||||
'Sec-Fetch-Site': 'same-origin',
|
||||
Pragma: 'no-cache',
|
||||
'Cache-Control': 'no-cache',
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"Sec-Fetch-Dest": "iframe",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "same-origin",
|
||||
Pragma: "no-cache",
|
||||
"Cache-Control": "no-cache",
|
||||
referer: res2.request?.responseURL,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.log('No match found');
|
||||
console.log("No match found");
|
||||
}
|
||||
}
|
||||
return streamLinks;
|
||||
Reference in New Issue
Block a user