scrapebadger 0.69.0 → 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 +90 -9
- package/dist/index.d.ts +90 -9
- package/dist/index.js +59 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
import WebSocket from 'ws';
|
|
4
4
|
|
|
5
5
|
// src/internal/version.ts
|
|
6
|
-
var SDK_VERSION = "0.
|
|
6
|
+
var SDK_VERSION = "0.70.0";
|
|
7
7
|
|
|
8
8
|
// src/internal/exceptions.ts
|
|
9
9
|
var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
|
|
@@ -3525,6 +3525,7 @@ var ScholarClient = class {
|
|
|
3525
3525
|
};
|
|
3526
3526
|
|
|
3527
3527
|
// src/google/search.ts
|
|
3528
|
+
var FULL_SEARCH_ONLY = ["mode", "ai_overview", "expand_related_questions"];
|
|
3528
3529
|
var SearchClient2 = class {
|
|
3529
3530
|
constructor(client) {
|
|
3530
3531
|
this.client = client;
|
|
@@ -3533,17 +3534,59 @@ var SearchClient2 = class {
|
|
|
3533
3534
|
* Search Google and get a structured SERP response with organic results,
|
|
3534
3535
|
* knowledge graph, People Also Ask, related searches, AI overview, and
|
|
3535
3536
|
* pagination.
|
|
3537
|
+
*
|
|
3538
|
+
* The response (untyped, `Record<string, unknown>`) holds, when Google
|
|
3539
|
+
* shows them:
|
|
3540
|
+
* - `search_information`: total_results, time_taken, query_displayed,
|
|
3541
|
+
* organic_results_state (`"no_results"` on an explicit Google
|
|
3542
|
+
* no-results answer, `"Results for relaxed query"` when Google drops
|
|
3543
|
+
* quotes).
|
|
3544
|
+
* - `organic_results`: position, title, link, snippet, displayed_link,
|
|
3545
|
+
* plus `date`, `sitelinks`, `rich_snippet` and `read_more_link`.
|
|
3546
|
+
* - `related_questions`: question, rank, `type` (`"ai_overview"` or
|
|
3547
|
+
* `null`), and `text_blocks` / `references` with
|
|
3548
|
+
* `expand_related_questions`.
|
|
3549
|
+
* - `ai_overview`: `text_blocks` (paragraph, heading and list blocks; list
|
|
3550
|
+
* blocks carry `list_items`) with `reference_indexes` (0-based into
|
|
3551
|
+
* `references`), and `references` (title, link, source, snippet, logo).
|
|
3552
|
+
* - `shopping_results`: position, category, title, price, extracted_price,
|
|
3553
|
+
* original_price, extracted_original_price, source, rating, reviews,
|
|
3554
|
+
* delivery, extensions, thumbnail, product_id, catalog_id, product_link,
|
|
3555
|
+
* scrapebadger_product_detail_link.
|
|
3556
|
+
* - `perspectives`, `discussions_and_forums`, `short_videos`,
|
|
3557
|
+
* `things_to_know`, `ads`, `knowledge_graph`, `people_also_search_for`,
|
|
3558
|
+
* `related_searches`, `local_results`, `inline_videos`, `pagination`.
|
|
3559
|
+
*
|
|
3560
|
+
* A full-mode query with a `site:` operator is answered from Google's Web
|
|
3561
|
+
* tab: organic results, related searches and pagination only, rich blocks
|
|
3562
|
+
* empty (pass `ai_overview: true` for the full page).
|
|
3563
|
+
*
|
|
3564
|
+
* @example
|
|
3565
|
+
* ```typescript
|
|
3566
|
+
* // People Also Ask answers for the first two questions
|
|
3567
|
+
* const serp = await client.google.search.search({
|
|
3568
|
+
* q: "are noise cancelling headphones worth it",
|
|
3569
|
+
* expand_related_questions: 2,
|
|
3570
|
+
* });
|
|
3571
|
+
* ```
|
|
3536
3572
|
*/
|
|
3537
3573
|
async search(params) {
|
|
3538
3574
|
return this.client.request("/v1/google/search", { params: { ...params } });
|
|
3539
3575
|
}
|
|
3540
3576
|
/**
|
|
3541
|
-
*
|
|
3577
|
+
* Google Light Search — organic results + related searches only.
|
|
3578
|
+
*
|
|
3579
|
+
* Calls the dedicated `/v1/google/light/search` endpoint, billed at the
|
|
3580
|
+
* Light rate (half of full {@link search}; query `/public/pricing` for the
|
|
3581
|
+
* live rate). Skips ads, Knowledge Graph, AI Overview, People Also Ask,
|
|
3582
|
+
* local pack, news, inline videos, and shopping blocks. Has a 12-second
|
|
3583
|
+
* processing budget; past it the API returns `503` with
|
|
3584
|
+
* `Retry-After: 60`. Light cannot be upgraded to full Search, so
|
|
3585
|
+
* `ai_overview` is not sent; AI Overview and People Also Ask answers
|
|
3586
|
+
* (`expand_related_questions`) need {@link search}.
|
|
3542
3587
|
*
|
|
3543
|
-
*
|
|
3544
|
-
*
|
|
3545
|
-
* Credit cost is configured per-endpoint by admins — query
|
|
3546
|
-
* `/public/pricing` for the live rate.
|
|
3588
|
+
* Returns `{ search_information, organic_results, related_searches,
|
|
3589
|
+
* pagination }`.
|
|
3547
3590
|
*
|
|
3548
3591
|
* @example
|
|
3549
3592
|
* ```typescript
|
|
@@ -3551,9 +3594,9 @@ var SearchClient2 = class {
|
|
|
3551
3594
|
* ```
|
|
3552
3595
|
*/
|
|
3553
3596
|
async light(params) {
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
});
|
|
3597
|
+
const light = { ...params };
|
|
3598
|
+
for (const key of FULL_SEARCH_ONLY) delete light[key];
|
|
3599
|
+
return this.client.request("/v1/google/light/search", { params: light });
|
|
3557
3600
|
}
|
|
3558
3601
|
};
|
|
3559
3602
|
|
|
@@ -6246,6 +6289,13 @@ var SearchClient8 = class {
|
|
|
6246
6289
|
* Pass `query`, `seller` or both. `seller` alone pages through everything
|
|
6247
6290
|
* that seller sold, e.g. `completed({ seller: "musicmagpie", domain: "co.uk" })`.
|
|
6248
6291
|
*
|
|
6292
|
+
* Results are ordered by `ended_at` (when eBay last closed the listing out,
|
|
6293
|
+
* UTC), newest first. eBay applies no other time order to sold listings:
|
|
6294
|
+
* `best_match`, `ending_soonest` and `newly_listed` all return this one; the
|
|
6295
|
+
* two price sorts do reorder. One listing is one result, however many units
|
|
6296
|
+
* it sold. eBay's replicas disagree slightly, so a page walk can repeat or
|
|
6297
|
+
* miss a listing; de-duplicate on `item_id`.
|
|
6298
|
+
*
|
|
6249
6299
|
* @param params - Search parameters including query, seller, filters, and pagination.
|
|
6250
6300
|
* @returns Search results (with `sold: true`), facets, and pagination.
|
|
6251
6301
|
*/
|