notmebotz-tools
Version:
Sebuah Tools yang berfungsi untuk mendownload Video atau Foto dari media sosial, serta sebagai tools yang berguna untuk aplikasi kamu seperti untuk BOT
54 lines (44 loc) • 1.51 kB
JavaScript
/*
#################
ERROR WEB GET CLOUDFLARE statys 403
#################
const got = require('got');
const cheerio = require('cheerio');
async function sfilemobiSearch(query = '', page = 1) {
const url = `https://sfile.mobi/search.php?q=${query}&page=${page}`;
try {
const response = await got(url);
const $ = cheerio.load(response.body);
const files = [];
$('.list').each((index, element) => {
const file = {};
file.url = $(element).find('a').attr('href');
file.filename = $(element).find('a').text().trim();
file.icon = $(element).find('img').attr('src');
file.type = file.filename.split('.').pop();
const filesizeMatch = $(element).text().match(/\((.*?)\)/);
if (filesizeMatch) {
file.filesizeH = filesizeMatch[1];
const filesizeValue = file.filesizeH.split(' ')[0].replace(/[^\d.-]/g, '');
file.filesize = parseFloat(filesizeValue);
} else {
file.filesize = null; // Handle cases where the size is not found
}
files.push(file);
});
return {
author: 'Herza',
status: 200,
result: files
};
} catch (error) {
console.error('Error scraping:', error);
return {
author: 'Herza',
status: 500,
result: []
};
}
}
module.exports = { sfilemobiSearch };
*/