UNPKG

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

71 lines (61 loc) โ€ข 1.96 kB
/* * * [ *SCRAPE ALIF.ID ( SEARCH )* ] * Created By Hann * * Channel: https://whatsapp.com/channel/0029Vaf07jKCBtxAsekFFk3i * **/ //๐Ÿ“ƒ: web berisi islam๐Ÿ˜… const axios = require('axios'); const cheerio = require('cheerio'); async function alifSearch(query) { try { const { data } = await axios.get('https://alif.id/?s=' + query); const $ = cheerio.load(data); const results = []; $('.post.style3').each((index, element) => { const title = $(element).find('.post-title h5 a span').text(); const link = $(element).find('.post-title h5 a').attr('href'); const author = $(element).find('.post-author a').text(); const authorLink = $(element).find('.post-author a').attr('href'); const date = $(element).find('.post-date').text(); const category = $(element).find('.post-category a').text(); const categoryLink = $(element).find('.post-category a').attr('href'); const image = $(element).find('figure.post-gallery img').attr('data-src'); results.push({ title, link, author, authorLink, date, category: category || 'Tidak ada kategori', categoryLink: categoryLink || null, image }); }); if (results.length === 0) { return { author: 'Herza', status: 200, data: 'Tidak ada data ditemukan' }; } return { author: 'Herza', status: 200, data: results }; } catch (error) { return { author: 'Herza', status: 500, data: error.message }; } } module.exports = { alifSearch }; // Contoh pemanggilan // alifSearch("doa makan").then(console.log).catch(console.error);