scrapebadger 0.69.1 → 0.70.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/dist/index.d.cts +71 -6
- package/dist/index.d.ts +71 -6
- package/dist/index.js +52 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1209,6 +1209,29 @@ interface GoogleSearchParams {
|
|
|
1209
1209
|
* live rate.
|
|
1210
1210
|
*/
|
|
1211
1211
|
ai_overview?: boolean;
|
|
1212
|
+
/**
|
|
1213
|
+
* Open the People Also Ask questions and return their answers. `true`
|
|
1214
|
+
* opens every question the page shows (usually four), a number `N` opens
|
|
1215
|
+
* the first N (0-99; `0` or `false` opens none). Each answered question in
|
|
1216
|
+
* `related_questions` then carries `text_blocks` and `references`, in the
|
|
1217
|
+
* same shape as `ai_overview`. The answers are fetched on the same session
|
|
1218
|
+
* that served the SERP, so a question can't be expanded later; a question
|
|
1219
|
+
* whose answer did not come back keeps them `null`.
|
|
1220
|
+
*
|
|
1221
|
+
* Each answered question bills as one more Search request (credits =
|
|
1222
|
+
* 20 x (1 + answered) at today's price); a question that does not come
|
|
1223
|
+
* back is not billed. Adds about a second per question. Upgrades
|
|
1224
|
+
* `mode: "fast"` to full. Not accepted by `/v1/google/light/search`.
|
|
1225
|
+
*/
|
|
1226
|
+
expand_related_questions?: boolean | number;
|
|
1227
|
+
/**
|
|
1228
|
+
* `"full"` (default): the complete SERP with every block. `"fast"`:
|
|
1229
|
+
* Google's lite `gbv=1` page, organic results and related searches only,
|
|
1230
|
+
* with a 12-second processing budget (past it the API returns `503` with
|
|
1231
|
+
* `Retry-After: 60`). Upgraded to full when `ai_overview` or
|
|
1232
|
+
* `expand_related_questions` is set.
|
|
1233
|
+
*/
|
|
1234
|
+
mode?: "full" | "fast";
|
|
1212
1235
|
}
|
|
1213
1236
|
interface MapsSearchParams {
|
|
1214
1237
|
/** Search query. Required unless `place_id` or `ludocid` is supplied. */
|
|
@@ -2469,22 +2492,64 @@ declare class SearchClient$h {
|
|
|
2469
2492
|
* Search Google and get a structured SERP response with organic results,
|
|
2470
2493
|
* knowledge graph, People Also Ask, related searches, AI overview, and
|
|
2471
2494
|
* pagination.
|
|
2495
|
+
*
|
|
2496
|
+
* The response (untyped, `Record<string, unknown>`) holds, when Google
|
|
2497
|
+
* shows them:
|
|
2498
|
+
* - `search_information`: total_results, time_taken, query_displayed,
|
|
2499
|
+
* organic_results_state (`"no_results"` on an explicit Google
|
|
2500
|
+
* no-results answer, `"Results for relaxed query"` when Google drops
|
|
2501
|
+
* quotes).
|
|
2502
|
+
* - `organic_results`: position, title, link, snippet, displayed_link,
|
|
2503
|
+
* plus `date`, `sitelinks`, `rich_snippet` and `read_more_link`.
|
|
2504
|
+
* - `related_questions`: question, rank, `type` (`"ai_overview"` or
|
|
2505
|
+
* `null`), and `text_blocks` / `references` with
|
|
2506
|
+
* `expand_related_questions`.
|
|
2507
|
+
* - `ai_overview`: `text_blocks` (paragraph, heading and list blocks; list
|
|
2508
|
+
* blocks carry `list_items`) with `reference_indexes` (0-based into
|
|
2509
|
+
* `references`), and `references` (title, link, source, snippet, logo).
|
|
2510
|
+
* - `shopping_results`: position, category, title, price, extracted_price,
|
|
2511
|
+
* original_price, extracted_original_price, source, rating, reviews,
|
|
2512
|
+
* delivery, extensions, thumbnail, product_id, catalog_id, product_link,
|
|
2513
|
+
* scrapebadger_product_detail_link.
|
|
2514
|
+
* - `perspectives`, `discussions_and_forums`, `short_videos`,
|
|
2515
|
+
* `things_to_know`, `ads`, `knowledge_graph`, `people_also_search_for`,
|
|
2516
|
+
* `related_searches`, `local_results`, `inline_videos`, `pagination`.
|
|
2517
|
+
*
|
|
2518
|
+
* A full-mode query with a `site:` operator is answered from Google's Web
|
|
2519
|
+
* tab: organic results, related searches and pagination only, rich blocks
|
|
2520
|
+
* empty (pass `ai_overview: true` for the full page).
|
|
2521
|
+
*
|
|
2522
|
+
* @example
|
|
2523
|
+
* ```typescript
|
|
2524
|
+
* // People Also Ask answers for the first two questions
|
|
2525
|
+
* const serp = await client.google.search.search({
|
|
2526
|
+
* q: "are noise cancelling headphones worth it",
|
|
2527
|
+
* expand_related_questions: 2,
|
|
2528
|
+
* });
|
|
2529
|
+
* ```
|
|
2472
2530
|
*/
|
|
2473
2531
|
search(params: GoogleSearchParams): Promise<GoogleResponse>;
|
|
2474
2532
|
/**
|
|
2475
|
-
*
|
|
2533
|
+
* Google Light Search — organic results + related searches only.
|
|
2534
|
+
*
|
|
2535
|
+
* Calls the dedicated `/v1/google/light/search` endpoint, billed at the
|
|
2536
|
+
* Light rate (half of full {@link search}; query `/public/pricing` for the
|
|
2537
|
+
* live rate). Skips ads, Knowledge Graph, AI Overview, People Also Ask,
|
|
2538
|
+
* local pack, news, inline videos, and shopping blocks. Has a 12-second
|
|
2539
|
+
* processing budget; past it the API returns `503` with
|
|
2540
|
+
* `Retry-After: 60`. Light cannot be upgraded to full Search, so
|
|
2541
|
+
* `ai_overview` is not sent; AI Overview and People Also Ask answers
|
|
2542
|
+
* (`expand_related_questions`) need {@link search}.
|
|
2476
2543
|
*
|
|
2477
|
-
*
|
|
2478
|
-
*
|
|
2479
|
-
* Credit cost is configured per-endpoint by admins — query
|
|
2480
|
-
* `/public/pricing` for the live rate.
|
|
2544
|
+
* Returns `{ search_information, organic_results, related_searches,
|
|
2545
|
+
* pagination }`.
|
|
2481
2546
|
*
|
|
2482
2547
|
* @example
|
|
2483
2548
|
* ```typescript
|
|
2484
2549
|
* const lite = await client.google.search.light({ q: "python 3.13" });
|
|
2485
2550
|
* ```
|
|
2486
2551
|
*/
|
|
2487
|
-
light(params: GoogleSearchParams): Promise<GoogleResponse>;
|
|
2552
|
+
light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions">): Promise<GoogleResponse>;
|
|
2488
2553
|
}
|
|
2489
2554
|
|
|
2490
2555
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1209,6 +1209,29 @@ interface GoogleSearchParams {
|
|
|
1209
1209
|
* live rate.
|
|
1210
1210
|
*/
|
|
1211
1211
|
ai_overview?: boolean;
|
|
1212
|
+
/**
|
|
1213
|
+
* Open the People Also Ask questions and return their answers. `true`
|
|
1214
|
+
* opens every question the page shows (usually four), a number `N` opens
|
|
1215
|
+
* the first N (0-99; `0` or `false` opens none). Each answered question in
|
|
1216
|
+
* `related_questions` then carries `text_blocks` and `references`, in the
|
|
1217
|
+
* same shape as `ai_overview`. The answers are fetched on the same session
|
|
1218
|
+
* that served the SERP, so a question can't be expanded later; a question
|
|
1219
|
+
* whose answer did not come back keeps them `null`.
|
|
1220
|
+
*
|
|
1221
|
+
* Each answered question bills as one more Search request (credits =
|
|
1222
|
+
* 20 x (1 + answered) at today's price); a question that does not come
|
|
1223
|
+
* back is not billed. Adds about a second per question. Upgrades
|
|
1224
|
+
* `mode: "fast"` to full. Not accepted by `/v1/google/light/search`.
|
|
1225
|
+
*/
|
|
1226
|
+
expand_related_questions?: boolean | number;
|
|
1227
|
+
/**
|
|
1228
|
+
* `"full"` (default): the complete SERP with every block. `"fast"`:
|
|
1229
|
+
* Google's lite `gbv=1` page, organic results and related searches only,
|
|
1230
|
+
* with a 12-second processing budget (past it the API returns `503` with
|
|
1231
|
+
* `Retry-After: 60`). Upgraded to full when `ai_overview` or
|
|
1232
|
+
* `expand_related_questions` is set.
|
|
1233
|
+
*/
|
|
1234
|
+
mode?: "full" | "fast";
|
|
1212
1235
|
}
|
|
1213
1236
|
interface MapsSearchParams {
|
|
1214
1237
|
/** Search query. Required unless `place_id` or `ludocid` is supplied. */
|
|
@@ -2469,22 +2492,64 @@ declare class SearchClient$h {
|
|
|
2469
2492
|
* Search Google and get a structured SERP response with organic results,
|
|
2470
2493
|
* knowledge graph, People Also Ask, related searches, AI overview, and
|
|
2471
2494
|
* pagination.
|
|
2495
|
+
*
|
|
2496
|
+
* The response (untyped, `Record<string, unknown>`) holds, when Google
|
|
2497
|
+
* shows them:
|
|
2498
|
+
* - `search_information`: total_results, time_taken, query_displayed,
|
|
2499
|
+
* organic_results_state (`"no_results"` on an explicit Google
|
|
2500
|
+
* no-results answer, `"Results for relaxed query"` when Google drops
|
|
2501
|
+
* quotes).
|
|
2502
|
+
* - `organic_results`: position, title, link, snippet, displayed_link,
|
|
2503
|
+
* plus `date`, `sitelinks`, `rich_snippet` and `read_more_link`.
|
|
2504
|
+
* - `related_questions`: question, rank, `type` (`"ai_overview"` or
|
|
2505
|
+
* `null`), and `text_blocks` / `references` with
|
|
2506
|
+
* `expand_related_questions`.
|
|
2507
|
+
* - `ai_overview`: `text_blocks` (paragraph, heading and list blocks; list
|
|
2508
|
+
* blocks carry `list_items`) with `reference_indexes` (0-based into
|
|
2509
|
+
* `references`), and `references` (title, link, source, snippet, logo).
|
|
2510
|
+
* - `shopping_results`: position, category, title, price, extracted_price,
|
|
2511
|
+
* original_price, extracted_original_price, source, rating, reviews,
|
|
2512
|
+
* delivery, extensions, thumbnail, product_id, catalog_id, product_link,
|
|
2513
|
+
* scrapebadger_product_detail_link.
|
|
2514
|
+
* - `perspectives`, `discussions_and_forums`, `short_videos`,
|
|
2515
|
+
* `things_to_know`, `ads`, `knowledge_graph`, `people_also_search_for`,
|
|
2516
|
+
* `related_searches`, `local_results`, `inline_videos`, `pagination`.
|
|
2517
|
+
*
|
|
2518
|
+
* A full-mode query with a `site:` operator is answered from Google's Web
|
|
2519
|
+
* tab: organic results, related searches and pagination only, rich blocks
|
|
2520
|
+
* empty (pass `ai_overview: true` for the full page).
|
|
2521
|
+
*
|
|
2522
|
+
* @example
|
|
2523
|
+
* ```typescript
|
|
2524
|
+
* // People Also Ask answers for the first two questions
|
|
2525
|
+
* const serp = await client.google.search.search({
|
|
2526
|
+
* q: "are noise cancelling headphones worth it",
|
|
2527
|
+
* expand_related_questions: 2,
|
|
2528
|
+
* });
|
|
2529
|
+
* ```
|
|
2472
2530
|
*/
|
|
2473
2531
|
search(params: GoogleSearchParams): Promise<GoogleResponse>;
|
|
2474
2532
|
/**
|
|
2475
|
-
*
|
|
2533
|
+
* Google Light Search — organic results + related searches only.
|
|
2534
|
+
*
|
|
2535
|
+
* Calls the dedicated `/v1/google/light/search` endpoint, billed at the
|
|
2536
|
+
* Light rate (half of full {@link search}; query `/public/pricing` for the
|
|
2537
|
+
* live rate). Skips ads, Knowledge Graph, AI Overview, People Also Ask,
|
|
2538
|
+
* local pack, news, inline videos, and shopping blocks. Has a 12-second
|
|
2539
|
+
* processing budget; past it the API returns `503` with
|
|
2540
|
+
* `Retry-After: 60`. Light cannot be upgraded to full Search, so
|
|
2541
|
+
* `ai_overview` is not sent; AI Overview and People Also Ask answers
|
|
2542
|
+
* (`expand_related_questions`) need {@link search}.
|
|
2476
2543
|
*
|
|
2477
|
-
*
|
|
2478
|
-
*
|
|
2479
|
-
* Credit cost is configured per-endpoint by admins — query
|
|
2480
|
-
* `/public/pricing` for the live rate.
|
|
2544
|
+
* Returns `{ search_information, organic_results, related_searches,
|
|
2545
|
+
* pagination }`.
|
|
2481
2546
|
*
|
|
2482
2547
|
* @example
|
|
2483
2548
|
* ```typescript
|
|
2484
2549
|
* const lite = await client.google.search.light({ q: "python 3.13" });
|
|
2485
2550
|
* ```
|
|
2486
2551
|
*/
|
|
2487
|
-
light(params: GoogleSearchParams): Promise<GoogleResponse>;
|
|
2552
|
+
light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions">): Promise<GoogleResponse>;
|
|
2488
2553
|
}
|
|
2489
2554
|
|
|
2490
2555
|
/**
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
9
9
|
var WebSocket__default = /*#__PURE__*/_interopDefault(WebSocket);
|
|
10
10
|
|
|
11
11
|
// src/internal/version.ts
|
|
12
|
-
var SDK_VERSION = "0.
|
|
12
|
+
var SDK_VERSION = "0.70.0";
|
|
13
13
|
|
|
14
14
|
// src/internal/exceptions.ts
|
|
15
15
|
var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
|
|
@@ -3531,6 +3531,7 @@ var ScholarClient = class {
|
|
|
3531
3531
|
};
|
|
3532
3532
|
|
|
3533
3533
|
// src/google/search.ts
|
|
3534
|
+
var FULL_SEARCH_ONLY = ["mode", "ai_overview", "expand_related_questions"];
|
|
3534
3535
|
var SearchClient2 = class {
|
|
3535
3536
|
constructor(client) {
|
|
3536
3537
|
this.client = client;
|
|
@@ -3539,17 +3540,59 @@ var SearchClient2 = class {
|
|
|
3539
3540
|
* Search Google and get a structured SERP response with organic results,
|
|
3540
3541
|
* knowledge graph, People Also Ask, related searches, AI overview, and
|
|
3541
3542
|
* pagination.
|
|
3543
|
+
*
|
|
3544
|
+
* The response (untyped, `Record<string, unknown>`) holds, when Google
|
|
3545
|
+
* shows them:
|
|
3546
|
+
* - `search_information`: total_results, time_taken, query_displayed,
|
|
3547
|
+
* organic_results_state (`"no_results"` on an explicit Google
|
|
3548
|
+
* no-results answer, `"Results for relaxed query"` when Google drops
|
|
3549
|
+
* quotes).
|
|
3550
|
+
* - `organic_results`: position, title, link, snippet, displayed_link,
|
|
3551
|
+
* plus `date`, `sitelinks`, `rich_snippet` and `read_more_link`.
|
|
3552
|
+
* - `related_questions`: question, rank, `type` (`"ai_overview"` or
|
|
3553
|
+
* `null`), and `text_blocks` / `references` with
|
|
3554
|
+
* `expand_related_questions`.
|
|
3555
|
+
* - `ai_overview`: `text_blocks` (paragraph, heading and list blocks; list
|
|
3556
|
+
* blocks carry `list_items`) with `reference_indexes` (0-based into
|
|
3557
|
+
* `references`), and `references` (title, link, source, snippet, logo).
|
|
3558
|
+
* - `shopping_results`: position, category, title, price, extracted_price,
|
|
3559
|
+
* original_price, extracted_original_price, source, rating, reviews,
|
|
3560
|
+
* delivery, extensions, thumbnail, product_id, catalog_id, product_link,
|
|
3561
|
+
* scrapebadger_product_detail_link.
|
|
3562
|
+
* - `perspectives`, `discussions_and_forums`, `short_videos`,
|
|
3563
|
+
* `things_to_know`, `ads`, `knowledge_graph`, `people_also_search_for`,
|
|
3564
|
+
* `related_searches`, `local_results`, `inline_videos`, `pagination`.
|
|
3565
|
+
*
|
|
3566
|
+
* A full-mode query with a `site:` operator is answered from Google's Web
|
|
3567
|
+
* tab: organic results, related searches and pagination only, rich blocks
|
|
3568
|
+
* empty (pass `ai_overview: true` for the full page).
|
|
3569
|
+
*
|
|
3570
|
+
* @example
|
|
3571
|
+
* ```typescript
|
|
3572
|
+
* // People Also Ask answers for the first two questions
|
|
3573
|
+
* const serp = await client.google.search.search({
|
|
3574
|
+
* q: "are noise cancelling headphones worth it",
|
|
3575
|
+
* expand_related_questions: 2,
|
|
3576
|
+
* });
|
|
3577
|
+
* ```
|
|
3542
3578
|
*/
|
|
3543
3579
|
async search(params) {
|
|
3544
3580
|
return this.client.request("/v1/google/search", { params: { ...params } });
|
|
3545
3581
|
}
|
|
3546
3582
|
/**
|
|
3547
|
-
*
|
|
3583
|
+
* Google Light Search — organic results + related searches only.
|
|
3548
3584
|
*
|
|
3549
|
-
*
|
|
3550
|
-
*
|
|
3551
|
-
*
|
|
3552
|
-
*
|
|
3585
|
+
* Calls the dedicated `/v1/google/light/search` endpoint, billed at the
|
|
3586
|
+
* Light rate (half of full {@link search}; query `/public/pricing` for the
|
|
3587
|
+
* live rate). Skips ads, Knowledge Graph, AI Overview, People Also Ask,
|
|
3588
|
+
* local pack, news, inline videos, and shopping blocks. Has a 12-second
|
|
3589
|
+
* processing budget; past it the API returns `503` with
|
|
3590
|
+
* `Retry-After: 60`. Light cannot be upgraded to full Search, so
|
|
3591
|
+
* `ai_overview` is not sent; AI Overview and People Also Ask answers
|
|
3592
|
+
* (`expand_related_questions`) need {@link search}.
|
|
3593
|
+
*
|
|
3594
|
+
* Returns `{ search_information, organic_results, related_searches,
|
|
3595
|
+
* pagination }`.
|
|
3553
3596
|
*
|
|
3554
3597
|
* @example
|
|
3555
3598
|
* ```typescript
|
|
@@ -3557,9 +3600,9 @@ var SearchClient2 = class {
|
|
|
3557
3600
|
* ```
|
|
3558
3601
|
*/
|
|
3559
3602
|
async light(params) {
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
});
|
|
3603
|
+
const light = { ...params };
|
|
3604
|
+
for (const key of FULL_SEARCH_ONLY) delete light[key];
|
|
3605
|
+
return this.client.request("/v1/google/light/search", { params: light });
|
|
3563
3606
|
}
|
|
3564
3607
|
};
|
|
3565
3608
|
|