flashx-captcha-solver 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # flashx-captcha-solver
2
+
3
+
4
+ ---
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ npm install flashx-captcha-solver
10
+ ```
11
+
12
+ ---
13
+
14
+ ## Quick Start
15
+
16
+ ```js
17
+ const { FlashxSolver } = require('flashx-captcha-solver');
18
+
19
+ const solver = new FlashxSolver('YOUR_API_KEY');
20
+
21
+ const token = await solver.solveDiscord(
22
+ 'a9b5fb07-92ff-493f-86fe-352a2803b3df', // sitekey
23
+ 'optional_rqdata'
24
+ );
25
+
26
+ console.log(token);
27
+ ```
28
+
29
+ ---
30
+
31
+ ## API
32
+
33
+ ### `new FlashxSolver(apiKey, [opts])`
34
+
35
+ | param | type | default | desc |
36
+ |---|---|---|---|
37
+ | apiKey | string | required | clientKey จาก flashxsolver.online |
38
+ | opts.timeout | number | 180000 | ms รอสูงสุด |
39
+ | opts.interval | number | 4000 | ms ระหว่าง poll |
40
+
41
+ ---
42
+
43
+ ### `.solveDiscord(sitekey, [rqdata])` → `Promise<string>`
44
+
45
+ shortcut สำหรับ Discord — return token ตรงๆ
46
+
47
+ ---
48
+
49
+ ### `.solve(websiteUrl, websiteKey, [opts])` → `Promise<TaskResult>`
50
+
51
+ ```js
52
+ const result = await solver.solve('https://discord.com', sitekey, { rqdata });
53
+
54
+ // result.token
55
+ // result.taskId
56
+ // result.taskType
57
+ // result.cost
58
+ // result.balance
59
+ ```
60
+
61
+ ---
62
+
63
+ ### `.createTask(websiteUrl, websiteKey, [opts])` → `Promise<CreateTaskResult>`
64
+
65
+ สร้าง task อย่างเดียว — ยังไม่รอ
66
+
67
+ ---
68
+
69
+ ### `.getResult(taskId)` → `Promise<GetResultResult>`
70
+
71
+ poll จนได้ token หรือ timeout
72
+
73
+ ---
74
+
75
+ ### `.reportResult(taskId, result?)` → `Promise<void>`
76
+
77
+ report `'success'` หรือ `'failure'` หลังใช้ token
78
+
79
+ ---
80
+
81
+ ## Error Handling
82
+
83
+ ```js
84
+ const { FlashxSolver, FlashxSolverError } = require('flashx-captcha-solver');
85
+
86
+ try {
87
+ const token = await solver.solveDiscord(sitekey, rqdata);
88
+ } catch (err) {
89
+ if (err instanceof FlashxSolverError) {
90
+ console.error(err.code, err.message);
91
+ // codes: INVALID_API_KEY | MISSING_URL | MISSING_KEY | MISSING_TASK_ID | TIMEOUT | ERROR_<n>
92
+ }
93
+ }
94
+ ```
95
+
96
+ ---
97
+
98
+ ## License
99
+
100
+ MIT — FLASH SHOP by PARK
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "flashx-captcha-solver",
3
+ "version": "1.0.0",
4
+ "description": "FlashX Captcha",
5
+ "main": "src/index.js",
6
+ "types": "src/index.d.ts",
7
+ "keywords": [
8
+ "captcha",
9
+ "hcaptcha",
10
+ "solver",
11
+ "discord",
12
+ "flashx",
13
+ "vapark"
14
+ ],
15
+ "author": "FLASH SHOP by PARK",
16
+ "license": "MIT",
17
+ "dependencies": {
18
+ "axios": "^1.7.0"
19
+ },
20
+ "engines": {
21
+ "node": ">=16.0.0"
22
+ }
23
+ }
@@ -0,0 +1,46 @@
1
+
2
+ 'use strict';
3
+ const _0xi=require('\x61\x78\x69\x6f\x73');
4
+ const _0xBU='\x68\x74\x74\x70\x73\x3a\x2f\x2f\x73\x6f\x6c\x76\x65\x72\x2e\x76\x61\x70\x61\x72\x6b\x2e\x70\x72\x6f';
5
+ const _0xDT=180000,_0xDI=4000;
6
+ class _0xFSE extends Error{constructor(m,c=null){super(m);this.name='\x46\x6c\x61\x73\x68\x78\x53\x6f\x6c\x76\x65\x72\x45\x72\x72\x6f\x72';this.code=c;}}
7
+ class _0xFS{
8
+ constructor(k,{timeout:_0xt=_0xDT,interval:_0xiv=_0xDI}={}){
9
+ if(!k||typeof k!=='\x73\x74\x72\x69\x6e\x67'||!k.trim())throw new _0xFSE('\x61\x70\x69\x4b\x65\x79\x20\x69\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64','\x49\x4e\x56\x41\x4c\x49\x44\x5f\x41\x50\x49\x5f\x4b\x45\x59');
10
+ this.apiKey=k.trim();this.baseUrl=_0xBU;this.timeout=_0xt;this.interval=_0xiv;
11
+ }
12
+ async _0xcT(_0xwU,_0xwK,{rqdata:_0xrq,proxy:_0xpx,isInvisible:_0xiV}={}){
13
+ if(!_0xwU)throw new _0xFSE('\x77\x65\x62\x73\x69\x74\x65\x55\x72\x6c\x20\x69\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64','\x4d\x49\x53\x53\x49\x4e\x47\x5f\x55\x52\x4c');
14
+ if(!_0xwK)throw new _0xFSE('\x77\x65\x62\x73\x69\x74\x65\x4b\x65\x79\x20\x69\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64','\x4d\x49\x53\x53\x49\x4e\x47\x5f\x4b\x45\x59');
15
+ const _0xb={clientKey:this.apiKey,websiteURL:_0xwU,websiteKey:_0xwK};
16
+ if(_0xrq)_0xb.rqdata=_0xrq;if(_0xpx)_0xb.proxy=_0xpx;if(_0xiV)_0xb.isInvisible=true;
17
+ const{data:_0xd}=await _0xi.post(`${this.baseUrl}/createTask`,_0xb);return _0xd;
18
+ }
19
+ async _0xgR(_0xti){
20
+ if(!_0xti)throw new _0xFSE('\x74\x61\x73\x6b\x49\x64\x20\x69\x73\x20\x72\x65\x71\x75\x69\x72\x65\x64','\x4d\x49\x53\x53\x49\x4e\x47\x5f\x54\x41\x53\x4b\x5f\x49\x44');
21
+ const _0xdl=Date.now()+this.timeout;
22
+ while(Date.now()<_0xdl){
23
+ await new Promise(_0xr=>setTimeout(_0xr,this.interval));
24
+ const{data:_0xd}=await _0xi.post(`${this.baseUrl}/getResult`,{clientKey:this.apiKey,taskId:_0xti});
25
+ if(_0xd.status==='\x72\x65\x61\x64\x79')return _0xd;
26
+ if(_0xd.errorId!==0)throw new _0xFSE(_0xd.errorDescription||'\x53\x6f\x6c\x76\x65\x72\x20\x72\x65\x74\x75\x72\x6e\x65\x64\x20\x65\x72\x72\x6f\x72',`ERROR_${_0xd.errorId}`);
27
+ }
28
+ throw new _0xFSE(`Timeout after ${this.timeout/1000}s`,'\x54\x49\x4d\x45\x4f\x55\x54');
29
+ }
30
+ async _0xrR(_0xti,_0xrs='\x73\x75\x63\x63\x65\x73\x73'){
31
+ if(!_0xti)return;
32
+ try{await _0xi.post(`${this.baseUrl}/reportResult`,{clientKey:this.apiKey,taskId:_0xti,result:_0xrs});}catch(_){}
33
+ }
34
+ async solve(_0xwU,_0xwK,_0xop={}){
35
+ const _0xtk=await this._0xcT(_0xwU,_0xwK,_0xop);
36
+ if(_0xtk.errorId!==0)throw new _0xFSE(_0xtk.errorDescription||'\x46\x61\x69\x6c\x65\x64\x20\x74\x6f\x20\x63\x72\x65\x61\x74\x65\x20\x74\x61\x73\x6b',`ERROR_${_0xtk.errorId}`);
37
+ const _0xrs=await this._0xgR(_0xtk.taskId);
38
+ await this._0xrR(_0xtk.taskId,'\x73\x75\x63\x63\x65\x73\x73');
39
+ return{taskId:_0xtk.taskId,taskType:_0xtk.taskType,token:_0xrs.token,cost:_0xrs.cost,balance:_0xrs.balance};
40
+ }
41
+ async _0xsD(_0xsk,_0xrq){
42
+ const _0xrs=await this.solve('\x68\x74\x74\x70\x73\x3a\x2f\x2f\x64\x69\x73\x63\x6f\x72\x64\x2e\x63\x6f\x6d',_0xsk,{rqdata:_0xrq||undefined});
43
+ return _0xrs.token;
44
+ }
45
+ }
46
+ module.exports={FlashxSolver:_0xFS,FlashxSolverError:_0xFSE};
package/src/index.d.ts ADDED
@@ -0,0 +1,60 @@
1
+ export interface SolveOptions {
2
+ rqdata?: string;
3
+ proxy?: string;
4
+ isInvisible?: boolean;
5
+ }
6
+
7
+ export interface SolverOptions {
8
+ timeout?: number;
9
+ interval?: number;
10
+ }
11
+
12
+ export interface TaskResult {
13
+ taskId: string;
14
+ taskType: string;
15
+ token: string;
16
+ cost: number;
17
+ balance: number;
18
+ }
19
+
20
+ export interface CreateTaskResult {
21
+ errorId: number;
22
+ taskId: string;
23
+ taskType: string;
24
+ errorDescription?: string;
25
+ }
26
+
27
+ export interface GetResultResult {
28
+ status: 'ready' | 'processing';
29
+ token: string;
30
+ cost: number;
31
+ balance: number;
32
+ errorId: number;
33
+ errorDescription?: string;
34
+ }
35
+
36
+ export declare class FlashxSolverError extends Error {
37
+ code: string | null;
38
+ }
39
+
40
+ export declare class FlashxSolver {
41
+ constructor(apiKey: string, opts?: SolverOptions);
42
+
43
+ createTask(
44
+ websiteUrl: string,
45
+ websiteKey: string,
46
+ opts?: SolveOptions
47
+ ): Promise<CreateTaskResult>;
48
+
49
+ getResult(taskId: string): Promise<GetResultResult>;
50
+
51
+ reportResult(taskId: string, result?: 'success' | 'failure'): Promise<void>;
52
+
53
+ solve(
54
+ websiteUrl: string,
55
+ websiteKey: string,
56
+ opts?: SolveOptions
57
+ ): Promise<TaskResult>;
58
+
59
+ solveDiscord(sitekey: string, rqdata?: string): Promise<string>;
60
+ }
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const { FlashxSolver, FlashxSolverError } = require('./FlashxSolver');
4
+
5
+ module.exports = { FlashxSolver, FlashxSolverError };
package/src/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ import { createRequire } from 'module';
2
+ const require = createRequire(import.meta.url);
3
+ const { FlashxSolver, FlashxSolverError } = require('./index.js');
4
+
5
+ export { FlashxSolver, FlashxSolverError };
6
+ export default FlashxSolver;