node_two_captcha_fork_emd
Version:
Node.js package for easy integration with 2Captcha API (Captcha Solver as a Service)
127 lines (96 loc) • 2.65 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: captcha.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: captcha.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>'use strict';
/**
* Represents a captcha
* @class
*/
class Captcha {
/**
* Captcha ID, as provided from 2Captcha
*
* @return {string} Captcha ID
*/
get id() {
return this._id;
}
set id(newId) {
this._id = newId;
}
/**
* Text from captcha
*
* @return {string} Captcha text
*/
get text() {
return this._text;
}
set text(newText) {
this._text = newText;
}
/**
* API response for captcha request
*
* @return {string} API response
*/
get apiResponse() {
return this._apiResponse;
}
set apiResponse(newApiResponse) {
this._apiResponse = newApiResponse;
}
/**
* If the captcha sent was tile-like, this function returns the indexes of the
* clicks on an array.
*
* @return {Number[]} An array of indexes clicked
*/
indexes() {
return this._text.replace('click:', '').match(/\d+/g).map(Number);
}
/**
* If the captcha sent was a image, this function returns the coordinates
* (X, Y) clicked
*
* @return {Number[][]} An array of coordinate tuples
*/
coordinates() {
const coordinateParser = function(text) {
const match = text.match(/x=([0-9]+),y=([0-9]+)/);
return [Number(match[1]), Number(match[2])];
}
return this._text.match(/x=([0-9]+),y=([0-9]+)/g).map(coordinateParser);
}
}
module.exports = Captcha;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Captcha.html">Captcha</a></li><li><a href="HTTPRequest.html">HTTPRequest</a></li><li><a href="TwoCaptchaClient.html">TwoCaptchaClient</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Mon May 17 2021 19:14:49 GMT-0300 (Brasilia Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>