@redonvn/redai-tool 1.0.0 → 1.0.1
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/dist/index.d.mts +121 -29
- package/dist/index.d.ts +121 -29
- package/dist/index.js +287 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +287 -79
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -35,30 +35,83 @@ var GoogleSearchModule = class {
|
|
|
35
35
|
constructor(http) {
|
|
36
36
|
this.http = http;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Chuẩn hóa kết quả cào từ phản hồi DirectSearchResponse của FastAPI
|
|
40
|
+
*/
|
|
41
|
+
normalizeScrapeResponse(data, keyword) {
|
|
42
|
+
const rawItems = data.results || data.data || [];
|
|
43
|
+
const normalizedItems = rawItems.map((item, idx) => {
|
|
44
|
+
const contacts = item.contacts || item.contact_info || {};
|
|
45
|
+
const contactInfo = item.contact_info || item.contacts || {};
|
|
46
|
+
return {
|
|
47
|
+
rank: item.rank ?? idx + 1,
|
|
48
|
+
title: item.title || "",
|
|
49
|
+
url: item.url || "",
|
|
50
|
+
domain: item.domain || "",
|
|
51
|
+
is_sponsored: item.is_sponsored ?? false,
|
|
52
|
+
contacts,
|
|
53
|
+
contact_info: contactInfo,
|
|
54
|
+
summary: item.summary || "",
|
|
55
|
+
crawled_pages: item.crawled_pages || [],
|
|
56
|
+
google_snippet: item.google_snippet || item.snippet || "",
|
|
57
|
+
error: item.error
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
success: data.success ?? true,
|
|
62
|
+
keyword: data.keyword || keyword,
|
|
63
|
+
total_scraped: data.total_results ?? data.total_scraped ?? normalizedItems.length,
|
|
64
|
+
location: data.location,
|
|
65
|
+
results: normalizedItems,
|
|
66
|
+
timestamp: data.timestamp || (/* @__PURE__ */ new Date()).toISOString()
|
|
67
|
+
};
|
|
68
|
+
}
|
|
38
69
|
/**
|
|
39
70
|
* Tìm kiếm danh sách kết quả nhanh trên Google (không crawl sâu chi tiết)
|
|
71
|
+
* Chuẩn REST endpoint: POST /api/google-search/list
|
|
40
72
|
*/
|
|
41
73
|
async list(request, options) {
|
|
74
|
+
const payload = {
|
|
75
|
+
...request,
|
|
76
|
+
limit: request.max_results || request.limit || 10
|
|
77
|
+
};
|
|
42
78
|
const response = await this.http.post(
|
|
43
79
|
"/api/google-search/list",
|
|
44
|
-
|
|
80
|
+
payload,
|
|
45
81
|
options
|
|
46
82
|
);
|
|
47
|
-
|
|
83
|
+
const data = response.data;
|
|
84
|
+
const items = data.results || data.data || [];
|
|
85
|
+
return {
|
|
86
|
+
success: data.success ?? true,
|
|
87
|
+
keyword: data.keyword || request.keyword,
|
|
88
|
+
total_results: data.total_results ?? items.length,
|
|
89
|
+
target_sites: data.target_sites,
|
|
90
|
+
location: data.location,
|
|
91
|
+
results: items,
|
|
92
|
+
timestamp: data.timestamp || (/* @__PURE__ */ new Date()).toISOString()
|
|
93
|
+
};
|
|
48
94
|
}
|
|
49
95
|
/**
|
|
50
96
|
* Tìm kiếm Google và bóc tách thông tin liên hệ đa kênh (Hotline, Zalo, FB, Shopee, App, Bộ Công Thương...)
|
|
97
|
+
* Chuẩn REST endpoint: POST /api/google-search/search
|
|
51
98
|
*/
|
|
52
99
|
async scrape(request, options) {
|
|
100
|
+
const payload = {
|
|
101
|
+
...request,
|
|
102
|
+
limit: request.max_results || request.limit || 10,
|
|
103
|
+
deep_crawl: request.deep_crawl ?? true
|
|
104
|
+
};
|
|
53
105
|
const response = await this.http.post(
|
|
54
|
-
"/api/google-search/
|
|
55
|
-
|
|
106
|
+
"/api/google-search/search",
|
|
107
|
+
payload,
|
|
56
108
|
options
|
|
57
109
|
);
|
|
58
|
-
return response.data;
|
|
110
|
+
return this.normalizeScrapeResponse(response.data, request.keyword);
|
|
59
111
|
}
|
|
60
112
|
/**
|
|
61
113
|
* Bóc tách thông tin liên hệ và tóm tắt AI trực tiếp từ một danh sách các URL website
|
|
114
|
+
* Chuẩn REST endpoint: POST /api/google-search/detail
|
|
62
115
|
*/
|
|
63
116
|
async scrapeDetails(request, options) {
|
|
64
117
|
const response = await this.http.post(
|
|
@@ -66,15 +119,42 @@ var GoogleSearchModule = class {
|
|
|
66
119
|
request,
|
|
67
120
|
options
|
|
68
121
|
);
|
|
69
|
-
|
|
122
|
+
const data = response.data;
|
|
123
|
+
const items = data.results || data.data || [];
|
|
124
|
+
const normalizedItems = items.map((item, idx) => {
|
|
125
|
+
const contacts = item.contacts || item.contact_info || {};
|
|
126
|
+
const contactInfo = item.contact_info || item.contacts || {};
|
|
127
|
+
return {
|
|
128
|
+
rank: item.rank ?? idx + 1,
|
|
129
|
+
title: item.title || "",
|
|
130
|
+
url: item.url || "",
|
|
131
|
+
domain: item.domain || "",
|
|
132
|
+
contacts,
|
|
133
|
+
contact_info: contactInfo,
|
|
134
|
+
summary: item.summary || "",
|
|
135
|
+
crawled_pages: item.crawled_pages || [],
|
|
136
|
+
error: item.error
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
success: data.success ?? true,
|
|
141
|
+
total_scraped: data.total_scraped ?? normalizedItems.length,
|
|
142
|
+
results: normalizedItems,
|
|
143
|
+
timestamp: data.timestamp || (/* @__PURE__ */ new Date()).toISOString()
|
|
144
|
+
};
|
|
70
145
|
}
|
|
71
146
|
/**
|
|
72
147
|
* Stream SSE kết quả tìm kiếm và bóc tách theo thời gian thực
|
|
148
|
+
* Chuẩn REST endpoint: GET /api/google-search/stream
|
|
73
149
|
*/
|
|
74
150
|
async stream(request, handlers, options) {
|
|
75
151
|
const params = new URLSearchParams();
|
|
76
152
|
params.set("keyword", request.keyword);
|
|
77
|
-
|
|
153
|
+
const limit = request.max_results || request.limit;
|
|
154
|
+
if (limit) {
|
|
155
|
+
params.set("limit", String(limit));
|
|
156
|
+
params.set("max_results", String(limit));
|
|
157
|
+
}
|
|
78
158
|
if (request.deep_crawl !== void 0) params.set("deep_crawl", String(request.deep_crawl));
|
|
79
159
|
if (request.summary_mode) params.set("summary_mode", request.summary_mode);
|
|
80
160
|
if (request.target_sites?.length) {
|
|
@@ -120,50 +200,40 @@ var GoogleSearchModule = class {
|
|
|
120
200
|
handlers.onError?.(err);
|
|
121
201
|
});
|
|
122
202
|
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// src/modules/google-maps/index.ts
|
|
126
|
-
var GoogleMapsModule = class {
|
|
127
|
-
constructor(http) {
|
|
128
|
-
this.http = http;
|
|
129
|
-
}
|
|
130
203
|
/**
|
|
131
|
-
* Tạo background job cào
|
|
204
|
+
* Tạo background job cào tìm kiếm Google
|
|
205
|
+
* Chuẩn REST endpoint: POST /api/google-search/jobs
|
|
132
206
|
*/
|
|
133
|
-
async createJob(
|
|
207
|
+
async createJob(request, options) {
|
|
208
|
+
const payload = {
|
|
209
|
+
...request,
|
|
210
|
+
limit: request.max_results || request.limit || 10
|
|
211
|
+
};
|
|
134
212
|
const response = await this.http.post(
|
|
135
|
-
"/api/
|
|
213
|
+
"/api/google-search/jobs",
|
|
136
214
|
payload,
|
|
137
215
|
options
|
|
138
216
|
);
|
|
139
217
|
return response.data;
|
|
140
218
|
}
|
|
141
219
|
/**
|
|
142
|
-
* Kiểm tra trạng thái
|
|
220
|
+
* Kiểm tra trạng thái job cào tìm kiếm Google
|
|
221
|
+
* Chuẩn REST endpoint: GET /api/google-search/jobs/{job_id}
|
|
143
222
|
*/
|
|
144
223
|
async getJobStatus(jobId, options) {
|
|
145
224
|
const response = await this.http.get(
|
|
146
|
-
`/api/
|
|
147
|
-
options
|
|
148
|
-
);
|
|
149
|
-
return response.data;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Lấy danh sách kết quả địa điểm thu thập được từ job
|
|
153
|
-
*/
|
|
154
|
-
async getJobResults(jobId, options) {
|
|
155
|
-
const response = await this.http.get(
|
|
156
|
-
`/api/map/jobs/${jobId}/results`,
|
|
225
|
+
`/api/google-search/jobs/${jobId}`,
|
|
157
226
|
options
|
|
158
227
|
);
|
|
159
228
|
return response.data;
|
|
160
229
|
}
|
|
161
230
|
/**
|
|
162
|
-
* Xuất kết quả cào
|
|
231
|
+
* Xuất file CSV/Excel kết quả cào tìm kiếm Google (trả về Buffer)
|
|
232
|
+
* Chuẩn REST endpoint: GET /api/google-search/jobs/{job_id}/export
|
|
163
233
|
*/
|
|
164
234
|
async exportCsv(jobId, options) {
|
|
165
235
|
const response = await this.http.get(
|
|
166
|
-
`/api/
|
|
236
|
+
`/api/google-search/jobs/${jobId}/export`,
|
|
167
237
|
{
|
|
168
238
|
...options,
|
|
169
239
|
responseType: "arraybuffer"
|
|
@@ -171,25 +241,63 @@ var GoogleMapsModule = class {
|
|
|
171
241
|
);
|
|
172
242
|
return Buffer.from(response.data);
|
|
173
243
|
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// src/modules/google-maps/index.ts
|
|
247
|
+
var GoogleMapsModule = class {
|
|
248
|
+
constructor(http) {
|
|
249
|
+
this.http = http;
|
|
250
|
+
}
|
|
174
251
|
/**
|
|
175
|
-
*
|
|
252
|
+
* Tạo background job cào dữ liệu Google Maps
|
|
253
|
+
* Chuẩn REST endpoint: POST /api/map/scrape/async
|
|
176
254
|
*/
|
|
177
|
-
async
|
|
255
|
+
async createJob(payload, options) {
|
|
256
|
+
const response = await this.http.post(
|
|
257
|
+
"/api/map/scrape/async",
|
|
258
|
+
payload,
|
|
259
|
+
options
|
|
260
|
+
);
|
|
261
|
+
return response.data;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Kiểm tra trạng thái và tiến độ của job cào Google Maps
|
|
265
|
+
* Chuẩn REST endpoint: GET /api/map/scrape/status/{job_id}
|
|
266
|
+
*/
|
|
267
|
+
async getJobStatus(jobId, options) {
|
|
178
268
|
const response = await this.http.get(
|
|
179
|
-
`/api/map/
|
|
180
|
-
|
|
181
|
-
...options,
|
|
182
|
-
responseType: "arraybuffer"
|
|
183
|
-
}
|
|
269
|
+
`/api/map/scrape/status/${jobId}`,
|
|
270
|
+
options
|
|
184
271
|
);
|
|
185
|
-
return
|
|
272
|
+
return response.data;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Lấy danh sách kết quả địa điểm thu thập được từ job
|
|
276
|
+
* Dữ liệu nằm trong trường `data` của job status
|
|
277
|
+
*/
|
|
278
|
+
async getJobResults(jobId, options) {
|
|
279
|
+
const status = await this.getJobStatus(jobId, options);
|
|
280
|
+
const places = status.data || [];
|
|
281
|
+
return {
|
|
282
|
+
job_id: jobId,
|
|
283
|
+
status: status.status,
|
|
284
|
+
query: status.query,
|
|
285
|
+
total_found: status.total_found,
|
|
286
|
+
total_scraped: status.total_scraped,
|
|
287
|
+
total_filtered: status.total_filtered,
|
|
288
|
+
total_results: places.length,
|
|
289
|
+
places,
|
|
290
|
+
results: places
|
|
291
|
+
};
|
|
186
292
|
}
|
|
187
293
|
/**
|
|
188
294
|
* Stream SSE tiến độ cào Google Maps theo thời gian thực
|
|
295
|
+
* Chuẩn REST endpoint: POST /api/map/scrape/stream
|
|
189
296
|
*/
|
|
190
|
-
async streamJob(
|
|
191
|
-
const response = await this.http.
|
|
192
|
-
|
|
297
|
+
async streamJob(payload, handlers, options) {
|
|
298
|
+
const response = await this.http.post(
|
|
299
|
+
"/api/map/scrape/stream",
|
|
300
|
+
payload,
|
|
193
301
|
{
|
|
194
302
|
...options,
|
|
195
303
|
responseType: "stream",
|
|
@@ -229,39 +337,73 @@ var GoogleMapsModule = class {
|
|
|
229
337
|
});
|
|
230
338
|
}
|
|
231
339
|
/**
|
|
232
|
-
*
|
|
340
|
+
* Tìm kiếm & gợi ý tối đa 3 địa chỉ chuẩn hóa (Search & Suggest)
|
|
341
|
+
* Chuẩn REST endpoint: POST /api/map/search
|
|
233
342
|
*/
|
|
234
|
-
async
|
|
235
|
-
const payload = typeof address === "string" ? { address } : address;
|
|
343
|
+
async search(req, options) {
|
|
236
344
|
const response = await this.http.post(
|
|
237
|
-
"/api/map/
|
|
345
|
+
"/api/map/search",
|
|
346
|
+
req,
|
|
347
|
+
options
|
|
348
|
+
);
|
|
349
|
+
return response.data;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Giải mã tọa độ GPS sang địa chỉ Google & Goong Maps (Reverse Geocode)
|
|
353
|
+
* Chuẩn REST endpoint: POST /api/map/reverse
|
|
354
|
+
*/
|
|
355
|
+
async reverse(req, options) {
|
|
356
|
+
const payload = {
|
|
357
|
+
lat: req.lat ?? req.latitude,
|
|
358
|
+
lng: req.lng ?? req.longitude,
|
|
359
|
+
origin: req.origin
|
|
360
|
+
};
|
|
361
|
+
const response = await this.http.post(
|
|
362
|
+
"/api/map/reverse",
|
|
238
363
|
payload,
|
|
239
364
|
options
|
|
240
365
|
);
|
|
241
366
|
return response.data;
|
|
242
367
|
}
|
|
243
368
|
/**
|
|
244
|
-
*
|
|
369
|
+
* Tra cứu chi tiết địa điểm Place Details
|
|
370
|
+
* Chuẩn REST endpoint: POST /api/map/lookup
|
|
245
371
|
*/
|
|
246
|
-
async
|
|
372
|
+
async lookup(req, options) {
|
|
247
373
|
const response = await this.http.post(
|
|
248
|
-
"/api/map/
|
|
374
|
+
"/api/map/lookup",
|
|
249
375
|
req,
|
|
250
376
|
options
|
|
251
377
|
);
|
|
252
378
|
return response.data;
|
|
253
379
|
}
|
|
254
380
|
/**
|
|
255
|
-
*
|
|
381
|
+
* Lấy chi tiết địa điểm Google Maps
|
|
382
|
+
* Chuẩn REST endpoint: POST /api/map/place/detail
|
|
256
383
|
*/
|
|
257
|
-
async
|
|
384
|
+
async getPlaceDetail(req, options) {
|
|
258
385
|
const response = await this.http.post(
|
|
259
|
-
"/api/map/
|
|
386
|
+
"/api/map/place/detail",
|
|
260
387
|
req,
|
|
261
388
|
options
|
|
262
389
|
);
|
|
263
390
|
return response.data;
|
|
264
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* Geocode địa chỉ văn bản thành tọa độ (Alias cho search)
|
|
394
|
+
*/
|
|
395
|
+
async geocodeAddress(address, options) {
|
|
396
|
+
const payload = typeof address === "string" ? { address } : address;
|
|
397
|
+
const result = await this.search(payload, options);
|
|
398
|
+
return result;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Reverse geocode tọa độ ra địa chỉ Việt Nam (Alias cho reverse)
|
|
402
|
+
*/
|
|
403
|
+
async reverseGeocode(req, options) {
|
|
404
|
+
const result = await this.reverse(req, options);
|
|
405
|
+
return result;
|
|
406
|
+
}
|
|
265
407
|
};
|
|
266
408
|
|
|
267
409
|
// src/modules/social-tracer/index.ts
|
|
@@ -271,38 +413,75 @@ var SocialTracerModule = class {
|
|
|
271
413
|
}
|
|
272
414
|
/**
|
|
273
415
|
* Lấy danh sách hơn 400+ nền tảng mạng xã hội được hỗ trợ truy vết
|
|
416
|
+
* Chuẩn REST endpoint: GET /api/social-tracer/platforms
|
|
274
417
|
*/
|
|
275
418
|
async getPlatforms(options) {
|
|
276
419
|
const response = await this.http.get(
|
|
277
420
|
"/api/social-tracer/platforms",
|
|
278
421
|
options
|
|
279
422
|
);
|
|
280
|
-
|
|
423
|
+
const data = response.data;
|
|
424
|
+
return {
|
|
425
|
+
count: data.total ?? data.count ?? (Array.isArray(data.platforms) ? data.platforms.length : 0),
|
|
426
|
+
platforms: data.platforms || []
|
|
427
|
+
};
|
|
281
428
|
}
|
|
282
429
|
/**
|
|
283
430
|
* Truy vết đồng bộ danh tính mạng xã hội theo username trên hàng trăm trang
|
|
431
|
+
* Chuẩn REST endpoint: POST /api/social-tracer/search
|
|
284
432
|
*/
|
|
285
433
|
async traceSync(payload, options) {
|
|
434
|
+
const body = {
|
|
435
|
+
username: payload.username,
|
|
436
|
+
platforms: payload.platforms,
|
|
437
|
+
concurrency: payload.concurrency,
|
|
438
|
+
timeout: payload.timeout_per_site || payload.timeout || 8
|
|
439
|
+
};
|
|
286
440
|
const response = await this.http.post(
|
|
287
|
-
"/api/social-tracer/
|
|
288
|
-
|
|
441
|
+
"/api/social-tracer/search",
|
|
442
|
+
body,
|
|
289
443
|
options
|
|
290
444
|
);
|
|
291
|
-
|
|
445
|
+
const data = response.data;
|
|
446
|
+
const rawProfiles = data.profiles || data.results || data.data || [];
|
|
447
|
+
const normalizedResults = rawProfiles.map((p) => {
|
|
448
|
+
const isClaimed = p.status === "claimed" || p.status === "FOUND";
|
|
449
|
+
const isAvailable = p.status === "available" || p.status === "NOT_FOUND";
|
|
450
|
+
return {
|
|
451
|
+
platform: p.platform || p.platform_id || "",
|
|
452
|
+
url: p.url_user || p.url || "",
|
|
453
|
+
status: isClaimed ? "FOUND" : isAvailable ? "NOT_FOUND" : String(p.status).toUpperCase(),
|
|
454
|
+
http_status: p.http_status,
|
|
455
|
+
response_time: p.response_time_ms ?? p.response_time,
|
|
456
|
+
category: p.context || p.category
|
|
457
|
+
};
|
|
458
|
+
});
|
|
459
|
+
const totalFound = data.total_found ?? data.found_count ?? normalizedResults.filter((r) => r.status === "FOUND").length;
|
|
460
|
+
const totalChecked = data.total_checked ?? normalizedResults.length;
|
|
461
|
+
return {
|
|
462
|
+
username: data.username || payload.username,
|
|
463
|
+
total_checked: totalChecked,
|
|
464
|
+
found_count: totalFound,
|
|
465
|
+
not_found_count: data.not_found_count ?? totalChecked - totalFound,
|
|
466
|
+
duration_seconds: data.duration_seconds ?? 0,
|
|
467
|
+
results: normalizedResults
|
|
468
|
+
};
|
|
292
469
|
}
|
|
293
470
|
/**
|
|
294
471
|
* Stream SSE quá trình truy vết mạng xã hội thời gian thực
|
|
472
|
+
* Chuẩn REST endpoint: GET /api/social-tracer/stream
|
|
295
473
|
*/
|
|
296
474
|
async streamTrace(payload, handlers, options) {
|
|
297
475
|
const params = new URLSearchParams();
|
|
298
476
|
params.set("username", payload.username);
|
|
299
|
-
|
|
477
|
+
const timeout = payload.timeout_per_site || payload.timeout;
|
|
478
|
+
if (timeout) params.set("timeout", String(timeout));
|
|
300
479
|
if (payload.concurrency) params.set("concurrency", String(payload.concurrency));
|
|
301
480
|
if (payload.platforms?.length) {
|
|
302
|
-
|
|
481
|
+
params.set("platforms", payload.platforms.join(","));
|
|
303
482
|
}
|
|
304
483
|
const response = await this.http.get(
|
|
305
|
-
`/api/social-tracer/
|
|
484
|
+
`/api/social-tracer/stream?${params.toString()}`,
|
|
306
485
|
{
|
|
307
486
|
...options,
|
|
308
487
|
responseType: "stream",
|
|
@@ -343,6 +522,7 @@ var SocialTracerModule = class {
|
|
|
343
522
|
}
|
|
344
523
|
/**
|
|
345
524
|
* Tạo background job truy vết danh tính mạng xã hội
|
|
525
|
+
* Chuẩn REST endpoint: POST /api/social-tracer/jobs
|
|
346
526
|
*/
|
|
347
527
|
async createJob(payload, options) {
|
|
348
528
|
const response = await this.http.post(
|
|
@@ -354,6 +534,7 @@ var SocialTracerModule = class {
|
|
|
354
534
|
}
|
|
355
535
|
/**
|
|
356
536
|
* Kiểm tra trạng thái job truy vết
|
|
537
|
+
* Chuẩn REST endpoint: GET /api/social-tracer/jobs/{job_id}
|
|
357
538
|
*/
|
|
358
539
|
async getJobStatus(jobId, options) {
|
|
359
540
|
const response = await this.http.get(
|
|
@@ -367,19 +548,29 @@ var SocialTracerModule = class {
|
|
|
367
548
|
*/
|
|
368
549
|
async getJobResults(jobId, options) {
|
|
369
550
|
const response = await this.http.get(
|
|
370
|
-
`/api/social-tracer/jobs/${jobId}
|
|
551
|
+
`/api/social-tracer/jobs/${jobId}`,
|
|
371
552
|
options
|
|
372
553
|
);
|
|
373
|
-
|
|
554
|
+
const data = response.data;
|
|
555
|
+
const profiles = data.data || data.profiles || data.results || [];
|
|
556
|
+
return {
|
|
557
|
+
job_id: jobId,
|
|
558
|
+
status: data.status,
|
|
559
|
+
username: data.username || "",
|
|
560
|
+
total_results: data.total_results || profiles.length,
|
|
561
|
+
results: profiles
|
|
562
|
+
};
|
|
374
563
|
}
|
|
375
564
|
/**
|
|
376
565
|
* Xuất file CSV kết quả truy vết mạng xã hội (trả về Buffer)
|
|
566
|
+
* Chuẩn REST endpoint: GET /api/social-tracer/jobs/{job_id}/export
|
|
377
567
|
*/
|
|
378
568
|
async exportCsv(jobId, options) {
|
|
379
569
|
const response = await this.http.get(
|
|
380
|
-
`/api/social-tracer/jobs/${jobId}/export
|
|
570
|
+
`/api/social-tracer/jobs/${jobId}/export`,
|
|
381
571
|
{
|
|
382
572
|
...options,
|
|
573
|
+
params: { only_found: true, ...options?.params || {} },
|
|
383
574
|
responseType: "arraybuffer"
|
|
384
575
|
}
|
|
385
576
|
);
|
|
@@ -484,6 +675,7 @@ var IpGeolocationModule = class {
|
|
|
484
675
|
}
|
|
485
676
|
/**
|
|
486
677
|
* Tra cứu vị trí địa lý, tọa độ GPS (lat, lon) và nhà mạng ISP từ 1 hoặc nhiều IP
|
|
678
|
+
* Chuẩn REST endpoint: POST /api/ip-location/check
|
|
487
679
|
*/
|
|
488
680
|
async lookup(request, options) {
|
|
489
681
|
let payload;
|
|
@@ -495,7 +687,7 @@ var IpGeolocationModule = class {
|
|
|
495
687
|
payload = request;
|
|
496
688
|
}
|
|
497
689
|
const response = await this.http.post(
|
|
498
|
-
"/api/ip-location",
|
|
690
|
+
"/api/ip-location/check",
|
|
499
691
|
payload,
|
|
500
692
|
options
|
|
501
693
|
);
|
|
@@ -503,6 +695,7 @@ var IpGeolocationModule = class {
|
|
|
503
695
|
}
|
|
504
696
|
/**
|
|
505
697
|
* Tự động lấy IP Public hiện tại của client / server và vị trí địa lý
|
|
698
|
+
* Chuẩn REST endpoint: GET /api/ip-location/my-ip
|
|
506
699
|
*/
|
|
507
700
|
async getMyPublicIp(options) {
|
|
508
701
|
const response = await this.http.get(
|
|
@@ -520,10 +713,11 @@ var ImageCompareModule = class {
|
|
|
520
713
|
}
|
|
521
714
|
/**
|
|
522
715
|
* So sánh nội dung & độ tương đồng giữa 2 bức ảnh (qua URL hoặc Base64)
|
|
716
|
+
* Chuẩn REST endpoint: POST /api/image-compare/compare
|
|
523
717
|
*/
|
|
524
718
|
async compare(request, options) {
|
|
525
719
|
const response = await this.http.post(
|
|
526
|
-
"/api/image-compare",
|
|
720
|
+
"/api/image-compare/compare",
|
|
527
721
|
request,
|
|
528
722
|
options
|
|
529
723
|
);
|
|
@@ -531,6 +725,7 @@ var ImageCompareModule = class {
|
|
|
531
725
|
}
|
|
532
726
|
/**
|
|
533
727
|
* Chụp màn hình 2 trang web và so sánh độ lệch UI (Visual Regression Testing)
|
|
728
|
+
* Chuẩn REST endpoint: POST /api/image-compare/compare-webpages
|
|
534
729
|
*/
|
|
535
730
|
async compareWebpages(request, options) {
|
|
536
731
|
const response = await this.http.post(
|
|
@@ -548,22 +743,36 @@ var WebQaModule = class {
|
|
|
548
743
|
this.http = http;
|
|
549
744
|
}
|
|
550
745
|
/**
|
|
551
|
-
*
|
|
746
|
+
* Chạy audit toàn diện 5 lớp chuẩn QA/Tester cho website (SEO, Accessibility, Console errors, Broken links)
|
|
747
|
+
* Chuẩn REST endpoint: POST /api/web-qa/audit
|
|
552
748
|
*/
|
|
553
|
-
async
|
|
749
|
+
async audit(request, options) {
|
|
554
750
|
const response = await this.http.post(
|
|
555
|
-
"/api/web-qa/
|
|
751
|
+
"/api/web-qa/audit",
|
|
556
752
|
request,
|
|
557
753
|
options
|
|
558
754
|
);
|
|
559
755
|
return response.data;
|
|
560
756
|
}
|
|
561
757
|
/**
|
|
562
|
-
*
|
|
758
|
+
* Thực thi kịch bản tương tác E2E (Click, Fill, Hover, Scroll) & Giám sát lỗi
|
|
759
|
+
* Chuẩn REST endpoint: POST /api/web-qa/interact
|
|
563
760
|
*/
|
|
564
|
-
async
|
|
761
|
+
async interact(request, options) {
|
|
565
762
|
const response = await this.http.post(
|
|
566
|
-
"/api/web-qa/
|
|
763
|
+
"/api/web-qa/interact",
|
|
764
|
+
request,
|
|
765
|
+
options
|
|
766
|
+
);
|
|
767
|
+
return response.data;
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Chaos Auto-Fuzzing: Tự động quét và click thử các nút/tab an toàn
|
|
771
|
+
* Chuẩn REST endpoint: POST /api/web-qa/fuzz
|
|
772
|
+
*/
|
|
773
|
+
async fuzz(request, options) {
|
|
774
|
+
const response = await this.http.post(
|
|
775
|
+
"/api/web-qa/fuzz",
|
|
567
776
|
request,
|
|
568
777
|
options
|
|
569
778
|
);
|
|
@@ -577,7 +786,8 @@ var ScreenshotModule = class {
|
|
|
577
786
|
this.http = http;
|
|
578
787
|
}
|
|
579
788
|
/**
|
|
580
|
-
* Chụp ảnh màn hình website
|
|
789
|
+
* Chụp ảnh màn hình website / MiniApp
|
|
790
|
+
* Chuẩn REST endpoint: POST /api/screenshot/capture
|
|
581
791
|
*/
|
|
582
792
|
async capture(request, options) {
|
|
583
793
|
const response = await this.http.post(
|
|
@@ -588,18 +798,16 @@ var ScreenshotModule = class {
|
|
|
588
798
|
return response.data;
|
|
589
799
|
}
|
|
590
800
|
/**
|
|
591
|
-
*
|
|
801
|
+
* Chẩn đoán F12 console logs & network trang web
|
|
802
|
+
* Chuẩn REST endpoint: POST /api/screenshot/diagnose
|
|
592
803
|
*/
|
|
593
|
-
async
|
|
804
|
+
async diagnose(request, options) {
|
|
594
805
|
const response = await this.http.post(
|
|
595
|
-
"/api/screenshot/
|
|
806
|
+
"/api/screenshot/diagnose",
|
|
596
807
|
request,
|
|
597
|
-
|
|
598
|
-
...options,
|
|
599
|
-
responseType: "arraybuffer"
|
|
600
|
-
}
|
|
808
|
+
options
|
|
601
809
|
);
|
|
602
|
-
return
|
|
810
|
+
return response.data;
|
|
603
811
|
}
|
|
604
812
|
};
|
|
605
813
|
|