This commit is contained in:
himanshu8443
2025-06-15 21:29:40 +05:30
commit 3f3e12f5df
299 changed files with 18729 additions and 0 deletions

64
dist/topmovies/topGetPosts.js vendored Normal file
View File

@@ -0,0 +1,64 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.topGetPostsSearch = exports.topGetPosts = void 0;
const headers = {
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'Cache-Control': 'no-store',
'Accept-Language': 'en-US,en;q=0.9',
DNT: '1',
'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
Cookie: 'popads_user_id=6ba8fe60a481387a3249f05aa058822d',
'Sec-Fetch-Site': 'none',
'Sec-Fetch-User': '?1',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0',
};
const topGetPosts = async function ({ filter, page, signal, providerContext, }) {
const { getBaseUrl } = providerContext;
const baseUrl = await getBaseUrl('Topmovies');
const url = `${baseUrl + filter}/page/${page}/`;
return posts(url, signal, providerContext);
};
exports.topGetPosts = topGetPosts;
const topGetPostsSearch = async function ({ searchQuery, page, signal, providerContext, }) {
const { getBaseUrl } = providerContext;
const baseUrl = await getBaseUrl('Topmovies');
const url = `${baseUrl}/search/${searchQuery}/page/${page}/`;
return posts(url, signal, providerContext);
};
exports.topGetPostsSearch = topGetPostsSearch;
async function posts(url, signal, providerContext) {
try {
const { axios, cheerio } = providerContext;
const res = await axios.get(url, { headers, signal });
const data = res.data;
const $ = cheerio.load(data);
const catalog = [];
$('.post-cards')
.find('article')
.map((i, element) => {
const title = $(element).find('a').attr('title');
const link = $(element).find('a').attr('href');
const image = $(element).find('img').attr('data-src') ||
$(element).find('img').attr('src') ||
'';
if (title && link) {
catalog.push({
title: title.replace('Download', '').trim(),
link: link,
image: image,
});
}
});
// console.log(catalog);
return catalog;
}
catch (err) {
console.error('mod error ', err);
return [];
}
}