get-mexican-data-by-curp
Version:
Verify CURP and obtain personal information from the Mexican government CURP. It scrapes official site and another providers.
40 lines (39 loc) • 1.69 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CaptchaSolver = void 0;
const Captcha = __importStar(require("2captcha"));
class CaptchaSolver {
constructor(key) {
this.key = key;
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
this.solver = new Captcha.Solver(this.key);
}
/**
* Returns the answer token (captcha solution)
* https://2captcha.com/2captcha-api#solving_captchas
*/
async solve(googlekey, pageurl) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call
return (await this.solver.recaptcha(googlekey, pageurl)).data;
}
}
exports.CaptchaSolver = CaptchaSolver;