-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
11 lines (11 loc) · 3.6 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
(function(a,b){if("function"==typeof define&&define.amd)define([],b);else if("undefined"!=typeof exports)b();else{b(),a.index={exports:{}}.exports}})(this,function(){"use strict";function a(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function b(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(b){a(i,e,f,g,h,"next",b)}function h(b){a(i,e,f,g,h,"throw",b)}var i=b.apply(c,d);g(void 0)})}}function c(a){return a.replace(/\B(?=(\d{2})+(?!\d))/g,",")}function d(a){return a.replace(/\./g,"")}function e(a,b,c){const d=[];for(let e=b-1;e<=c-1;e++)d.push(a[e]);return d}function f(){return g.apply(this,arguments)}// eslint-disable-next-line func-names
function g(){return g=b(function*(a,b){// eslint-disable-next-line prefer-const
let f,g,i=h.load(a);if(4>i("body").text().split("|").length)return Promise.resolve(JSON.stringify({err:"Resultado n\xE3o disponivel!",errCode:1}));try{f=i("body").text().split("|")}catch(a){return Promise.reject(JSON.stringify(a))}if("megasena"===b)try{g={numberRaffle:f[0],locationRaffle:`${f[14]},${f[12]},${f[13]}`,unorNumbers:c(f[2]),orderedNumbers:c(f[20]),date:f[11],totalCollection:f[24],// eslint-disable-next-line radix
isAccumulated:0===parseInt(f[3]),sena:{winners:d(f[3]),prizeByWinner:f[4]},quina:{winners:d(f[5]),prizeByWinner:f[6]},quadra:{winners:d(f[7]),prizeByWinner:f[8]},nextRaffle:{date:f[22],estimatedPrize:f[21],accumulated:f[1]},accumulatedMegavirada:f[23]// eslint-disable-next-line semi
}}catch(a){return Promise.reject(JSON.stringify(a))}if("quina"===b)try{g={numberRaffle:f[0],locationRaffle:`${f[4]},${f[2]},${f[3]}`,unorNumbers:e(c(f[14]).split(","),1,5).join(","),orderedNumbers:e(c(f[14]).split(","),6,10).join(","),date:f[16],totalCollection:f[20],// eslint-disable-next-line radix
isAccumulated:0===parseInt(f[6]),quina:{winners:d(f[6]),prizeByWinner:f[7]},quadra:{winners:d(f[8]),prizeByWinner:f[9]},terno:{winners:d(f[10]),prizeByWinner:f[11]},duque:{winners:d(f[23]),prizeByWinner:f[22]},nextRaffle:{date:f[18],estimatedPrize:f[17],accumulated:f[13]},accumulatedSaoJoao:f[21]// eslint-disable-next-line semi
}}catch(a){return Promise.reject(JSON.stringify(a))}if("lotofacil"===b)try{g={numberRaffle:f[0],locationRaffle:`${f[31]},${f[32]},${f[33]}`,unorNumbers:e(f,39,53).join(","),orderedNumbers:e(f,4,18).join(","),date:f[34],totalCollection:f[55],// eslint-disable-next-line radix
isAccumulated:0===parseInt(f[18]),acertos15:{winners:d(f[18]),prizeByWinner:f[19]},acertos14:{winners:d(f[20]),prizeByWinner:f[21]},acertos13:{winners:d(f[22]),prizeByWinner:f[23]},acertos12:{winners:d(f[24]),prizeByWinner:f[25]},acertos11:{winners:d(f[26]),prizeByWinner:f[27]},nextRaffle:{date:f[54],estimatedPrize:f[53],accumulated:f[56]}// eslint-disable-next-line semi
}}catch(a){return Promise.reject(JSON.stringify(a))}return Promise.resolve(g)}),g.apply(this,arguments)}const h=require("cheerio"),i=require("request-promise");Object.defineProperty(exports,"__esModule",{value:!0}),exports.resultByNumber=/*#__PURE__*/function(){var a=b(function*(a,b){let c;if(b===void 0)try{return c=yield i(`http://www1.caixa.gov.br/loterias/loterias/${a}/${a}_pesquisa_new.asp`,{jar:!0,encoding:"binary"}),yield f(c,a)}catch(a){return Promise.reject(JSON.stringify(a.error))}else try{return c=yield i(`http://www1.caixa.gov.br/loterias/loterias/${a}/${a}_pesquisa_new.asp?submeteu=sim&opcao=concurso&txtConcurso=${b}`,{jar:!0,encoding:"binary"}),yield f(c,a)}catch(a){return Promise.reject(JSON.stringify(a.error))}// eslint-disable-next-line semi
});return function(){return a.apply(this,arguments)}}()});
//# sourceMappingURL=index.js.map