function getMoAktMail() {
return new Promise(async (resolve, reject) => {
try {
const res = await fetch("https://moakt.com/vi/inbox", {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"content-type": "application/x-www-form-urlencoded",
},
"redirect": "manual",
"body": "domain=teml.net&username;=&random=Nhận+một+email+ngẫu+nhiên&preferred_domain=tmpbox.net",
"method": "POST"
})
const cookie = getCookies(res)
const res2 = await fetch("https://moakt.com/vi/inbox", {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"cookie": cookie,
},
"body": null,
"method": "GET"
})
const $ = cheerio.load(await res2.text())
const address = $('#email-address').text()
resolve({address, cookie})
} catch (err) {
console.log(err)
reject()
}
})
}
function getMoAktMailInbox(emailData) {
return new Promise(async (resolve, reject) => {
try {
let link = ''
for (let index = 0; index < 30; index++) {
try {
let res = await fetch("https://moakt.com/vi/inbox", {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"cookie": emailData.cookie,
},
"body": null,
"method": "GET"
})
let $ = cheerio.load(await res.text())
const emails = []
$('td:not(#email-control):not(#email-sender) > a:not(.is_read)').each(function() {
const url = $(this).attr('href')
emails.push('https://moakt.com'+url+'/content')
})
const email = emails[0]
res = await fetch(email, {
"headers": {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"cookie": emailData.cookie,
},
"body": null,
"method": "GET"
})
$ = cheerio.load(await res.text())
link = $('a[href^="https://fb.me/"]').attr('href')
if (link) {
break
}
} catch {
await delayTimeout(3000)
}
}
if (link) {
resolve(link)
} else {
reject()
}
} catch (err) {
console.log(err)
reject()
}
})
}