mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
init
This commit is contained in:
15
dist/primewire/index.js
vendored
Normal file
15
dist/primewire/index.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.primewire = void 0;
|
||||
const pwCatalogl_1 = require("./pwCatalogl");
|
||||
const pwGetPosts_1 = require("./pwGetPosts");
|
||||
const pwGetInfo_1 = require("./pwGetInfo");
|
||||
const pwGetStream_1 = require("./pwGetStream");
|
||||
exports.primewire = {
|
||||
catalog: pwCatalogl_1.pwCatalogList,
|
||||
genres: pwCatalogl_1.pwGenresList,
|
||||
GetMetaData: pwGetInfo_1.pwGetInfo,
|
||||
GetHomePosts: pwGetPosts_1.pwGetPosts,
|
||||
GetStream: pwGetStream_1.pwGetStream,
|
||||
GetSearchPosts: pwGetPosts_1.pwGetPostsSearch,
|
||||
};
|
||||
18
dist/primewire/pwCatalogl.js
vendored
Normal file
18
dist/primewire/pwCatalogl.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pwGenresList = exports.pwCatalogList = void 0;
|
||||
exports.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',
|
||||
},
|
||||
];
|
||||
exports.pwGenresList = [];
|
||||
78
dist/primewire/pwGetInfo.js
vendored
Normal file
78
dist/primewire/pwGetInfo.js
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pwGetInfo = void 0;
|
||||
const pwGetInfo = async function ({ link, providerContext, }) {
|
||||
try {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const url = link;
|
||||
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')
|
||||
.find('a[href*="imdb.com/title/tt"]:not([href*="imdb.com/title/tt/"])')
|
||||
.attr('href')
|
||||
?.split('/')[4] || '';
|
||||
const type = $('.show_season').html() ? 'series' : 'movie';
|
||||
const linkList = [];
|
||||
$('.show_season').each((i, element) => {
|
||||
const seasonTitle = 'Season ' + $(element).attr('data-id');
|
||||
const episodes = [];
|
||||
$(element)
|
||||
.children()
|
||||
.each((i, element2) => {
|
||||
const episodeTitle = $(element2)
|
||||
.find('a')
|
||||
.children()
|
||||
.remove()
|
||||
.end()
|
||||
.text()
|
||||
.trim()
|
||||
.replace('E', 'Epiosode ');
|
||||
const episodeLink = baseUrl + $(element2).find('a').attr('href');
|
||||
if (episodeTitle && episodeLink) {
|
||||
episodes.push({
|
||||
title: episodeTitle,
|
||||
link: episodeLink,
|
||||
});
|
||||
}
|
||||
});
|
||||
linkList.push({
|
||||
title: seasonTitle,
|
||||
directLinks: episodes,
|
||||
});
|
||||
});
|
||||
if (type === 'movie') {
|
||||
linkList.push({
|
||||
title: 'Movie',
|
||||
directLinks: [
|
||||
{
|
||||
link: link,
|
||||
title: 'Movie',
|
||||
type: 'movie',
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
return {
|
||||
title: '',
|
||||
image: '',
|
||||
imdbId: imdbId,
|
||||
synopsis: '',
|
||||
type: type,
|
||||
linkList: linkList,
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
return {
|
||||
title: '',
|
||||
image: '',
|
||||
imdbId: '',
|
||||
synopsis: '',
|
||||
linkList: [],
|
||||
type: 'uhd',
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.pwGetInfo = pwGetInfo;
|
||||
46
dist/primewire/pwGetPosts.js
vendored
Normal file
46
dist/primewire/pwGetPosts.js
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pwGetPostsSearch = exports.pwGetPosts = void 0;
|
||||
const pwGetPosts = async function ({ filter, page, signal, providerContext, }) {
|
||||
const { getBaseUrl, axios, cheerio } = providerContext;
|
||||
const baseUrl = await getBaseUrl('primewire');
|
||||
const url = `${baseUrl + filter}&page=${page}`;
|
||||
return posts({ baseUrl, url, signal, axios, cheerio });
|
||||
};
|
||||
exports.pwGetPosts = pwGetPosts;
|
||||
const pwGetPostsSearch = async function ({ searchQuery, page, signal, providerContext, }) {
|
||||
const { getBaseUrl, axios, cheerio, Aes } = providerContext;
|
||||
const getSHA256ofJSON = async function (input) {
|
||||
return await Aes.sha1(input);
|
||||
};
|
||||
const baseUrl = await getBaseUrl('primewire');
|
||||
const hash = await getSHA256ofJSON(searchQuery + 'JyjId97F9PVqUPuMO0');
|
||||
const url = `${baseUrl}/filter?s=${searchQuery}&page=${page}&ds=${hash.slice(0, 10)}`;
|
||||
return posts({ baseUrl, url, signal, axios, cheerio });
|
||||
};
|
||||
exports.pwGetPostsSearch = pwGetPostsSearch;
|
||||
async function posts({ baseUrl, url, signal, axios, cheerio, }) {
|
||||
try {
|
||||
const res = await axios.get(url, { signal });
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const catalog = [];
|
||||
$('.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,
|
||||
link: baseUrl + link,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
return catalog;
|
||||
}
|
||||
catch (err) {
|
||||
console.error('primewire error ', err);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
125
dist/primewire/pwGetStream.js
vendored
Normal file
125
dist/primewire/pwGetStream.js
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pwGetStream = void 0;
|
||||
const pwGetStream = async function ({ link: url, type, providerContext, }) {
|
||||
const { axios, cheerio } = providerContext;
|
||||
try {
|
||||
console.log('pwGetStream', type, url);
|
||||
const baseUrl = url.split('/').slice(0, 3).join('/');
|
||||
const streamLinks = [];
|
||||
const urls = [];
|
||||
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();
|
||||
if (id) {
|
||||
urls.push({ id: baseUrl + '/links/go/' + id, size });
|
||||
}
|
||||
});
|
||||
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 res3 = await fetch(location, {
|
||||
credentials: 'include',
|
||||
headers: {
|
||||
'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',
|
||||
referer: res2.request?.responseURL,
|
||||
},
|
||||
referrer: res2.request?.responseURL,
|
||||
method: 'GET',
|
||||
mode: 'cors',
|
||||
});
|
||||
const data3 = await res3.text();
|
||||
// let MDCore: any = {};
|
||||
// Step 1: Extract the function parameters and the encoded string
|
||||
var functionRegex = /eval\(function\((.*?)\)\{.*?return p\}.*?\('(.*?)'\.split/;
|
||||
var match = functionRegex.exec(data3);
|
||||
let p = '';
|
||||
if (match) {
|
||||
// var params = match[1].split(',').map(param => param.trim());
|
||||
var encodedString = match[2];
|
||||
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]);
|
||||
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('|');
|
||||
// console.log('p:', p);
|
||||
// console.log('a:', a);
|
||||
// console.log('c:', c);
|
||||
// console.log('k:', k);
|
||||
const decode = function (p, a, c, k, e, d) {
|
||||
e = function (c) {
|
||||
return c.toString(36);
|
||||
};
|
||||
if (!''.replace(/^/, String)) {
|
||||
while (c--) {
|
||||
d[c.toString(a)] = k[c] || c.toString(a);
|
||||
}
|
||||
k = [
|
||||
function (e) {
|
||||
return d[e];
|
||||
},
|
||||
];
|
||||
e = function () {
|
||||
return '\\w+';
|
||||
};
|
||||
c = 1;
|
||||
}
|
||||
while (c--) {
|
||||
if (k[c]) {
|
||||
p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
|
||||
}
|
||||
}
|
||||
return p;
|
||||
};
|
||||
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);
|
||||
streamLinks.push({
|
||||
server: 'Mixdrop ' + url.size,
|
||||
link: streamUrl,
|
||||
type: 'mp4',
|
||||
headers: {
|
||||
'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',
|
||||
referer: res2.request?.responseURL,
|
||||
},
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log('No match found');
|
||||
}
|
||||
}
|
||||
return streamLinks;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
exports.pwGetStream = pwGetStream;
|
||||
Reference in New Issue
Block a user