chapybara 0.4.0 → 0.5.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 +0 -19
- package/index.d.ts +0 -6
- package/index.js +1 -12
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -91,24 +91,6 @@ async function getWebTechInfo() {
|
|
|
91
91
|
getWebTechInfo();
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
### Get Website Screenshot
|
|
95
|
-
|
|
96
|
-
```javascript
|
|
97
|
-
import fs from "fs/promises";
|
|
98
|
-
|
|
99
|
-
async function getWebsiteScreenshot() {
|
|
100
|
-
try {
|
|
101
|
-
const imageBuffer = await chapybara.screenshot.get("apple.com");
|
|
102
|
-
await fs.writeFile("screenshot.png", imageBuffer);
|
|
103
|
-
console.log("Screenshot saved to screenshot.png");
|
|
104
|
-
} catch (error) {
|
|
105
|
-
console.error(`Error fetching screenshot: ${error.message}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
getWebsiteScreenshot();
|
|
110
|
-
```
|
|
111
|
-
|
|
112
94
|
### Get Account Information
|
|
113
95
|
|
|
114
96
|
```javascript
|
|
@@ -116,7 +98,6 @@ async function getAccountDetails() {
|
|
|
116
98
|
try {
|
|
117
99
|
const data = await chapybara.account.getInfo();
|
|
118
100
|
console.log("Domain quota remaining:", data.quotas.domain.remaining);
|
|
119
|
-
console.log("Screenshot quota remaining:", data.quotas.screenshot.remaining);
|
|
120
101
|
} catch (error) {
|
|
121
102
|
console.error(`Error fetching account info: ${error.message}`);
|
|
122
103
|
}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { LRUCache } from "lru-cache";
|
|
2
|
-
import type { Buffer } from "node:buffer";
|
|
3
2
|
|
|
4
3
|
declare module "chapybara" {
|
|
5
4
|
interface ChapybaraClientOptions {
|
|
@@ -241,7 +240,6 @@ declare module "chapybara" {
|
|
|
241
240
|
domain: { limit: number; used: number; remaining: number };
|
|
242
241
|
ip: { limit: number; used: number; remaining: number };
|
|
243
242
|
webtech: { limit: number; used: number; remaining: number };
|
|
244
|
-
screenshot: { limit: number; used: number; remaining: number };
|
|
245
243
|
reset_date: string;
|
|
246
244
|
};
|
|
247
245
|
api_key: {
|
|
@@ -282,10 +280,6 @@ declare module "chapybara" {
|
|
|
282
280
|
getScanner: (domain: string) => Promise<WebTechResponse>;
|
|
283
281
|
};
|
|
284
282
|
|
|
285
|
-
screenshot: {
|
|
286
|
-
get: (domain: string) => Promise<Buffer>;
|
|
287
|
-
};
|
|
288
|
-
|
|
289
283
|
account: {
|
|
290
284
|
getInfo: () => Promise<AccountInfoResponse>;
|
|
291
285
|
};
|
package/index.js
CHANGED
|
@@ -34,10 +34,6 @@ export class ChapybaraClient {
|
|
|
34
34
|
getScanner: (domain) => this._request(`/webtech/${domain}`),
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
this.screenshot = {
|
|
38
|
-
get: (domain) => this._request(`/screenshot/${domain}`),
|
|
39
|
-
};
|
|
40
|
-
|
|
41
37
|
this.account = {
|
|
42
38
|
getInfo: () => this._request("/account"),
|
|
43
39
|
};
|
|
@@ -48,7 +44,6 @@ export class ChapybaraClient {
|
|
|
48
44
|
async _request(endpoint, attempt = 1) {
|
|
49
45
|
const url = `${this.baseUrl}${endpoint}`;
|
|
50
46
|
const cacheKey = endpoint;
|
|
51
|
-
const isScreenshotRequest = endpoint.startsWith("/screenshot");
|
|
52
47
|
|
|
53
48
|
if (this.cache?.has(cacheKey)) {
|
|
54
49
|
return this.cache.get(cacheKey);
|
|
@@ -79,13 +74,7 @@ export class ChapybaraClient {
|
|
|
79
74
|
await this._handleError(response);
|
|
80
75
|
}
|
|
81
76
|
|
|
82
|
-
|
|
83
|
-
if (isScreenshotRequest) {
|
|
84
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
85
|
-
data = Buffer.from(arrayBuffer);
|
|
86
|
-
} else {
|
|
87
|
-
data = await response.json();
|
|
88
|
-
}
|
|
77
|
+
const data = await response.json();
|
|
89
78
|
|
|
90
79
|
if (this.cache) {
|
|
91
80
|
this.cache.set(cacheKey, data);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chapybara",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Official NodeJS SDK for the Chapybara Domain & IP Intelligence API.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
"domain",
|
|
16
16
|
"ip",
|
|
17
17
|
"intelligence",
|
|
18
|
-
"security"
|
|
19
|
-
"screenshot"
|
|
18
|
+
"security"
|
|
20
19
|
],
|
|
21
20
|
"author": "Alpha System",
|
|
22
21
|
"license": "MIT",
|
|
23
22
|
"dependencies": {
|
|
24
|
-
"lru-cache": "^11.2.
|
|
23
|
+
"lru-cache": "^11.2.6"
|
|
25
24
|
},
|
|
26
25
|
"engines": {
|
|
27
26
|
"node": ">=18.0.0"
|