Closed SomeTroller77 closed 3 months ago
i also tried "HTML" and "TXT" as the format in the readMessage function but its giving everything as blank
{
settings: {},
search: {},
totalInbox: 1,
totalPages: 1,
mailFromPage: { page_1: 1 },
totalGetMails: 1,
inbox: [
{
id: 'e_ZwDjAGVkZQxjAmN1ZQNjZmH1AQLjZD==',
from: 'Instagram',
subject: '****** is your Instagram code',
timestamp: '15:07'
}
]
}
{
id: 'e_ZwDjAGVkZQxjAmN1ZQNjZmH1AQLjZD==',
submit: '',
from: '',
date: '',
selector: '#mail',
format: 'TXT',
data: ''
}
{
id: 'e_ZwDjAGVkZQxjAmN1ZQNjZmH1AQLjZD==',
submit: '',
from: '',
date: '',
deliverability: 'Your account has been credited',
format: 'html',
selector: null,
eq: null,
attribute: null,
pathToSave: null,
content: '',
info: []
}
If you need more data for debugging then please tell me!
Okay, I'll help you, share the email you're trying to consult.
Sure the email is:- gekoizeiheira-7913@yopmail.com
const easyYopmail = require('easy-yopmail');
easyYopmail.getInbox('gekoizeiheira-7913').then(inbox=>{
console.log(inbox);
});
Output of getInbox
// {
// mail: 'gekoizeiheira-7913@yopmail.com',
// settings: { LIMIT: 5 },
// filteredSearch: {},
// pageCount: 1,
// totalEmails: 1,
// emailsPerPageCount: { page_1: 1 },
// exploredPageCount: 1,
// fetchedEmailCount: 1,
// inbox: [
// {
// id: 'e_ZwDjAGVkZGpjZmNjZQNjAmDkZQLmZN==',
// from: 'Instagram',
// subject: '****** is your Instagram code',
// timestamp: '12:03',
// page: 1
// }
// ]
// }
easyYopmail.readMessage('gekoizeiheira-7913','e_ZwDjAGVkZGpjZmNjZQNjAmDkZQLmZN==').then(mail=>{
console.log(mail);
});
Output of readMessage
// {
// id: 'e_ZwDjAGVkZGpjZmNjZQNjAmDkZQLmZN==',
// submit: '',
// from: '',
// date: '',
// deliverability: 'Your account has been credited',
// format: 'txt',
// selector: null,
// eq: null,
// attribute: null,
// pathToSave: null,
// content: 'Complete the CAPTCHA to continue',
// info: []
// }
The problem is that this email is protected with reCATPCHA. It is the first time that I see that an email shows validation when I just open it. It usually appears when YOPmail is used many times, but generally when you clean all the data from the browser it should allow you to see the emails without problem.
I have made an improvement so that instead of coming out empty. This can indicate to us in the content field that it issues as a response. The message coming from Yopmail that says: "Complete the CAPTCHA to continue."
I have also fixed that it skips all the code when it encounters the error.
Now, this is just a temporary measure. A real solution would be to be able to solve the reCAPTCHA problem. However, it is not an easy task. I'm going to add it as an improvement. But you will surely have to sacrifice performance, stability, size and return to unwanted dependencies like PuppeterJS. That's what I can think of at the moment.
I'll put it in the backlog and I promise to think of something in the near future.
Well, to work on the corrected version you must delete the previous version.
Maybe it works for you to use:
npm r easy-yopmail
and then install it again:
npm i easy-yopmail
the most recent version is 5.0.2
readMessage(): Error read message Cannot read properties of undefined (reading 'toLowerCase') D:\Coding\JS\Projects\InstaBotnet\node_modules\easy-yopmail\index.js:1 "use strict";const cheerio=require("cheerio"),querystring=require("querystring"),constants=require("./src/constants.js"),utils=require("./src/utils.js");class EasyYopmail{async getMail(){try{const a=await utils.request("GET",constants.GENERATOR_URL);if(200!==a.statusCode)return console.error(constants.ERROR_LOAD_PAGE),null;const b=cheerio.load(a.body),c=b(constants.S_INPUT_MAIL_GENERATE).text();return c.split(";")[1]||c}catch(a){throw console.error(constants.ERROR_LOAD_PAGE),console.error(a.message),new Error(a)}}async getInbox(a){let b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};try{const d=utils.simplifyEmail(a),{cookie:e,yp:f,ver:g}=await utils.getCookiesAndYP(),h=await utils.getYJ(e,g);return await utils.detailInbox(d,f,h,g,e,b,c)}catch(a){throw console.error(constants.ERROR_GET_INBOX),console.error(a.message),new Error(a)}}async readMessage(a,b,c){let d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:"";try{const{cookie:e}=await utils.getCookiesAndYP(),f=await utils.request("GET",constants.READ_MAIL_URL(a,b),constants.INBOX_HTTP_CONFIG(e,a));200!==f.statusCode&&console.log(constants.ERROR_LOAD_PAGE);const g=cheerio.load(f.body),h=g(constants.SELECTOR_SUBMIT).text(),i=g(constants.SELECTOR_FROM),j=g(constants.SELECTOR_DATE),k=i.length?i.text():g(constants.SELECTOR_FROM_ALT).text(),l=j.length?j.text().replace(k,""):g(constants.SELECTOR_DATE_ALT).text();let m;return d?(d="".concat(constants.SELECTOR_MAIL," ").concat(d),m="html"===c.toLowerCase()?g(d).html():g(d).text().trim()):(d="#mail",m="html"===c.toLowerCase()?g(d).html():g(d).text().trim()),{id:b,submit:h,from:k,date:l,selector:d,format:c,data:m}}catch(a){throw console.error(constants.ERROR_READ_MESSAGE),console.error(a.message),new Error(a)}}async deleteMessage(a,b){try{const{cookie:c,yp:d,ver:e}=await utils.getCookiesAndYP(),f=await utils.getYJ(c,e),{inbox:g}=await this.getInbox(a,{id:b});if(0<g.length){const g=constants.DELETE_MESSAGE_URL(a,b,d,f,e),h=await utils.request("GET",g,constants.INBOX_HTTP_CONFIG(c,a));return!(200!==h.statusCode)}return!1}catch(a){throw console.error(constants.ERROR_DELETE_MESSAGE),console.error(a.message),new Error(a)}}async writeMessage(a,b,c,d){try{a&&b&&c&&d||console.error(constants.ERROR_MISSING_PARAMETERS);const{cookie:e}=await utils.getCookiesAndYP(),f=await utils.request("GET",constants.WRITE_MAIL_URL(a),constants.INBOX_HTTP_CONFIG(e,a));if(200===f.statusCode){const f={msgfrom:"".concat(a,"@yopmail.com"),msgto:b,msgsubject:c,msgbody:d},g=querystring.stringify(f);let h=constants.WRITE_MESSAGE_HTTP_CONFIG(e,a);h.headers["Content-Type"]="application/x-www-form-urlencoded",h.headers["Content-Length"]=Buffer.byteLength(g);const i=await utils.request("POST",constants.SEND_MESSAGE_URL,h,g);return 200!==i.statusCode&&console.error(constants.ERROR_WRITE_MESSAGE),(i.body+"").split("|")[2]}return f.data}catch(a){throw console.error(constants.ERROR_WRITE_MESSAGE),console.error(a.message),new Error(a)}}async deleteInbox(a){try{const{cookie:b,yp:c,ver:d}=await utils.getCookiesAndYP(),e=await utils.getYJ(b,d),{inbox:f}=await this.getInbox(a);if(0<f.length){const g=f[0].id,h=constants.DELETE_INBOX_URL(a,g,c,e,d),i=await utils.request("GET",h,constants.INBOX_HTTP_CONFIG(b,a));return console.log(i),200===i.statusCode}return!1}catch(a){throw console.error(constants.ERROR_DELETE_INBOX),console.error(a.message),new Error(a)}}}module.exports=new EasyYopmail;
Error: TypeError: Cannot read properties of undefined (reading 'toLowerCase') at EasyYopmail.readMessage (D:\Coding\JS\Projects\InstaBotnet\node_modules\easy-yopmail\index.js:1:1796) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file:///D:/Coding/JS/Projects/InstaBotnet/index.js:50:31
Node.js v20.5.0
facing this issue when i use your snippet from the last issue, i have put my own mail and id in place where its needed