scrapebadger 0.73.0 → 0.75.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 CHANGED
@@ -1180,17 +1180,59 @@ declare class VintedClient {
1180
1180
  */
1181
1181
  type GoogleResponse = Record<string, unknown>;
1182
1182
  interface GoogleSearchParams {
1183
+ /** Alias for domain; Google requests use google.com with country targeting. */
1184
+ google_domain?: string;
1185
+ /** Latitude; supply together with lon instead of location or uule. */
1186
+ lat?: number;
1187
+ /** Longitude; supply together with lat. */
1188
+ lon?: number;
1189
+ /** Location accuracy in meters; requires lat/lon or a named city with a known center. */
1190
+ radius?: number;
1191
+ /** Google color scheme. */
1192
+ color_scheme?: "light" | "dark";
1193
+ /** Google search type. Use output=html for verticals; dedicated APIs provide parsed vertical results. */
1194
+ tbm?: string;
1195
+ /** Google result filter: 14 web, 18 forums. Other verticals require output=html. */
1196
+ udm?: string;
1197
+ /** Bypass result caches and request a fresh Google fetch. */
1198
+ no_cache?: boolean;
1199
+ /** Site restriction mode: i includes, e excludes as_sitesearch. */
1200
+ as_dt?: string;
1201
+ /** Exact phrase. */
1202
+ as_epq?: string;
1203
+ /** Words to exclude. */
1204
+ as_eq?: string;
1205
+ /** Find pages linking to this URL; availability depends on Google. */
1206
+ as_lq?: string;
1207
+ /** Numeric range minimum. */
1208
+ as_nlo?: string;
1209
+ /** Numeric range maximum. */
1210
+ as_nhi?: string;
1211
+ /** Match any of these words. */
1212
+ as_oq?: string;
1213
+ /** Additional query words. */
1214
+ as_q?: string;
1215
+ /** Time range, such as d, w, m or y1. */
1216
+ as_qdr?: string;
1217
+ /** Related URL; availability depends on Google. */
1218
+ as_rq?: string;
1219
+ /** Restrict results to a site. */
1220
+ as_sitesearch?: string;
1221
+ /** Custom User-Agent override. */
1222
+ user_agent?: string;
1223
+ /** json returns structured results; html returns the raw page. */
1224
+ output?: "json" | "html";
1183
1225
  q: string;
1184
1226
  gl?: string;
1185
1227
  hl?: string;
1186
1228
  num?: number;
1187
1229
  start?: number;
1188
1230
  domain?: string;
1189
- device?: "desktop" | "mobile";
1231
+ device?: "desktop" | "mobile" | "iphone" | "android" | "tablet";
1190
1232
  location?: string;
1191
1233
  lr?: string;
1192
1234
  tbs?: string;
1193
- safe?: "off" | "medium" | "high";
1235
+ safe?: "off" | "active" | "medium" | "high";
1194
1236
  uule?: string;
1195
1237
  filter?: number;
1196
1238
  nfpr?: number;
@@ -2528,7 +2570,13 @@ declare class SearchClient$h {
2528
2570
  * });
2529
2571
  * ```
2530
2572
  */
2531
- search(params: GoogleSearchParams): Promise<GoogleResponse>;
2573
+ search(params: GoogleSearchParams & {
2574
+ output: "html";
2575
+ }): Promise<string>;
2576
+ search(params: GoogleSearchParams & {
2577
+ output?: "json";
2578
+ }): Promise<GoogleResponse>;
2579
+ search(params: GoogleSearchParams): Promise<GoogleResponse | string>;
2532
2580
  /**
2533
2581
  * Google Light Search — organic results + related searches only.
2534
2582
  *
@@ -2549,7 +2597,13 @@ declare class SearchClient$h {
2549
2597
  * const lite = await client.google.search.light({ q: "python 3.13" });
2550
2598
  * ```
2551
2599
  */
2552
- light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions">): Promise<GoogleResponse>;
2600
+ light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions"> & {
2601
+ output: "html";
2602
+ }): Promise<string>;
2603
+ light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions"> & {
2604
+ output?: "json";
2605
+ }): Promise<GoogleResponse>;
2606
+ light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions">): Promise<GoogleResponse | string>;
2553
2607
  }
2554
2608
 
2555
2609
  /**
@@ -4547,6 +4601,8 @@ declare class Autoscout24Client {
4547
4601
  constructor(client: BaseClient);
4548
4602
  /** List search filters. Generated from the OpenAPI spec; returns the raw response object. */
