Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- @ Base: https://akunlama.com/
- @ Author: Shannz
- @ By: 𖧄 𝐋𝐔𝐂𝐀𝐒 𝐌𝐎𝐃 𝐃𝐎𝐌𝐈𝐍𝐀 𖧄
- @ Canal: https://whatsapp.com/channel/0029Vb69bDnAe5VmzSMwBH11
- */
- const axios = require('axios');
- const cheerio = require('cheerio');
- const akunlama = {
- cekEmail: async (recipient) => {
- const url = `https://akunlama.com/api/v1/mail/list?recipient=${recipient}`;
- try {
- const response = await axios.get(url);
- if (Array.isArray(response.data) && response.data.length === 0) {
- return {
- status: 'disponível',
- email: `${recipient}@akunlama.com`
- };
- } else {
- return {
- status: 'já tomadas',
- message: 'Tente outra, esta funciona, mas alguém já a usou.'
- };
- }
- } catch (error) {
- throw error;
- }
- },
- inbox: async (recipient) => {
- const url = `https://akunlama.com/api/v1/mail/list?recipient=${recipient}`;
- try {
- const response = await axios.get(url);
- const messages = response.data;
- if (!Array.isArray(messages) || messages.length === 0) {
- return [];
- }
- const formattedInbox = messages.map(item => ({
- region: item.storage.region,
- key: item.storage.key,
- timestamp: item.timestamp,
- sender: item.sender,
- subject: item.message.headers.subject,
- from: item.message.headers.from
- }));
- return formattedInbox;
- } catch (error) {
- throw error;
- }
- },
- getInbox: async (region, key) => {
- const url = `https://akunlama.com/api/v1/mail/getHtml?region=${region}&key=${key}`;
- try {
- const response = await axios.get(url);
- const html = response.data;
- if (!html || typeof html !== 'string') {
- return { plainText: '', links: [] };
- }
- const $ = cheerio.load(html);
- $('script, style').remove();
- const plainText = $('body').text().replace(/\s+/g, ' ').trim();
- const links = [];
- $('a').each((i, el) => {
- const href = $(el).attr('href');
- if (href) {
- links.push({
- href: href,
- text: $(el).text().trim()
- });
- }
- });
- return {
- plainText: plainText,
- links: links
- };
- } catch (error) {
- throw error;
- }
- }
- };
- module.exports = { akunlama }
- /*
- EXEMPLO DE USO:
- const { akunlama } = require('./akunlama');
- async function contohPenggunaan() {
- try {
- const cek = await akunlama.cekEmail('username');
- console.log('Cek Email:', cek);
- const inbox = await akunlama.inbox('username');
- console.log('Inbox:', inbox);
- if (inbox.length > 0) {
- const emailPertama = inbox[0];
- const konten = await akunlama.getInbox(emailPertama.region, emailPertama.key);
- console.log('Konten Email:', konten);
- }
- } catch (error) {
- console.error('Error:', error.message);
- }
- }
- // contohPenggunaan();
- FUNÇÕES:
- 1. cekEmail(destinatário) - Verifica a disponibilidade do nome de usuário/e-mail
- 2. inbox(destinatário) - Exibe uma lista de e-mails recebidos
- 3. getInbox(região, chave) - Lê o conteúdo de um e-mail específico
- */
Advertisement
Add Comment
Please, Sign In to add comment