scavio 0.25.0 → 0.26.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 +32 -1
- package/dist/index.cjs +50 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -2
- package/dist/index.d.ts +50 -2
- package/dist/index.js +47 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# Scavio
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for the [Scavio API](https://scavio.dev?utm_source=npm-scavio-js&utm_medium=package&utm_campaign=readme) — real-time structured web
|
|
4
|
-
data across
|
|
4
|
+
data across 38 platforms on one API key, plus `extract()` to read
|
|
5
5
|
any URL as clean Markdown, and `extract.map()` / `extract.crawl()` /
|
|
6
6
|
`extract.batch()` to map, crawl and batch-extract whole websites.
|
|
7
7
|
|
|
8
8
|
Structured JSON in, structured JSON out. No per-site parsers to maintain.
|
|
9
9
|
|
|
10
10
|
- **Search and SERP** — Google (organic, news, maps, shopping, flights, hotels, trends, AI Mode)
|
|
11
|
+
- **AI assistants** — ChatGPT and Gemini answers with the sources they cite and the products they recommend
|
|
11
12
|
- **E-commerce** — Amazon, Walmart, Costco, Mercado Libre, eBay, Target, Home Depot, TikTok Shop
|
|
12
13
|
- **Real estate and travel** — Zillow, Redfin, Realtor.com, Rightmove, Booking, Airbnb, Tripadvisor
|
|
13
14
|
- **Reviews and local** — Trustpilot, Yelp, G2, Capterra, Glassdoor, App Store, Google Play
|
|
@@ -288,6 +289,36 @@ accepted and ignored. Parameters that cannot be honoured (image search, `sort`,
|
|
|
288
289
|
SERP (knowledge graph, AI overview, People Also Ask) use `google.search`.
|
|
289
290
|
[Docs](https://scavio.dev/docs/google-custom-search-api?utm_source=npm-scavio-js&utm_medium=package&utm_campaign=readme)
|
|
290
291
|
|
|
292
|
+
### ChatGPT and Gemini (new in 0.26.0)
|
|
293
|
+
|
|
294
|
+
Send the prompt a buyer would ask and get the answer the assistant gives: the
|
|
295
|
+
full Markdown answer, the pages it cites, the web searches it ran (ChatGPT) and
|
|
296
|
+
the products it recommended. Both return the same shape under `data`, so one
|
|
297
|
+
parser tracks which brands each assistant recommends. 5 credits per answered
|
|
298
|
+
prompt; a failed prompt is not charged. Answers take 10-40 seconds, so both
|
|
299
|
+
methods raise the request timeout to 120s when the client's is shorter.
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
const prompt = "What are the best CRM tools for small agencies?";
|
|
303
|
+
|
|
304
|
+
const chatgpt = await client.chatgpt.prompt({ prompt, country: "us" });
|
|
305
|
+
const gemini = await client.gemini.prompt({ prompt });
|
|
306
|
+
|
|
307
|
+
for (const { data } of [chatgpt, gemini] as any[]) {
|
|
308
|
+
console.log(data.platform, "mentions HubSpot:", data.answer.markdown.includes("HubSpot"));
|
|
309
|
+
console.log(" cited:", data.sources.slice(0, 5).map((s: any) => s.url));
|
|
310
|
+
console.log(" products:", data.shopping.map((p: any) => p.title));
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ChatGPT also returns each source's title and publisher and the searches it ran.
|
|
314
|
+
console.log((chatgpt as any).data.search_queries);
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Options: `chatgpt.prompt({ prompt, model?, country?, include_html? })` (prompt up
|
|
318
|
+
to 1024 characters) and `gemini.prompt({ prompt })` (up to 4000).
|
|
319
|
+
[ChatGPT docs](https://scavio.dev/docs/chatgpt-api?utm_source=npm-scavio-js&utm_medium=package&utm_campaign=readme) |
|
|
320
|
+
[Gemini docs](https://scavio.dev/docs/gemini-api?utm_source=npm-scavio-js&utm_medium=package&utm_campaign=readme)
|
|
321
|
+
|
|
291
322
|
### Amazon
|
|
292
323
|
|
|
293
324
|
Responses are normalized to a stable shape (see the breaking-change note
|
package/dist/index.cjs
CHANGED
|
@@ -30,18 +30,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AI_PROMPT_TIMEOUT: () => AI_PROMPT_TIMEOUT,
|
|
33
34
|
AirbnbNamespace: () => AirbnbNamespace,
|
|
34
35
|
AmazonNamespace: () => AmazonNamespace,
|
|
35
36
|
AppStoreNamespace: () => AppStoreNamespace,
|
|
36
37
|
BadRequestError: () => BadRequestError,
|
|
37
38
|
BookingNamespace: () => BookingNamespace,
|
|
38
39
|
CapterraNamespace: () => CapterraNamespace,
|
|
40
|
+
ChatgptNamespace: () => ChatgptNamespace,
|
|
39
41
|
CompaniesHouseNamespace: () => CompaniesHouseNamespace,
|
|
40
42
|
CostcoNamespace: () => CostcoNamespace,
|
|
41
43
|
DEFAULT_MAX_REQUESTS_PER_SECOND: () => DEFAULT_MAX_REQUESTS_PER_SECOND,
|
|
42
44
|
EbayNamespace: () => EbayNamespace,
|
|
43
45
|
ExtractNamespace: () => ExtractNamespace,
|
|
44
46
|
G2Namespace: () => G2Namespace,
|
|
47
|
+
GeminiNamespace: () => GeminiNamespace,
|
|
45
48
|
GlassdoorNamespace: () => GlassdoorNamespace,
|
|
46
49
|
GoogleAdsNamespace: () => GoogleAdsNamespace,
|
|
47
50
|
GoogleNamespace: () => GoogleNamespace,
|
|
@@ -232,7 +235,7 @@ function parseRetryAfter(header) {
|
|
|
232
235
|
var BASE_URL = "https://api.scavio.dev";
|
|
233
236
|
var DEFAULT_TIMEOUT = 3e4;
|
|
234
237
|
var DEFAULT_MAX_RETRIES = 2;
|
|
235
|
-
var SDK_VERSION = true ? "0.
|
|
238
|
+
var SDK_VERSION = true ? "0.26.0" : "0.0.0";
|
|
236
239
|
var USER_AGENT = `scavio-js/${SDK_VERSION}`;
|
|
237
240
|
function isServerRuntime() {
|
|
238
241
|
const g = globalThis;
|
|
@@ -2816,6 +2819,43 @@ var TrustpilotNamespace = class {
|
|
|
2816
2819
|
}
|
|
2817
2820
|
};
|
|
2818
2821
|
|
|
2822
|
+
// src/namespaces/chatgpt.ts
|
|
2823
|
+
var AI_PROMPT_TIMEOUT = 12e4;
|
|
2824
|
+
var ChatgptNamespace = class {
|
|
2825
|
+
constructor(client) {
|
|
2826
|
+
this.client = client;
|
|
2827
|
+
}
|
|
2828
|
+
client;
|
|
2829
|
+
/**
|
|
2830
|
+
* Send a prompt to ChatGPT and get the answer it gives: the full Markdown
|
|
2831
|
+
* answer, every page it cites (title, publisher, date), the web searches it
|
|
2832
|
+
* ran and the products it recommended. Built for AI visibility monitoring.
|
|
2833
|
+
*
|
|
2834
|
+
* Costs 5 credits per answered prompt; failed prompts are not charged.
|
|
2835
|
+
*/
|
|
2836
|
+
async prompt(options) {
|
|
2837
|
+
return this.client._post("/api/v1/chatgpt/prompt", options, void 0, AI_PROMPT_TIMEOUT);
|
|
2838
|
+
}
|
|
2839
|
+
};
|
|
2840
|
+
|
|
2841
|
+
// src/namespaces/gemini.ts
|
|
2842
|
+
var GeminiNamespace = class {
|
|
2843
|
+
constructor(client) {
|
|
2844
|
+
this.client = client;
|
|
2845
|
+
}
|
|
2846
|
+
client;
|
|
2847
|
+
/**
|
|
2848
|
+
* Send a prompt to Google Gemini and get the answer it gives as Markdown,
|
|
2849
|
+
* with the URLs it cites and the products it recommended. Same response
|
|
2850
|
+
* shape as chatgpt.prompt().
|
|
2851
|
+
*
|
|
2852
|
+
* Costs 5 credits per answered prompt; failed prompts are not charged.
|
|
2853
|
+
*/
|
|
2854
|
+
async prompt(options) {
|
|
2855
|
+
return this.client._post("/api/v1/gemini/prompt", options, void 0, AI_PROMPT_TIMEOUT);
|
|
2856
|
+
}
|
|
2857
|
+
};
|
|
2858
|
+
|
|
2819
2859
|
// src/namespaces/realtor.ts
|
|
2820
2860
|
var RealtorNamespace = class {
|
|
2821
2861
|
constructor(client) {
|
|
@@ -3218,6 +3258,8 @@ var Scavio = class extends ScavioCore {
|
|
|
3218
3258
|
metaAds;
|
|
3219
3259
|
costco;
|
|
3220
3260
|
trustpilot;
|
|
3261
|
+
chatgpt;
|
|
3262
|
+
gemini;
|
|
3221
3263
|
realtor;
|
|
3222
3264
|
rightmove;
|
|
3223
3265
|
mercadolibre;
|
|
@@ -3275,6 +3317,8 @@ var Scavio = class extends ScavioCore {
|
|
|
3275
3317
|
this.metaAds = new MetaAdsNamespace(this);
|
|
3276
3318
|
this.costco = new CostcoNamespace(this);
|
|
3277
3319
|
this.trustpilot = new TrustpilotNamespace(this);
|
|
3320
|
+
this.chatgpt = new ChatgptNamespace(this);
|
|
3321
|
+
this.gemini = new GeminiNamespace(this);
|
|
3278
3322
|
this.realtor = new RealtorNamespace(this);
|
|
3279
3323
|
this.rightmove = new RightmoveNamespace(this);
|
|
3280
3324
|
this.mercadolibre = new MercadoLibreNamespace(this);
|
|
@@ -3290,13 +3334,13 @@ var Scavio = class extends ScavioCore {
|
|
|
3290
3334
|
});
|
|
3291
3335
|
}
|
|
3292
3336
|
/** @internal */
|
|
3293
|
-
async _post(path, body, headers) {
|
|
3337
|
+
async _post(path, body, headers, minTimeout) {
|
|
3294
3338
|
return request({
|
|
3295
3339
|
method: "POST",
|
|
3296
3340
|
path,
|
|
3297
3341
|
apiKey: this.apiKey,
|
|
3298
3342
|
baseUrl: this.baseUrl,
|
|
3299
|
-
timeout: this.timeout,
|
|
3343
|
+
timeout: Math.max(this.timeout, minTimeout ?? 0),
|
|
3300
3344
|
maxRetries: this.maxRetries,
|
|
3301
3345
|
rateLimiter: this.rateLimiter,
|
|
3302
3346
|
body,
|
|
@@ -3381,18 +3425,21 @@ async function getSubtle() {
|
|
|
3381
3425
|
}
|
|
3382
3426
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3383
3427
|
0 && (module.exports = {
|
|
3428
|
+
AI_PROMPT_TIMEOUT,
|
|
3384
3429
|
AirbnbNamespace,
|
|
3385
3430
|
AmazonNamespace,
|
|
3386
3431
|
AppStoreNamespace,
|
|
3387
3432
|
BadRequestError,
|
|
3388
3433
|
BookingNamespace,
|
|
3389
3434
|
CapterraNamespace,
|
|
3435
|
+
ChatgptNamespace,
|
|
3390
3436
|
CompaniesHouseNamespace,
|
|
3391
3437
|
CostcoNamespace,
|
|
3392
3438
|
DEFAULT_MAX_REQUESTS_PER_SECOND,
|
|
3393
3439
|
EbayNamespace,
|
|
3394
3440
|
ExtractNamespace,
|
|
3395
3441
|
G2Namespace,
|
|
3442
|
+
GeminiNamespace,
|
|
3396
3443
|
GlassdoorNamespace,
|
|
3397
3444
|
GoogleAdsNamespace,
|
|
3398
3445
|
GoogleNamespace,
|