4549
4603
  listSearchFilters(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
4604
+ /** Get listing. Generated from the OpenAPI spec; returns the raw response object. */
4605
+ getListing(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
4550
4606
  /** List markets. Generated from the OpenAPI spec; returns the raw response object. */
4551
4607
  listMarkets(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
4552
4608
  /** Search vehicles. Generated from the OpenAPI spec; returns the raw response object. */
@@ -13604,6 +13660,20 @@ declare class YandexClient {
13604
13660
  constructor(client: BaseClient);
13605
13661
  }
13606
13662
 
13663
+ /**
13664
+ * Yelp API client. // --- BEGIN generated by sdk/codegen/facade — do not edit ---
13665
+ */
13666
+
13667
+ /** Client for all Yelp API operations. (Generated from the OpenAPI spec.) */
13668
+ declare class YelpClient {
13669
+ private readonly client;
13670
+ constructor(client: BaseClient);
13671
+ /** List markets. Generated from the OpenAPI spec; returns the raw response object. */
13672
+ listMarkets(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
13673
+ /** Search businesses. Generated from the OpenAPI spec; returns the raw response object. */
13674
+ searchBusinesses(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
13675
+ }
13676
+
13607
13677
  /**
13608
13678
  * TypeScript types for YouTube API responses.
13609
13679
  *
@@ -20299,6 +20369,8 @@ declare class ScrapeBadger {
20299
20369
  readonly yahoo: YahooClient;
20300
20370
  /** Yandex scraper API client — web search, image search, reverse-image (CBIR), markets (tr/com/ru/by/kz/uz) */
20301
20371
  readonly yandex: YandexClient;
20372
+ /** Yelp API client. (Generated from the OpenAPI spec.) */
20373
+ readonly yelp: YelpClient;
20302
20374
  /** YouTube scraper API client — 39 endpoints */
20303
20375
  readonly youtube: YoutubeClient;
20304
20376
  /** Realtor scraper API client — 4 endpoints across 2 markets (us, ca) */
package/dist/index.d.ts CHANGED
@@ -1180,17 +1180,59 @@ declare class VintedClient {
1180
1180
  */
1181
1181
  type GoogleResponse = Record<string, unknown>;
1182
1182
  interface GoogleSearchParams {
1183
+ /** Alias for domain; Google requests use google.com with country targeting. */
1184
+ google_domain?: string;
1185
+ /** Latitude; supply together with lon instead of location or uule. */
1186
+ lat?: number;
1187
+ /** Longitude; supply together with lat. */
1188
+ lon?: number;
1189
+ /** Location accuracy in meters; requires lat/lon or a named city with a known center. */
1190
+ radius?: number;
1191
+ /** Google color scheme. */
1192
+ color_scheme?: "light" | "dark";
1193
+ /** Google search type. Use output=html for verticals; dedicated APIs provide parsed vertical results. */
1194
+ tbm?: string;
1195
+ /** Google result filter: 14 web, 18 forums. Other verticals require output=html. */
1196
+ udm?: string;
1197
+ /** Bypass result caches and request a fresh Google fetch. */
1198
+ no_cache?: boolean;
1199
+ /** Site restriction mode: i includes, e excludes as_sitesearch. */
1200
+ as_dt?: string;
1201
+ /** Exact phrase. */
1202
+ as_epq?: string;
1203
+ /** Words to exclude. */
1204
+ as_eq?: string;
1205
+ /** Find pages linking to this URL; availability depends on Google. */
1206
+ as_lq?: string;
1207
+ /** Numeric range minimum. */
1208
+ as_nlo?: string;
1209
+ /** Numeric range maximum. */
1210
+ as_nhi?: string;
1211
+ /** Match any of these words. */
1212
+ as_oq?: string;
1213
+ /** Additional query words. */
1214
+ as_q?: string;
1215
+ /** Time range, such as d, w, m or y1. */
1216
+ as_qdr?: string;
1217
+ /** Related URL; availability depends on Google. */
1218
+ as_rq?: string;
1219
+ /** Restrict results to a site. */
1220
+ as_sitesearch?: string;
1221
+ /** Custom User-Agent override. */
1222
+ user_agent?: string;
1223
+ /** json returns structured results; html returns the raw page. */
1224
+ output?: "json" | "html";
1183
1225
  q: string;
1184
1226
  gl?: string;
1185
1227
  hl?: string;
1186
1228
  num?: number;
1187
1229
  start?: number;
1188
1230
  domain?: string;
1189
- device?: "desktop" | "mobile";
1231
+ device?: "desktop" | "mobile" | "iphone" | "android" | "tablet";
1190
1232
  location?: string;
1191
1233
  lr?: string;
1192
1234
  tbs?: string;
1193
- safe?: "off" | "medium" | "high";
1235
+ safe?: "off" | "active" | "medium" | "high";
1194
1236
  uule?: string;
1195
1237
  filter?: number;
1196
1238
  nfpr?: number;
@@ -2528,7 +2570,13 @@ declare class SearchClient$h {
2528
2570
  * });
2529
2571
  * ```
2530
2572
  */
2531
- search(params: GoogleSearchParams): Promise<GoogleResponse>;
2573
+ search(params: GoogleSearchParams & {
2574
+ output: "html";
2575
+ }): Promise<string>;
2576
+ search(params: GoogleSearchParams & {
2577
+ output?: "json";
2578
+ }): Promise<GoogleResponse>;
2579
+ search(params: GoogleSearchParams): Promise<GoogleResponse | string>;
2532
2580
  /**
2533
2581
  * Google Light Search — organic results + related searches only.
2534
2582
  *
@@ -2549,7 +2597,13 @@ declare class SearchClient$h {
2549
2597
  * const lite = await client.google.search.light({ q: "python 3.13" });
2550
2598
  * ```
2551
2599
  */
2552
- light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions">): Promise<GoogleResponse>;
2600
+ light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions"> & {
2601
+ output: "html";
2602
+ }): Promise<string>;
2603
+ light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions"> & {
2604
+ output?: "json";
2605
+ }): Promise<GoogleResponse>;
2606
+ light(params: Omit<GoogleSearchParams, "mode" | "expand_related_questions">): Promise<GoogleResponse | string>;
2553
2607
  }
2554
2608
 
2555
2609
  /**
@@ -4547,6 +4601,8 @@ declare class Autoscout24Client {
4547
4601
  constructor(client: BaseClient);
4548
4602
  /** List search filters. Generated from the OpenAPI spec; returns the raw response object. */
4549
4603
  listSearchFilters(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
4604
+ /** Get listing. Generated from the OpenAPI spec; returns the raw response object. */
4605
+ getListing(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
4550
4606
  /** List markets. Generated from the OpenAPI spec; returns the raw response object. */
4551
4607
  listMarkets(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
4552
4608
  /** Search vehicles. Generated from the OpenAPI spec; returns the raw response object. */
@@ -13604,6 +13660,20 @@ declare class YandexClient {
13604
13660
  constructor(client: BaseClient);
13605
13661
  }
13606
13662
 
13663
+ /**
13664
+ * Yelp API client. // --- BEGIN generated by sdk/codegen/facade — do not edit ---
13665
+ */
13666
+
13667
+ /** Client for all Yelp API operations. (Generated from the OpenAPI spec.) */
13668
+ declare class YelpClient {
13669
+ private readonly client;
13670
+ constructor(client: BaseClient);
13671
+ /** List markets. Generated from the OpenAPI spec; returns the raw response object. */
13672
+ listMarkets(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
13673
+ /** Search businesses. Generated from the OpenAPI spec; returns the raw response object. */
13674
+ searchBusinesses(params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
13675
+ }
13676
+
13607
13677
  /**
13608
13678
  * TypeScript types for YouTube API responses.
13609
13679
  *
@@ -20299,6 +20369,8 @@ declare class ScrapeBadger {
20299
20369
  readonly yahoo: YahooClient;
20300
20370
  /** Yandex scraper API client — web search, image search, reverse-image (CBIR), markets (tr/com/ru/by/kz/uz) */
20301
20371
  readonly yandex: YandexClient;
20372
+ /** Yelp API client. (Generated from the OpenAPI spec.) */
20373
+ readonly yelp: YelpClient;
20302
20374
  /** YouTube scraper API client — 39 endpoints */
20303
20375
  readonly youtube: YoutubeClient;
20304
20376
  /** Realtor scraper API client — 4 endpoints across 2 markets (us, ca) */
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.73.0";
6
+ var SDK_VERSION = "0.75.0";
7
7
 
8
8
  // src/internal/exceptions.ts
9
9
  var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
@@ -360,6 +360,9 @@ var BaseClient = class _BaseClient {
360
360
  async handleResponse(response) {
361
361
  let data;
362
362
  const contentType = response.headers.get("content-type");
363
+ if (response.ok && contentType?.includes("text/html")) {
364
+ return await response.text();
365
+ }
363
366
  if (contentType?.includes("application/json")) {
364
367
  data = await response.json();
365
368
  } else {
@@ -3530,73 +3533,17 @@ var SearchClient2 = class {
3530
3533
  constructor(client) {
3531
3534
  this.client = client;
3532
3535
  }
3533
- /**
3534
- * Search Google and get a structured SERP response with organic results,
3535
- * knowledge graph, People Also Ask, related searches, AI overview, and
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
- * ```
3572
- */
3573
3536
  async search(params) {
3574
- return this.client.request("/v1/google/search", { params: { ...params } });
3537
+ return this.client.request("/v1/google/search", {
3538
+ params: { ...params }
3539
+ });
3575
3540
  }
3576
- /**
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}.
3587
- *
3588
- * Returns `{ search_information, organic_results, related_searches,
3589
- * pagination }`.
3590
- *
3591
- * @example
3592
- * ```typescript
3593
- * const lite = await client.google.search.light({ q: "python 3.13" });
3594
- * ```
3595
- */
3596
3541
  async light(params) {
3597
3542
  const light = { ...params };
3598
3543
  for (const key of FULL_SEARCH_ONLY) delete light[key];
3599
- return this.client.request("/v1/google/light/search", { params: light });
3544
+ return this.client.request("/v1/google/light/search", {
3545
+ params: light
3546
+ });
3600
3547
  }
3601
3548
  };
3602
3549
 
@@ -4632,6 +4579,10 @@ var Autoscout24Client = class {
4632
4579
  async listSearchFilters(params = {}) {
4633
4580
  return this.client.request("/v1/autoscout24/filters", { params });
4634
4581
  }
4582
+ /** Get listing. Generated from the OpenAPI spec; returns the raw response object. */
4583
+ async getListing(params = {}) {
4584
+ return this.client.request("/v1/autoscout24/listing", { params });
4585
+ }
4635
4586
  /** List markets. Generated from the OpenAPI spec; returns the raw response object. */
4636
4587
  async listMarkets(params = {}) {
4637
4588
  return this.client.request("/v1/autoscout24/markets", { params });
@@ -8592,6 +8543,22 @@ var YandexClient = class {
8592
8543
  }
8593
8544
  };
8594
8545
 
8546
+ // src/yelp/client.ts
8547
+ var YelpClient = class {
8548
+ client;
8549
+ constructor(client) {
8550
+ this.client = client;
8551
+ }
8552
+ /** List markets. Generated from the OpenAPI spec; returns the raw response object. */
8553
+ async listMarkets(params = {}) {
8554
+ return this.client.request("/v1/yelp/markets", { params });
8555
+ }
8556
+ /** Search businesses. Generated from the OpenAPI spec; returns the raw response object. */
8557
+ async searchBusinesses(params = {}) {
8558
+ return this.client.request("/v1/yelp/search", { params });
8559
+ }
8560
+ };
8561
+
8595
8562
  // src/youtube/search.ts
8596
8563
  var SearchClient15 = class {
8597
8564
  client;
@@ -10782,6 +10749,8 @@ var ScrapeBadger = class {
10782
10749
  yahoo;
10783
10750
  /** Yandex scraper API client — web search, image search, reverse-image (CBIR), markets (tr/com/ru/by/kz/uz) */
10784
10751
  yandex;
10752
+ /** Yelp API client. (Generated from the OpenAPI spec.) */
10753
+ yelp;
10785
10754
  /** YouTube scraper API client — 39 endpoints */
10786
10755
  youtube;
10787
10756
  /** Realtor scraper API client — 4 endpoints across 2 markets (us, ca) */
@@ -10882,6 +10851,7 @@ var ScrapeBadger = class {
10882
10851
  this.naver = new NaverClient(this.baseClient);
10883
10852
  this.yahoo = new YahooClient(this.baseClient);
10884
10853
  this.yandex = new YandexClient(this.baseClient);
10854
+ this.yelp = new YelpClient(this.baseClient);
10885
10855
  this.youtube = new YoutubeClient(this.baseClient);
10886
10856
  this.realtor = new RealtorClient(this.baseClient);
10887
10857
  this.leboncoin = new LeboncoinClient(this.baseClient);