diff --git a/index.js b/index.js index 6300604..b7fa618 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -"use strict";const querystring=require("querystring"),Core=require("./src/core.js");class EasyYopmail extends Core{async getMail(){try{const{location:a}=await this.getHttpSettings();let b=this.constants.URL_GENERATOR(a);const c=await this.request("GET",b);200!==c.statusCode&&this.handleError({customMessage:this.constants.ERROR_LOAD_PAGE});const d=this.loadHTMl(c.body),e=d(this.constants.S_INPUT_MAIL_GENERATE).text();return e.split(";")[1]||e}catch(a){this.handleError({customMessage:a,error:this.constants.ERROR_LOAD_PAGE})}}async getInbox(a){let b=1''[a0_0x46a556(0x205)](baseUrl,a0_0x46a556(0x1ee))[a0_0x46a556(0x205)](_0x261992,a0_0x46a556(0x1c8)),'URL_SEND_MESSAGE':_0x510557=>''[a0_0x46a556(0x205)](baseUrl)['concat'](_0x510557,a0_0x46a556(0x1cf)),'URL_GENERATOR':_0x845182=>''[a0_0x46a556(0x205)](baseUrl)['concat'](_0x845182,a0_0x46a556(0x1dd)),'URL_WRITE_MAIL':(_0x589557,_0x2bff94)=>''[a0_0x46a556(0x205)](baseUrl)[a0_0x46a556(0x205)](_0x2bff94,a0_0x46a556(0x210))[a0_0x46a556(0x205)](_0x589557,a0_0x46a556(0x1db)),'URL_READ_MAIL':(_0x28ec37,_0x44f1d9,_0x5ca8bf)=>''[a0_0x46a556(0x205)](baseUrl)[a0_0x46a556(0x205)](_0x5ca8bf,a0_0x46a556(0x1f2))[a0_0x46a556(0x205)](_0x28ec37,'&id=i')['concat'](_0x44f1d9),'URL_DELETE_INBOX':(_0x5da0e8,_0xf70b84,_0x3605f6,_0x46f0cd,_0x19af62,_0x3fafac)=>''[a0_0x46a556(0x205)](baseUrl)[a0_0x46a556(0x205)](_0x3fafac,'/inbox?login=')[a0_0x46a556(0x205)](_0x5da0e8,a0_0x46a556(0x1d2))['concat'](_0xf70b84,a0_0x46a556(0x200))[a0_0x46a556(0x205)](_0x3605f6,'&yj=')['concat'](_0x46f0cd,a0_0x46a556(0x212))[a0_0x46a556(0x205)](_0x19af62,a0_0x46a556(0x1fe)),'URL_DELETE_MESSAGE':(_0x34f50c,_0x498e88,_0x36396a,_0x134fa8,_0x4d9a20,_0xbc0714)=>''['concat'](baseUrl)[a0_0x46a556(0x205)](_0xbc0714,'/inbox?login=')[a0_0x46a556(0x205)](_0x34f50c,a0_0x46a556(0x1ff))[a0_0x46a556(0x205)](_0x498e88,a0_0x46a556(0x215))[a0_0x46a556(0x205)](_0x36396a,a0_0x46a556(0x1ec))[a0_0x46a556(0x205)](_0x134fa8,a0_0x46a556(0x212))[a0_0x46a556(0x205)](_0x4d9a20,'&r_c=&id=&ad=0'),'URL_INBOX':(_0x22ce28,_0xad6446,_0x3e6fa8,_0x39433a,_0x2e9a16,_0x1388f8)=>''[a0_0x46a556(0x205)](baseUrl)[a0_0x46a556(0x205)](_0x1388f8,a0_0x46a556(0x1de))[a0_0x46a556(0x205)](_0x22ce28,a0_0x46a556(0x207))[a0_0x46a556(0x205)](_0x2e9a16,a0_0x46a556(0x208))[a0_0x46a556(0x205)](_0xad6446,a0_0x46a556(0x1ec))[a0_0x46a556(0x205)](_0x3e6fa8,a0_0x46a556(0x212))[a0_0x46a556(0x205)](_0x39433a,'&r_c=&id=&ad=0')},HTTP_CONFIG={'HEADERS_INBOX':(_0x398f46,_0x56c2a2,_0x23f4e0,_0x2d35c7,_0x1cccd7,_0x7451eb)=>({'headers':{...baseHeaders,'accept':a0_0x46a556(0x1d3),'cookie':''[a0_0x46a556(0x205)](_0x398f46,a0_0x46a556(0x1e4))[a0_0x46a556(0x205)](_0x56c2a2,a0_0x46a556(0x1f9))[a0_0x46a556(0x205)](_0x56c2a2,a0_0x46a556(0x1c9))['concat'](gads,':T=')[a0_0x46a556(0x205)](_0x2d35c7,a0_0x46a556(0x211))[a0_0x46a556(0x205)](_0x1cccd7,a0_0x46a556(0x216))[a0_0x46a556(0x205)](gads_S,a0_0x46a556(0x1d6))[a0_0x46a556(0x205)](gpi,a0_0x46a556(0x1d0))[a0_0x46a556(0x205)](_0x2d35c7,a0_0x46a556(0x211))['concat'](_0x1cccd7,':S=')['concat'](gpi_S,a0_0x46a556(0x214))[a0_0x46a556(0x205)](eoi,a0_0x46a556(0x1d0))[a0_0x46a556(0x205)](_0x2d35c7,a0_0x46a556(0x211))['concat'](_0x1cccd7,a0_0x46a556(0x216))[a0_0x46a556(0x205)](eoi_S,a0_0x46a556(0x204))[a0_0x46a556(0x205)](FCNEC,a0_0x46a556(0x1da))['concat'](_0x56c2a2,a0_0x46a556(0x1f9))[a0_0x46a556(0x205)](_0x56c2a2,a0_0x46a556(0x1dc))[a0_0x46a556(0x205)](_0x7451eb),'referer':''['concat'](baseUrl)[a0_0x46a556(0x205)](_0x23f4e0,a0_0x46a556(0x1cd)),'sec-fetch-dest':'iframe','sec-fetch-mode':a0_0x46a556(0x1fb),'sec-fetch-user':'?1','upgrade-insecure-requests':'1'}}),'HEADERS_WRITE_MESSAGE':(_0x522741,_0x250be7,_0x44bfbb,_0x5b15f5,_0x337d4f,_0x46d49e)=>({'headers':{...baseHeaders,'accept':a0_0x46a556(0x1fd),'Accept-Encoding':'gzip,\x20deflate,\x20br,\x20zstd','content-type':a0_0x46a556(0x209),'cookie':''[a0_0x46a556(0x205)](_0x522741,a0_0x46a556(0x1e4))[a0_0x46a556(0x205)](_0x250be7,a0_0x46a556(0x1f9))[a0_0x46a556(0x205)](_0x250be7,a0_0x46a556(0x1c9))['concat'](gads,a0_0x46a556(0x1d0))['concat'](_0x5b15f5,a0_0x46a556(0x211))[a0_0x46a556(0x205)](_0x337d4f,a0_0x46a556(0x216))[a0_0x46a556(0x205)](gads_S,a0_0x46a556(0x1d6))[a0_0x46a556(0x205)](gpi,a0_0x46a556(0x1d0))[a0_0x46a556(0x205)](_0x5b15f5,a0_0x46a556(0x211))[a0_0x46a556(0x205)](_0x337d4f,':S=')['concat'](gpi_S,a0_0x46a556(0x214))[a0_0x46a556(0x205)](eoi,':T=')[a0_0x46a556(0x205)](_0x5b15f5,a0_0x46a556(0x211))[a0_0x46a556(0x205)](_0x337d4f,a0_0x46a556(0x216))[a0_0x46a556(0x205)](eoi_S,a0_0x46a556(0x204))[a0_0x46a556(0x205)](FCNEC,a0_0x46a556(0x1da))[a0_0x46a556(0x205)](_0x250be7,a0_0x46a556(0x1f9))['concat'](_0x250be7,a0_0x46a556(0x1dc))[a0_0x46a556(0x205)](_0x46d49e),'origin':'https://yopmail.com','referer':a0_0x46a556(0x1ca)[a0_0x46a556(0x205)](_0x44bfbb,a0_0x46a556(0x1cd)),'sec-fetch-dest':a0_0x46a556(0x21d),'sec-fetch-mode':'cors'}})},PATHS={'PATH_INBOX_FILE':a0_0x46a556(0x20a),'PATH_MAIL_CONTENT':a0_0x46a556(0x1e0),'PATH_HTML_ID':a0_0x46a556(0x20d),'PATH_HTML_SUBJECT':a0_0x46a556(0x1e9),'PATH_HTML_CONTENT':'tests/archives/mailHTML_content.html'},SELECTORS={'S_INPUT_YP':a0_0x46a556(0x20b),'S_INPUT_MAIL_GENERATE':'#geny','S_SUBMIT':a0_0x46a556(0x1fa),'S_FROM':a0_0x46a556(0x1f5),'S_DATE':a0_0x46a556(0x1ea),'S_FROM_ALT':a0_0x46a556(0x1cc),'S_DATE_ALT':a0_0x46a556(0x219),'S_MAIL':a0_0x46a556(0x1c7)},REGEXES={'REGEX_LOCATION':/lang="(.*?)"/,'REGEX_YJ':/&yj=([^&]+)&v=/,'REGEX_TOTAL_MAILS':/w\.finrmail\((.*?)\)/,'REGEX_VER':/\/ver\/(\d+\.\d+)\//},ERRORS={'ERROR_MAIL_INVALID':a0_0x46a556(0x1e3),'ERROR_SEARCH_INVALID':a0_0x46a556(0x1e5),'ERROR_LOAD_PAGE':'getMail():\x20Error\x20getting\x20YOPMail\x20page','ERROR_GET_INBOX':a0_0x46a556(0x1eb),'ERROR_DELETE_INBOX':a0_0x46a556(0x218),'ERROR_READ_MESSAGE':a0_0x46a556(0x201),'ERROR_READ_MESSAGE_FORMAT':a0_0x46a556(0x21c),'ERROR_READ_MESSAGE_ATTRIBUTE':a0_0x46a556(0x202),'ERROR_READ_MESSAGE_STATUS_410':a0_0x46a556(0x1d1),'ERROR_WRITE_MESSAGE':a0_0x46a556(0x1ef),'ERROR_DELETE_MESSAGE':a0_0x46a556(0x1c3),'ERROR_PARAMETERS_INVALID':a0_0x46a556(0x203),'ERROR_GET_COOKIES':a0_0x46a556(0x1f0),'ERROR_GET_VERSION':'Error\x20getting\x20version.\x20Error\x20loading\x20page','ERROR_MISSING_PARAMETERS':a0_0x46a556(0x1ce),'ERROR_GET_TOTAL_MAILS':'Error\x20getting\x20total\x20number\x20of\x20mails','ERROR_GET_YJ':a0_0x46a556(0x20e),'ERROR_URL_NOT_FOUND':'URL\x20not\x20found,\x20Please\x20check\x20the\x20URL\x20try\x20again','ERROR_SAVE_HTML':a0_0x46a556(0x21f)},NOTIFY={'NOTIFY_EMAIL_NOT_FOUND':_0x11f7d2=>'The\x20mail\x20with\x20ID\x20['[a0_0x46a556(0x205)](_0x11f7d2,a0_0x46a556(0x21b)),'NOTIFY_EMAIL_DELETED_SUCCESS':_0x11143d=>a0_0x46a556(0x1d5)['concat'](_0x11143d,a0_0x46a556(0x1c5)),'NOTIFY_EMAIL_DELETED_FAILED':_0x4761a1=>'occurred\x20a\x20error\x20when\x20trying\x20to\x20delete\x20the\x20mail\x20with\x20ID\x20['[a0_0x46a556(0x205)](_0x4761a1,a0_0x46a556(0x1e6)),'NOTIFY_INBOX_DELETED_SUCCESS':(_0x3564b1,_0x117a38)=>a0_0x46a556(0x1c6)['concat'](_0x3564b1,a0_0x46a556(0x21e))[a0_0x46a556(0x205)](_0x117a38,'\x20emails\x20have\x20been\x20deleted.'),'NOTIFY_INBOX_DELETED_FAILED':_0x541cb9=>'An\x20error\x20occurred\x20when\x20trying\x20to\x20delete\x20the\x20inbox\x20of\x20the\x20email\x20'[a0_0x46a556(0x205)](_0x541cb9,a0_0x46a556(0x213)),'NOTIFY_INBOX_EMPTY':a0_0x46a556(0x1df)},TEST={'TEST_MAIL':a0_0x46a556(0x1f7),'TEST_MAIL_RECEIVER':a0_0x46a556(0x206)};module['exports']=Object['freeze']({...URLS,...HTTP_CONFIG,...PATHS,...SELECTORS,...REGEXES,...ERRORS,...NOTIFY,...TEST});function a0_0x11ad(){const _0x1c8c7b=['deleteInbox():\x20Error\x20delete\x20Inbox\x20page','div.fl\x20>\x20div.md.text.zoom.nw.f18\x20>\x20span.ellipsis:last-child','14GRKTax',']\x20was\x20not\x20found\x20and\x20could\x20not\x20be\x20deleted.','readMessage():\x20The\x20format\x20is\x20invalid.\x20Try\x20again\x20with\x20(HTML\x20or\x20TXT)','empty',']\x20has\x20been\x20deleted.\x20','Error\x20saving\x20HTML\x20file','6051768WqWGhc','deleteMessage():\x20Error\x20delete\x20message','Windows',']\x20has\x20been\x20successfully\x20deleted.','The\x20inbox\x20of\x20the\x20email\x20[','#mail','/webmail.js',';\x20__gads=','https://yopmail.com/','2033738FNmqbO','div.fl\x20>\x20div.md.text.zoom.nw.f18\x20>\x20span.ellipsis.b','/wm','Missing\x20parameters','/writepost',':T=','readMessage():\x20The\x20message\x20has\x20been\x20deleted\x20or\x20does\x20not\x20exist.\x20Try\x20reviewing\x20the\x20ID','&p=1&d=all&ctrl=','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','363CCTbvr','The\x20mail\x20with\x20ID\x20[',';\x20__gpi=','ID=5cd00b43a530b6a4','32363383zpEjJc','42xGuHcJ',';compte=','&id=',';\x20ytime=','/email-generator','/inbox?login=','The\x20inbox\x20is\x20empty','tests/archives/mailContent.json','635530jlMMBL','es-ES,es;q=0.9','parameters\x20\x27mail\x27\x20is\x20required',';\x20compte=','parameters\x20\x27_search\x27\x20keys\x20is\x20invalid,\x20try\x20again\x20with\x20(subject\x20ot\x20content)','].\x20Try\x20again\x20later.','5MfHMvo','ID=9a0b3cce9ff31bac','tests/archives/mailHTML_subject.html','div.fl\x20>\x20div.md.text.zoom.nw.f24\x20>\x20span.ellipsis:last-child','getInbox():\x20Error\x20getting\x20Inbox\x20page','&yj=','5256locwRC','ver/','writeMessage():\x20Error\x20write\x20message','Error\x20getting\x20cookies','198wOzNeS','/mail?b=','1110043GgbfpB','8FVLHcB','div.fl\x20>\x20div.md.text.zoom.nw.f24\x20>\x20span.ellipsis.b','283780OjImAh','test@yopmail.com','\x22Not_A\x20Brand\x22;v=\x2299\x22,\x20\x22Chromium\x22;v=\x22121\x22,\x20\x22Google\x20Chrome\x22;v=\x22121\x22',';\x20ywm=','div.fl\x20>\x20div.ellipsis.nw.b.f18','navigate','ALNI_MZ3k3gFQXDYCyC-n7CnlRltSEFoVQ','*/*','&r_c=&id=&ad=0','&p=1&d=','&yp=','readMessage():\x20Error\x20read\x20message','readMessage():\x20Attribute\x20cannot\x20be\x20accessed\x20if\x20no\x20selector\x20is\x20defined','validateSearch():\x20-\x20The\x20parameters\x20are\x20incorrect.\x20Try\x20again\x20with\x20(id,\x20from,\x20subject\x20or\x20timestamp)','\x22;\x20FCNEC=','concat','receiver01@yopmail.com','&p=','&d=&ctrl=&yp=','application/x-www-form-urlencoded','tests/archives/inbox.json','input#yp','ALNI_MbohrBpXt1O26O3LDmi-KRsCVPhcw','tests/archives/mailHTML_id.html','Error\x20getting\x20YJ','UID=00000a0a4f90dd17','/write?b=',':RT=','&v=','.\x20Try\x20again\x20later.',';\x20__eoi=\x22','&ctrl=&yp=',':S=','48toXBGc'];a0_0x11ad=function(){return _0x1c8c7b;};return a0_0x11ad();} \ No newline at end of file +'use strict';const a0_0x48a36c=a0_0x5ca3;(function(_0x304112,_0x5a3119){const _0x441c2e=a0_0x5ca3,_0x1a983f=_0x304112();while(!![]){try{const _0xe520ea=-parseInt(_0x441c2e(0x179))/0x1*(-parseInt(_0x441c2e(0x15a))/0x2)+-parseInt(_0x441c2e(0x196))/0x3+parseInt(_0x441c2e(0x15f))/0x4+-parseInt(_0x441c2e(0x1ab))/0x5*(-parseInt(_0x441c2e(0x192))/0x6)+parseInt(_0x441c2e(0x152))/0x7*(parseInt(_0x441c2e(0x1a7))/0x8)+-parseInt(_0x441c2e(0x16e))/0x9*(-parseInt(_0x441c2e(0x173))/0xa)+-parseInt(_0x441c2e(0x172))/0xb;if(_0xe520ea===_0x5a3119)break;else _0x1a983f['push'](_0x1a983f['shift']());}catch(_0xe67373){_0x1a983f['push'](_0x1a983f['shift']());}}}(a0_0x5d84,0x9bc7d));let baseUrl=a0_0x48a36c(0x1a4),baseHeaders={'accept-encoding':'gzip,\x20deflate,\x20br','accept-language':'es-ES,es;q=0.9','connection':'keep-alive','host':a0_0x48a36c(0x1a0),'sec-ch-ua':a0_0x48a36c(0x15b),'sec-ch-ua-mobile':'?0','sec-ch-ua-platform':a0_0x48a36c(0x150),'sec-fetch-site':a0_0x48a36c(0x154),'user-agent':a0_0x48a36c(0x195)},gads=a0_0x48a36c(0x180),gads_S='ALNI_MZ3k3gFQXDYCyC-n7CnlRltSEFoVQ',gpi=a0_0x48a36c(0x151),gpi_S=a0_0x48a36c(0x19d),eoi='ID=5cd00b43a530b6a4',eoi_S=a0_0x48a36c(0x187),FCNEC=a0_0x48a36c(0x15e);function a0_0x5ca3(_0x59beda,_0x31297e){const _0x5d84bd=a0_0x5d84();return a0_0x5ca3=function(_0x5ca30e,_0x4ab3c3){_0x5ca30e=_0x5ca30e-0x14e;let _0x3f5fa1=_0x5d84bd[_0x5ca30e];return _0x3f5fa1;},a0_0x5ca3(_0x59beda,_0x31297e);}const URLS={'URL_BASE':''['concat'](a0_0x48a36c(0x1a4)),'URL_WEBMAIL_JS':_0x396831=>''['concat'](baseUrl,'ver/')[a0_0x48a36c(0x18d)](_0x396831,'/webmail.js'),'URL_SEND_MESSAGE':_0x12baaf=>''[a0_0x48a36c(0x18d)](baseUrl)['concat'](_0x12baaf,a0_0x48a36c(0x18e)),'URL_GENERATOR':_0x1a8a7f=>''['concat'](baseUrl)[a0_0x48a36c(0x18d)](_0x1a8a7f,a0_0x48a36c(0x1a1)),'URL_WRITE_MAIL':(_0x3e6140,_0x1cce69)=>''[a0_0x48a36c(0x18d)](baseUrl)[a0_0x48a36c(0x18d)](_0x1cce69,a0_0x48a36c(0x19e))[a0_0x48a36c(0x18d)](_0x3e6140,a0_0x48a36c(0x17a)),'URL_READ_MAIL':(_0x1b96fd,_0x460546,_0x465d82)=>''[a0_0x48a36c(0x18d)](baseUrl)[a0_0x48a36c(0x18d)](_0x465d82,a0_0x48a36c(0x164))[a0_0x48a36c(0x18d)](_0x1b96fd,a0_0x48a36c(0x17c))[a0_0x48a36c(0x18d)](_0x460546),'URL_DELETE_INBOX':(_0xb02306,_0xcd5e39,_0x1a6a11,_0x5d2c9d,_0x3049a5,_0x4a378c)=>''[a0_0x48a36c(0x18d)](baseUrl)[a0_0x48a36c(0x18d)](_0x4a378c,a0_0x48a36c(0x188))[a0_0x48a36c(0x18d)](_0xb02306,'&p=1&d=all&ctrl=')[a0_0x48a36c(0x18d)](_0xcd5e39,a0_0x48a36c(0x160))[a0_0x48a36c(0x18d)](_0x1a6a11,'&yj=')[a0_0x48a36c(0x18d)](_0x5d2c9d,a0_0x48a36c(0x18c))['concat'](_0x3049a5,a0_0x48a36c(0x156)),'URL_DELETE_MESSAGE':(_0x2a2184,_0x1773b9,_0x430f36,_0x510869,_0x3d2c0a,_0x230fe1)=>''['concat'](baseUrl)[a0_0x48a36c(0x18d)](_0x230fe1,a0_0x48a36c(0x188))[a0_0x48a36c(0x18d)](_0x2a2184,a0_0x48a36c(0x19a))[a0_0x48a36c(0x18d)](_0x1773b9,a0_0x48a36c(0x185))[a0_0x48a36c(0x18d)](_0x430f36,a0_0x48a36c(0x16f))['concat'](_0x510869,a0_0x48a36c(0x18c))['concat'](_0x3d2c0a,a0_0x48a36c(0x156)),'URL_INBOX':(_0x5325a0,_0x3d76b6,_0x247696,_0x46f158,_0x179773,_0x3d2466)=>''[a0_0x48a36c(0x18d)](baseUrl)[a0_0x48a36c(0x18d)](_0x3d2466,a0_0x48a36c(0x188))[a0_0x48a36c(0x18d)](_0x5325a0,'&p=')['concat'](_0x179773,'&d=&ctrl=&yp=')[a0_0x48a36c(0x18d)](_0x3d76b6,a0_0x48a36c(0x16f))[a0_0x48a36c(0x18d)](_0x247696,a0_0x48a36c(0x18c))[a0_0x48a36c(0x18d)](_0x46f158,a0_0x48a36c(0x156))},HTTP_CONFIG={'HEADERS_INBOX':(_0x439e7d,_0x22d207,_0xf0ebca,_0x46b163,_0x5e881e,_0x58b573)=>({'headers':{...baseHeaders,'accept':a0_0x48a36c(0x176),'cookie':''['concat'](_0x439e7d,a0_0x48a36c(0x18a))[a0_0x48a36c(0x18d)](_0x22d207,';\x20ywm=')[a0_0x48a36c(0x18d)](_0x22d207,a0_0x48a36c(0x174))['concat'](gads,a0_0x48a36c(0x17e))[a0_0x48a36c(0x18d)](_0x46b163,a0_0x48a36c(0x16d))['concat'](_0x5e881e,a0_0x48a36c(0x15c))[a0_0x48a36c(0x18d)](gads_S,a0_0x48a36c(0x1ad))[a0_0x48a36c(0x18d)](gpi,':T=')[a0_0x48a36c(0x18d)](_0x46b163,a0_0x48a36c(0x16d))[a0_0x48a36c(0x18d)](_0x5e881e,a0_0x48a36c(0x15c))[a0_0x48a36c(0x18d)](gpi_S,a0_0x48a36c(0x169))[a0_0x48a36c(0x18d)](eoi,a0_0x48a36c(0x17e))[a0_0x48a36c(0x18d)](_0x46b163,':RT=')[a0_0x48a36c(0x18d)](_0x5e881e,a0_0x48a36c(0x15c))[a0_0x48a36c(0x18d)](eoi_S,'\x22;\x20FCNEC=')[a0_0x48a36c(0x18d)](FCNEC,a0_0x48a36c(0x157))[a0_0x48a36c(0x18d)](_0x22d207,a0_0x48a36c(0x16a))[a0_0x48a36c(0x18d)](_0x22d207,';\x20ytime=')[a0_0x48a36c(0x18d)](_0x58b573),'referer':''[a0_0x48a36c(0x18d)](baseUrl)[a0_0x48a36c(0x18d)](_0xf0ebca,a0_0x48a36c(0x159)),'sec-fetch-dest':a0_0x48a36c(0x182),'sec-fetch-mode':a0_0x48a36c(0x189),'sec-fetch-user':'?1','upgrade-insecure-requests':'1'}}),'HEADERS_READ_MESSAGE':(_0x821199,_0x7c8c8b,_0x6ebcec,_0x266d89,_0xe77623,_0x2b3622)=>({'headers':{...baseHeaders,'accept':a0_0x48a36c(0x197),'Accept-Encoding':'gzip,\x20deflate,\x20br,\x20zstd','cookie':''[a0_0x48a36c(0x18d)](_0x821199,';\x20__gads=')[a0_0x48a36c(0x18d)](gads,a0_0x48a36c(0x17e))['concat'](_0x266d89,a0_0x48a36c(0x16d))[a0_0x48a36c(0x18d)](_0xe77623,a0_0x48a36c(0x15c))[a0_0x48a36c(0x18d)](gads_S,';\x20__gpi=')[a0_0x48a36c(0x18d)](gpi,a0_0x48a36c(0x17e))[a0_0x48a36c(0x18d)](_0x266d89,a0_0x48a36c(0x16d))[a0_0x48a36c(0x18d)](_0xe77623,a0_0x48a36c(0x15c))[a0_0x48a36c(0x18d)](gpi_S,a0_0x48a36c(0x169))[a0_0x48a36c(0x18d)](eoi,a0_0x48a36c(0x17e))[a0_0x48a36c(0x18d)](_0x266d89,':RT=')[a0_0x48a36c(0x18d)](_0xe77623,a0_0x48a36c(0x15c))[a0_0x48a36c(0x18d)](eoi_S,a0_0x48a36c(0x14f))[a0_0x48a36c(0x18d)](FCNEC,a0_0x48a36c(0x18a))['concat'](_0x7c8c8b,a0_0x48a36c(0x16a))[a0_0x48a36c(0x18d)](_0x7c8c8b,';\x20ytime=')['concat'](_0x2b3622),'referer':''[a0_0x48a36c(0x18d)](baseUrl)[a0_0x48a36c(0x18d)](_0x6ebcec,a0_0x48a36c(0x159)),'sec-fetch-dest':a0_0x48a36c(0x182),'sec-fetch-mode':a0_0x48a36c(0x189),'sec-fetch-user':'?1','upgrade-insecure-requests':'1'}}),'HEADERS_WRITE_MESSAGE':(_0x112ae7,_0x2025cc,_0x257457,_0x1c7a69,_0x32c841,_0x472ff0)=>({'headers':{...baseHeaders,'accept':a0_0x48a36c(0x184),'Accept-Encoding':a0_0x48a36c(0x163),'content-type':'application/x-www-form-urlencoded','cookie':''[a0_0x48a36c(0x18d)](_0x112ae7,';\x20compte=')['concat'](_0x2025cc,';\x20ywm=')[a0_0x48a36c(0x18d)](_0x2025cc,';\x20__gads=')[a0_0x48a36c(0x18d)](gads,a0_0x48a36c(0x17e))[a0_0x48a36c(0x18d)](_0x1c7a69,a0_0x48a36c(0x16d))[a0_0x48a36c(0x18d)](_0x32c841,':S=')[a0_0x48a36c(0x18d)](gads_S,a0_0x48a36c(0x1ad))[a0_0x48a36c(0x18d)](gpi,a0_0x48a36c(0x17e))[a0_0x48a36c(0x18d)](_0x1c7a69,a0_0x48a36c(0x16d))['concat'](_0x32c841,a0_0x48a36c(0x15c))[a0_0x48a36c(0x18d)](gpi_S,a0_0x48a36c(0x169))[a0_0x48a36c(0x18d)](eoi,a0_0x48a36c(0x17e))[a0_0x48a36c(0x18d)](_0x1c7a69,a0_0x48a36c(0x16d))[a0_0x48a36c(0x18d)](_0x32c841,a0_0x48a36c(0x15c))[a0_0x48a36c(0x18d)](eoi_S,a0_0x48a36c(0x14f))[a0_0x48a36c(0x18d)](FCNEC,';compte=')[a0_0x48a36c(0x18d)](_0x2025cc,';\x20ywm=')[a0_0x48a36c(0x18d)](_0x2025cc,a0_0x48a36c(0x186))[a0_0x48a36c(0x18d)](_0x472ff0),'origin':a0_0x48a36c(0x14e),'referer':a0_0x48a36c(0x1a4)[a0_0x48a36c(0x18d)](_0x257457,a0_0x48a36c(0x159)),'sec-fetch-dest':a0_0x48a36c(0x175),'sec-fetch-mode':a0_0x48a36c(0x170)}})},PATHS={'PATH_INBOX_FILE':a0_0x48a36c(0x194),'PATH_MAIL_CONTENT':a0_0x48a36c(0x165),'PATH_HTML_ID':a0_0x48a36c(0x19b),'PATH_HTML_SUBJECT':a0_0x48a36c(0x16b),'PATH_HTML_CONTENT':a0_0x48a36c(0x190)},SELECTORS={'S_INPUT_YP':a0_0x48a36c(0x191),'S_INPUT_MAIL_GENERATE':a0_0x48a36c(0x198),'S_SUBMIT':a0_0x48a36c(0x1a5),'S_FROM':a0_0x48a36c(0x18f),'S_DATE':a0_0x48a36c(0x1a8),'S_FROM_ALT':'div.fl\x20>\x20div.md.text.zoom.nw.f18\x20>\x20span.ellipsis.b','S_DATE_ALT':'div.fl\x20>\x20div.md.text.zoom.nw.f18\x20>\x20span.ellipsis:last-child','S_MAIL':a0_0x48a36c(0x19f)},REGEXES={'REGEX_LOCATION':/lang="(.*?)"/,'REGEX_YJ':/&yj=([^&]+)&v=/,'REGEX_TOTAL_MAILS':/w\.finrmail\((.*?)\)/,'REGEX_VER':/\/ver\/(\d+\.\d+)\//},ERRORS={'ERROR_MAIL_INVALID':a0_0x48a36c(0x162),'ERROR_SEARCH_INVALID':'parameters\x20\x27_search\x27\x20keys\x20is\x20invalid,\x20try\x20again\x20with\x20(subject\x20ot\x20content)','ERROR_LOAD_PAGE':'getMail():\x20Error\x20getting\x20YOPMail\x20page','ERROR_GET_INBOX':a0_0x48a36c(0x168),'ERROR_DELETE_INBOX':a0_0x48a36c(0x1ac),'ERROR_READ_MESSAGE':a0_0x48a36c(0x18b),'ERROR_READ_MESSAGE_FORMAT':'readMessage():\x20The\x20format\x20is\x20invalid.\x20Try\x20again\x20with\x20(HTML\x20or\x20TXT)','ERROR_READ_MESSAGE_ATTRIBUTE':a0_0x48a36c(0x1a3),'ERROR_READ_MESSAGE_STATUS_410':a0_0x48a36c(0x183),'ERROR_WRITE_MESSAGE':a0_0x48a36c(0x167),'ERROR_DELETE_MESSAGE':'deleteMessage():\x20Error\x20delete\x20message','ERROR_PARAMETERS_INVALID':a0_0x48a36c(0x1a6),'ERROR_GET_COOKIES':a0_0x48a36c(0x15d),'ERROR_GET_VERSION':a0_0x48a36c(0x177),'ERROR_MISSING_PARAMETERS':a0_0x48a36c(0x17b),'ERROR_GET_TOTAL_MAILS':a0_0x48a36c(0x1aa),'ERROR_GET_YJ':a0_0x48a36c(0x1a2),'ERROR_URL_NOT_FOUND':a0_0x48a36c(0x153),'ERROR_SAVE_HTML':a0_0x48a36c(0x199)},NOTIFY={'NOTIFY_EMAIL_NOT_FOUND':_0x55dc41=>a0_0x48a36c(0x178)['concat'](_0x55dc41,a0_0x48a36c(0x19c)),'NOTIFY_EMAIL_DELETED_SUCCESS':_0xa8c63b=>'The\x20mail\x20with\x20ID\x20['['concat'](_0xa8c63b,a0_0x48a36c(0x1ae)),'NOTIFY_EMAIL_DELETED_FAILED':_0x470d7d=>a0_0x48a36c(0x181)[a0_0x48a36c(0x18d)](_0x470d7d,a0_0x48a36c(0x17f)),'NOTIFY_INBOX_DELETED_SUCCESS':(_0x4613b7,_0x23ff9b)=>a0_0x48a36c(0x161)['concat'](_0x4613b7,']\x20has\x20been\x20deleted.\x20')['concat'](_0x23ff9b,a0_0x48a36c(0x158)),'NOTIFY_INBOX_DELETED_FAILED':_0x5221b7=>a0_0x48a36c(0x171)[a0_0x48a36c(0x18d)](_0x5221b7,a0_0x48a36c(0x155)),'NOTIFY_INBOX_EMPTY':a0_0x48a36c(0x17d)},TEST={'TEST_MAIL':a0_0x48a36c(0x16c),'TEST_MAIL_RECEIVER':a0_0x48a36c(0x193)};module[a0_0x48a36c(0x166)]=Object[a0_0x48a36c(0x1a9)]({...URLS,...HTTP_CONFIG,...PATHS,...SELECTORS,...REGEXES,...ERRORS,...NOTIFY,...TEST});function a0_0x5d84(){const _0x25973c=[':T=','].\x20Try\x20again\x20later.','ID=9a0b3cce9ff31bac','occurred\x20a\x20error\x20when\x20trying\x20to\x20delete\x20the\x20mail\x20with\x20ID\x20[','iframe','readMessage():\x20The\x20message\x20has\x20been\x20deleted\x20or\x20does\x20not\x20exist.\x20Try\x20reviewing\x20the\x20ID','*/*','&ctrl=&yp=',';\x20ytime=','AA-Afjb4QKVvFIwSmOYMSnui2gGd','/inbox?login=','navigate',';\x20compte=','readMessage():\x20Error\x20read\x20message','&v=','concat','/writepost','div.fl\x20>\x20div.md.text.zoom.nw.f24\x20>\x20span.ellipsis.b','tests/archives/mailHTML_content.html','input#yp','6qQaeGo','receiver01@yopmail.com','tests/archives/inbox.json','Mozilla/5.0\x20(Windows\x20NT\x2010.0;\x20Win64;\x20x64)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/113.0.0.0\x20Safari/537.36','856812rZAhOX','text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8','#geny','Error\x20saving\x20HTML\x20file','&p=1&d=','tests/archives/mailHTML_id.html',']\x20was\x20not\x20found\x20and\x20could\x20not\x20be\x20deleted.','ALNI_MbohrBpXt1O26O3LDmi-KRsCVPhcw','/write?b=','#mail','yopmail.com','/email-generator','Error\x20getting\x20YJ','readMessage():\x20Attribute\x20cannot\x20be\x20accessed\x20if\x20no\x20selector\x20is\x20defined','https://yopmail.com/','div.fl\x20>\x20div.ellipsis.nw.b.f18','validateSearch():\x20-\x20The\x20parameters\x20are\x20incorrect.\x20Try\x20again\x20with\x20(id,\x20from,\x20subject\x20or\x20timestamp)','230248DUgssO','div.fl\x20>\x20div.md.text.zoom.nw.f24\x20>\x20span.ellipsis:last-child','freeze','Error\x20getting\x20total\x20number\x20of\x20mails','1699165nzLvcT','deleteInbox():\x20Error\x20delete\x20Inbox\x20page',';\x20__gpi=',']\x20has\x20been\x20successfully\x20deleted.','https://yopmail.com','\x22;\x20FCNEC=','Windows','UID=00000a0a4f90dd17','105RVzQgi','URL\x20not\x20found,\x20Please\x20check\x20the\x20URL\x20try\x20again','same-origin','.\x20Try\x20again\x20later.','&r_c=&id=&ad=0',';compte=','\x20emails\x20have\x20been\x20deleted.','/wm','104Dksxae','\x22Not_A\x20Brand\x22;v=\x2299\x22,\x20\x22Chromium\x22;v=\x22121\x22,\x20\x22Google\x20Chrome\x22;v=\x22121\x22',':S=','Error\x20getting\x20cookies','%5B%5B%22AKsRol_M2LZFqBb7LSYXadLKqvJ5hTBhxAex9zsoE4N4YD_W5EKTjaIdnSjUL1onQWaOaUq-2HI8vZCE9bqnfMfFE9XOzzqfKK3c3UA5WvJQYW6YtylSfhXH3FZ4WTR9pzl8dTHsGaiJSwztPBvgXHwUPGcOlsELSQ%3D%3D%22%5D%5D','825212ysjlFR','&yp=','The\x20inbox\x20of\x20the\x20email\x20[','parameters\x20\x27mail\x27\x20is\x20required','gzip,\x20deflate,\x20br,\x20zstd','/mail?b=','tests/archives/mailContent.json','exports','writeMessage():\x20Error\x20write\x20message','getInbox():\x20Error\x20getting\x20Inbox\x20page',';\x20__eoi=\x22',';\x20ywm=','tests/archives/mailHTML_subject.html','test@yopmail.com',':RT=','3015MfeWBM','&yj=','cors','An\x20error\x20occurred\x20when\x20trying\x20to\x20delete\x20the\x20inbox\x20of\x20the\x20email\x20','17568529hAyToA','36750qxlTmv',';\x20__gads=','empty','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','Error\x20getting\x20version.\x20Error\x20loading\x20page','The\x20mail\x20with\x20ID\x20[','5997jXUFbF','&id=','Missing\x20parameters','&id=i','The\x20inbox\x20is\x20empty'];a0_0x5d84=function(){return _0x25973c;};return a0_0x5d84();} \ No newline at end of file diff --git a/src/core.js b/src/core.js index 01df7cc..8c39447 100644 --- a/src/core.js +++ b/src/core.js @@ -1 +1 @@ -"use strict";function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}const fs=require("fs"),zlib=require("zlib"),https=require("https"),cheerio=require("cheerio"),constants=require("./constants");class Core{constructor(){_defineProperty(this,"validateSelectAttrEQ",((a,b,c,d,e)=>(b&&0===a(b).length?e.push("Warning - The selector <".concat(b,"> is not found in the html.")):d>a(b).length&&e.push("Warning - The eq(".concat(d,") is greater than the number of elements found in the selector ").concat(b,".")),e))),_defineProperty(this,"getContentBySelectorForTxt",((a,b,c,d,e)=>{let f=[];return e=this.validateSelectAttrEQ(a,b,c,d,e),b||(f+=a(this.constants.S_MAIL).text().replace(/\s+|\n/gm," ").trim()),b&&!d&&a(b).each(((b,c)=>{f.push(a(c).text().trim())})),b&&d&&(f+=a(b).eq(parseInt(d,10)).text().replace(/\s+|\n/gm," ").trim(),!f&&e.push("Warning - No text found with selector <".concat(b,"> and .eq(").concat(d,")"))),{info:e,content:f}})),_defineProperty(this,"getContentBySelectorForHTML",((a,b,c,d,e)=>{let f;if(e=this.validateSelectAttrEQ(a,b,c,d,e),!b)return f=a.html(this.constants.S_MAIL),{info:e,content:f};if(f=(()=>c?void 0!==d&&null!==d?a(b).eq(parseInt(d,10)).attr(c):a(b).map(((b,d)=>a(d).attr(c))).toArray():void 0!==d&&null!==d?a(b).eq(parseInt(d,10)).html():a(b).map(((b,c)=>a.html(c))).toArray())(),!f||Array.isArray(f)&&!f.length){let a="Element not found";a+=" with selector ".concat(b),a+=c?" and attribute ".concat(c):"",a+=void 0===d?"":" and eq ".concat(d),e.push(a)}return{info:e,content:f}})),this.constants=constants,this.cwd=process.cwd()}async request(a,b){let c=2{const c=Buffer.concat(b).toString();return{statusCode:a.statusCode,headers:a.headers,body:c}},f=(a,b,c)=>{const d=a.headers["content-encoding"];let f=a;"gzip"===d?f=a.pipe(zlib.createGunzip()):"deflate"===d&&(f=a.pipe(zlib.createInflate()));const g=[];f.on("data",(a=>g.push(a))),f.on("end",(()=>b(e(a,g)))),f.on("error",(a=>c(a)))},g=((a,b,c)=>{const d=new URL(a);return{hostname:d.hostname,port:443,path:"".concat(d.pathname).concat(d.search),method:b.toUpperCase(),...c}})(b,a,c),h=(a,b)=>new Promise(((c,d)=>{const e=https.request(a,(a=>{f(a,c,d)}));e.on("error",(a=>d(a))),a.body&&e.write(a.body),"POST"===a.method&&b&&e.write(b),e.end()}));try{return await h(g,d)}catch(a){this.handleError({customMessage:"Request Error",error:a})}}async getHttpSettings(){try{const a=await this.request("GET",this.constants.URL_BASE);200!==a.statusCode&&this.handleError({customMessage:this.constants.ERROR_GET_COOKIES});const b=this.loadHTMl(a.body),c=b(this.constants.S_INPUT_YP).val(),d=a.headers["set-cookie"].map((a=>a.split(";")[0])).join("; "),e=a.body.match(this.constants.REGEX_LOCATION)[1],f=a.body.match(this.constants.REGEX_VER)[1],g=await this.request("GET",this.constants.URL_WEBMAIL_JS(f),{headers:{Cookie:d}});200!==g.statusCode&&this.handleError({customMessage:this.constants.ERROR_GET_YJ});const h=g.body.match(this.constants.REGEX_YJ),i=h?h[1]:null,j=this.timeStampInSeconds(),k=this.timeStampInSeconds(),l=this.obtenerYTime(j);return{location:e,version:f,cookie:d,yp:c,yj:i,T:j,RT:k,ytime:l}}catch(a){return this.handleError({customMessage:this.constants.ERROR_GET_COOKIES,error:a}),null}}async detailInbox(a,b,c,d){const{location:e,version:f,cookie:g,yp:h,yj:i,T:j,RT:k,ytime:l}=d,m=15;let n=1,o=!0,p={},q=0,r=[],s={};const t=async(a,b,c,d,e,f,g)=>{let h=constants.URL_INBOX(a,b,c,d,f,g),i=constants.HEADERS_INBOX(e,a,g,j,k,l);const m=await this.request("GET",h,i);return 200!==m.statusCode&&this.handleError({customMessage:constants.ERROR_LOAD_PAGE}),m};b&&0=w||n>=c.LIMIT?o=!1:n+=1}return{mail:"".concat(a,"@yopmail.com"),settings:c,filteredSearch:s,pageCount:Math.ceil(w/m),totalEmails:w,emailsPerPageCount:p,exploredPageCount:q,fetchedEmailCount:r.length,inbox:r}}getDetailInboxFromPage(a,b,c){const d=this.loadHTMl(a),e=d(".m");return e.map(((a,b)=>this.parseEmail(b,c))).toArray().filter((a=>this.shouldIncludeEmail(a,b)))}loadHTMl(a){return cheerio.load(a)}getTotalMails(a){const b=a.match(constants.REGEX_TOTAL_MAILS);let c=0;return b&&(c=b[1].split(",")[0]),+c}saveEmailHTML(a,b,c){let d="".concat(this.cwd,"/").concat(a);fs.existsSync(d)||fs.mkdirSync(d,{recursive:!0}),fs.writeFileSync("".concat(d,"/emailPage_").concat(c,".html"),b,(function(a){if(a)return new Error(a)}))}validateSearch(a){const b=["id","from","subject","timestamp"],c=b.some((b=>Object.keys(a).includes(b)||null));return c||this.handleError({customMessage:this.constants.ERROR_PARAMETERS_INVALID,error:new Error}),Object.keys(a).reduce(((c,d)=>(b.includes(d)&&(c[d]=a[d]),c)),{})}parseEmail(a,b){const c=cheerio.load(a),d=c(a).attr("id"),e=c(a).find(".lmh").text(),f=c(a).find(".lmf").text(),g=c(a).find(".lms").text();return{id:d,from:f,subject:g,timestamp:e,page:b}}shouldIncludeEmail(a,b){return Object.entries(b).every((b=>{let[c,d]=b;return"id"===c?a.id===d:"from"===c?a.from===d:"subject"===c?a.subject===d:!("timestamp"!==c)&&a.timestamp===d}))}obtenerYTime(a){const b=new Date(1e3*a),c=b.getHours(),d=b.getMinutes();return"".concat(c,":").concat(d,";")}timeStampInSeconds(){return Math.floor(Date.now()/1e3)}simplifyEmail(a){return-1{["html","txt"].includes(b.toLowerCase())||(c.push("Warning - the format ".concat(b," is incorrect, the default format is TXT")),a.format="txt")},h=(a,b,c)=>{const d=null===b||void 0===b?void 0:b.match(/^(.+)\.eq\((\d+)\)$/);if(d){const[,b,c]=d;a.eq=c,a.selector=b}else if(null!==b&&void 0!==b&&b.includes(".eq(")){const[d]=b.split(".eq(");a.selector=d,a.eq=null,c.push('Warning - the ".eq()" value is invalid, the default eq is null')}},i=(a,b,c,d)=>{c&&!b?(d.push("Warning - the attribute requires a selector, the default attribute is null"),a.attribute=null):c&&"string"!=typeof c&&(d.push("Warning - the attribute ".concat(c," is incorrect, the default attribute is empty")),a.attribute=null)},j=(a,b,c)=>{b&&"string"!=typeof b&&(c.push("Warning - the pathToSave ".concat(b," is incorrect, the default pathToSave is empty")),a.pathToSave=null)};return g(a,e,f),((a,b,c)=>{b&&"string"!=typeof b?(c.push("Warning - the selector ".concat(b," is incorrect, the default selector is null")),a.selector=null):h(a,b,c)})(a,b,f),i(a,b,c,f),j(a,d,f),{opt:a,info:f}}handleError(){let{customMessage:b=this.constants.ERROR_LOAD_PAGE,error:a}=0(b&&0===a(b).length?e.push("Warning - The selector <".concat(b,"> is not found in the html.")):d>a(b).length&&e.push("Warning - The eq(".concat(d,") is greater than the number of elements found in the selector ").concat(b,".")),e))),_defineProperty(this,"getContentBySelectorForTxt",((a,b,c,d,e)=>{let f=[];return e=this.validateSelectAttrEQ(a,b,c,d,e),b||(f+=a(this.constants.S_MAIL).text().replace(/\s+|\n/gm," ").trim()),b&&!d&&a(b).each(((b,c)=>{f.push(a(c).text().trim())})),b&&d&&(f+=a(b).eq(parseInt(d,10)).text().replace(/\s+|\n/gm," ").trim(),!f&&e.push("Warning - No text found with selector <".concat(b,"> and .eq(").concat(d,")"))),{info:e,content:f}})),_defineProperty(this,"getContentBySelectorForHTML",((a,b,c,d,e)=>{let f;if(e=this.validateSelectAttrEQ(a,b,c,d,e),!b)return f=a.html(this.constants.S_MAIL),{info:e,content:f};if(f=(()=>c?void 0!==d&&null!==d?a(b).eq(parseInt(d,10)).attr(c):a(b).map(((b,d)=>a(d).attr(c))).toArray():void 0!==d&&null!==d?a(b).eq(parseInt(d,10)).html():a(b).map(((b,c)=>a.html(c))).toArray())(),!f||Array.isArray(f)&&!f.length){let a="Element not found";a+=" with selector ".concat(b),a+=c?" and attribute ".concat(c):"",a+=void 0===d?"":" and eq ".concat(d),e.push(a)}return{info:e,content:f}})),this.constants=constants,this.cwd=process.cwd()}async request(a,b){let c=2{const c=Buffer.concat(b).toString();return{statusCode:a.statusCode,headers:a.headers,body:c}},f=(a,b,c)=>{const d=a.headers["content-encoding"];let f=a;"gzip"===d?f=a.pipe(zlib.createGunzip()):"deflate"===d&&(f=a.pipe(zlib.createInflate()));const g=[];f.on("data",(a=>g.push(a))),f.on("end",(()=>b(e(a,g)))),f.on("error",(a=>c(a)))},g=((a,b,c)=>{const d=new URL(a);return{hostname:d.hostname,port:443,path:"".concat(d.pathname).concat(d.search),method:b.toUpperCase(),...c}})(b,a,c),h=(a,b)=>new Promise(((c,d)=>{const e=https.request(a,(a=>{f(a,c,d)}));e.on("error",(a=>d(a))),a.body&&e.write(a.body),"POST"===a.method&&b&&e.write(b),e.end()}));try{return await h(g,d)}catch(a){this.handleError({customMessage:"Request Error",error:a})}}async getHttpSettings(){try{const a=await this.request("GET",this.constants.URL_BASE);200!==a.statusCode&&this.handleError({customMessage:this.constants.ERROR_GET_COOKIES});const b=this.loadHTMl(a.body),c=b(this.constants.S_INPUT_YP).val(),d=a.headers["set-cookie"].map((a=>a.split(";")[0])).join("; "),e=a.body.match(this.constants.REGEX_LOCATION)[1],f=a.body.match(this.constants.REGEX_VER)[1],g=await this.request("GET",this.constants.URL_WEBMAIL_JS(f),{headers:{Cookie:d}});200!==g.statusCode&&this.handleError({customMessage:this.constants.ERROR_GET_YJ});const h=g.body.match(this.constants.REGEX_YJ),i=h?h[1]:null,j=this.timeStampInSeconds(),k=this.timeStampInSeconds(),l=this.obtenerYTime(j);return{location:e,version:f,cookie:d,yp:c,yj:i,T:j,RT:k,ytime:l}}catch(a){return this.handleError({customMessage:this.constants.ERROR_GET_COOKIES,error:a}),null}}async detailInbox(a,b,c,d){const{location:e,version:f,cookie:g,yp:h,yj:i,T:j,RT:k,ytime:l}=d,m=15;let n=1,o=!0,p={},q=0,r=[],s={};const t=async(a,b,c,d,e,f,g)=>{let h=constants.URL_INBOX(a,b,c,d,f,g),i=constants.HEADERS_INBOX(e,a,g,j,k,l);const m=await this.request("GET",h,i);return 200!==m.statusCode&&this.handleError({customMessage:constants.ERROR_LOAD_PAGE}),m};b&&0=w||n>=c.LIMIT?o=!1:n+=1}return{mail:"".concat(a,"@yopmail.com"),settings:c,filteredSearch:s,pageCount:Math.ceil(w/m),totalEmails:w,emailsPerPageCount:p,exploredPageCount:q,fetchedEmailCount:r.length,inbox:r}}getDetailInboxFromPage(a,b,c){const d=this.loadHTMl(a),e=d(".m");return e.map(((a,b)=>this.parseEmail(b,c))).toArray().filter((a=>this.shouldIncludeEmail(a,b)))}loadHTMl(a){return cheerio.load(a)}getTotalMails(a){const b=a.match(constants.REGEX_TOTAL_MAILS);let c=0;return b&&(c=b[1].split(",")[0]),+c}saveEmailHTML(a,b,c){let d="".concat(this.cwd,"/").concat(a);fs.existsSync(d)||fs.mkdirSync(d,{recursive:!0}),fs.writeFileSync("".concat(d,"/emailPage_").concat(c,".html"),b,(function(a){if(a)return new Error(a)}))}validateSearch(a){const b=["id","from","subject","timestamp"],c=b.some((b=>Object.keys(a).includes(b)||null));return c||this.handleError({customMessage:this.constants.ERROR_PARAMETERS_INVALID,error:new Error}),Object.keys(a).reduce(((c,d)=>(b.includes(d)&&(c[d]=a[d]),c)),{})}parseEmail(a,b){const c=cheerio.load(a),d=c(a).attr("id"),e=c(a).find(".lmh").text(),f=c(a).find(".lmf").text(),g=c(a).find(".lms").text();return{id:d,from:f,subject:g,timestamp:e,page:b}}shouldIncludeEmail(a,b){return Object.entries(b).every((b=>{let[c,d]=b;return"id"===c?a.id===d:"from"===c?a.from===d:"subject"===c?a.subject===d:!("timestamp"!==c)&&a.timestamp===d}))}obtenerYTime(a){const b=new Date(1e3*a),c=b.getHours(),d=b.getMinutes();return"".concat(c,":").concat(d)}timeStampInSeconds(){return Math.floor(Date.now()/1e3)}simplifyEmail(a){return-1{["html","txt"].includes(b.toLowerCase())||(c.push("Warning - the format ".concat(b," is incorrect, the default format is TXT")),a.format="txt")},h=(a,b,c)=>{const d=null===b||void 0===b?void 0:b.match(/^(.+)\.eq\((\d+)\)$/);if(d){const[,b,c]=d;a.eq=c,a.selector=b}else if(null!==b&&void 0!==b&&b.includes(".eq(")){const[d]=b.split(".eq(");a.selector=d,a.eq=null,c.push('Warning - the ".eq()" value is invalid, the default eq is null')}},i=(a,b,c,d)=>{c&&!b?(d.push("Warning - the attribute requires a selector, the default attribute is null"),a.attribute=null):c&&"string"!=typeof c&&(d.push("Warning - the attribute ".concat(c," is incorrect, the default attribute is empty")),a.attribute=null)},j=(a,b,c)=>{b&&"string"!=typeof b&&(c.push("Warning - the pathToSave ".concat(b," is incorrect, the default pathToSave is empty")),a.pathToSave=null)};return g(a,e,f),((a,b,c)=>{b&&"string"!=typeof b?(c.push("Warning - the selector ".concat(b," is incorrect, the default selector is null")),a.selector=null):h(a,b,c)})(a,b,f),i(a,b,c,f),j(a,d,f),{opt:a,info:f}}handleError(){let{customMessage:b=this.constants.ERROR_LOAD_PAGE,error:a}=0