scrapebadger 0.60.0 → 0.61.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.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-DBk60c2e.js';
2
- export { e as AccountRestrictedError, a5 as ApiResponse, a1 as Article, A as AuthenticationError, al as BillingLog, am as BillingLogList, a4 as Broadcast, l as CommunitiesClient, X as Community, K as CommunityBanner, Y as CommunityMember, a2 as CommunityNote, O as CommunityRule, s as CommunityTweetType, C as ConflictError, an as ConnectOptions, ad as ConnectedEvent, aa as CreateMonitorParams, aj as DeliveryLog, ak as DeliveryLogList, ag as ErrorEvent, aq as FilterRuleCreate, av as FilterRuleDeliveryLog, aw as FilterRuleDeliveryLogListResponse, at as FilterRuleListResponse, as as FilterRulePricingTier, ax as FilterRulePricingTiersResponse, ap as FilterRuleResponse, ao as FilterRuleStatus, ar as FilterRuleUpdate, au as FilterRuleValidateResponse, G as GeoClient, n as GeoSearchOptions, H as Hashtag, f as IPNotAllowedError, I as InsufficientCreditsError, i as IteratorOptions, J as List, a6 as ListResponse, L as ListsClient, _ as Location, M as Media, a7 as MonitorStatus, N as NotFoundError, g as PaginatedResponse, h as PaginationOptions, P as PermissionDeniedError, ae as PingEvent, a0 as Place, $ as PlaceTrends, u as Poll, t as PollOption, Q as QueryType, b as RateLimitError, R as ResolvedConfig, a as ScrapeBadgerError, c as ServerError, a3 as Space, q as SpacesClient, o as StreamClient, p as StreamEmitter, ah as StreamEvent, ai as StreamEventType, a8 as StreamMonitor, a9 as StreamMonitorList, ac as StreamTweet, d as TimeoutError, Z as Trend, r as TrendCategory, m as TrendsClient, z as Tweet, af as TweetEvent, y as TweetPlace, k as TweetsClient, ab as UpdateMonitorParams, w as Url, D as User, E as UserAbout, F as UserIds, x as UserMention, U as UsersClient, V as ValidationError, W as WebSocketStreamError, j as collectAll, v as verifyWebhookSignature } from './index-DBk60c2e.js';
1
+ import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-MBQ1Ksjt.js';
2
+ export { f as AccountRestrictedError, a8 as ApiResponse, a4 as Article, A as AuthenticationError, ao as BillingLog, ap as BillingLogList, h as BlockKind, c as BlockedError, i as BlockingCaptcha, a7 as Broadcast, o as CommunitiesClient, _ as Community, Y as CommunityBanner, $ as CommunityMember, a5 as CommunityNote, Z as CommunityRule, w as CommunityTweetType, C as ConflictError, aq as ConnectOptions, ag as ConnectedEvent, ad as CreateMonitorParams, am as DeliveryLog, an as DeliveryLogList, aj as ErrorEvent, at as FilterRuleCreate, ay as FilterRuleDeliveryLog, az as FilterRuleDeliveryLogListResponse, aw as FilterRuleListResponse, av as FilterRulePricingTier, aA as FilterRulePricingTiersResponse, as as FilterRuleResponse, ar as FilterRuleStatus, au as FilterRuleUpdate, ax as FilterRuleValidateResponse, G as GeoClient, q as GeoSearchOptions, H as Hashtag, g as IPNotAllowedError, I as InsufficientCreditsError, l as IteratorOptions, X as List, a9 as ListResponse, L as ListsClient, a1 as Location, M as Media, aa as MonitorStatus, N as NotFoundError, j as PaginatedResponse, k as PaginationOptions, P as PermissionDeniedError, ah as PingEvent, a3 as Place, a2 as PlaceTrends, y as Poll, x as PollOption, Q as QueryType, b as RateLimitError, R as ResolvedConfig, a as ScrapeBadgerError, d as ServerError, a6 as Space, t as SpacesClient, r as StreamClient, s as StreamEmitter, ak as StreamEvent, al as StreamEventType, ab as StreamMonitor, ac as StreamMonitorList, af as StreamTweet, e as TimeoutError, a0 as Trend, u as TrendCategory, p as TrendsClient, F as Tweet, ai as TweetEvent, E as TweetPlace, n as TweetsClient, ae as UpdateMonitorParams, z as Url, J as User, K as UserAbout, O as UserIds, D as UserMention, U as UsersClient, V as ValidationError, W as WebSocketStreamError, m as collectAll, v as verifyWebhookSignature } from './index-MBQ1Ksjt.js';
3
3
  import 'node:events';
4
4
 
5
5
  /**
@@ -9880,6 +9880,8 @@ declare class WalmartClient {
9880
9880
  * Three markets share these types: `uk` (gumtree.com, GBP), `au`
9881
9881
  * (gumtree.com.au, AUD) and `za` (gumtree.co.za, ZAR). They are separate
9882
9882
  * platforms, so a field one market does not publish is simply `null` there.
9883
+ * Category, location and tree ids are numbers on uk/au and gumtree.co.za refs
9884
+ * (strings such as `"p6dnh"`) on za, so those fields are `number | string`.
9883
9885
  * Every top-level response carries the `market` it came from. Every datetime
9884
9886
  * ships in BOTH forms: `*_utc` (Unix seconds) and `*_at` (ISO 8601 UTC string).
9885
9887
  * Phone numbers are only ever the MASKED form Gumtree shows a logged-out
@@ -9894,7 +9896,8 @@ interface GumtreeAttribute {
9894
9896
  }
9895
9897
  /** A category reference attached to an autocomplete suggestion. */
9896
9898
  interface GumtreeCategoryRef {
9897
- id: number | null;
9899
+ /** za: a ref such as `"p6dnh"`. */
9900
+ id: number | string | null;
9898
9901
  name: string | null;
9899
9902
  slug: string | null;
9900
9903
  }
@@ -9906,7 +9909,7 @@ interface GumtreeBreadcrumb {
9906
9909
  /** A listing as it appears on a search / seller / similar-listings grid. */
9907
9910
  interface GumtreeListingSummary {
9908
9911
  id: string;
9909
- /** za: the 10-digit id Gumtree shows (the `id` is the full ad id). */
9912
+ /** Not published by any market at present (za's old short id). */
9910
9913
  short_id: string | null;
9911
9914
  title: string | null;
9912
9915
  url: string | null;
@@ -9918,7 +9921,7 @@ interface GumtreeListingSummary {
9918
9921
  price_text: string | null;
9919
9922
  /** `pm` / `pw` for rentals. */
9920
9923
  price_frequency: string | null;
9921
- /** au/za: `FIXED`, `NEGOTIABLE` / `MAKE_OFFER`, `FREE`, `SWAP_TRADE`… */
9924
+ /** au: `FIXED`, `NEGOTIABLE`, `FREE`, `SWAP_TRADE`…; za: `ASKING_PRICE`, `POA`… */
9922
9925
  price_type: string | null;
9923
9926
  currency: string;
9924
9927
  location: string | null;
@@ -9929,10 +9932,11 @@ interface GumtreeListingSummary {
9929
9932
  /** e.g. `"13 miles"` (uk) or `"4 km"` (au) from the search location. */
9930
9933
  distance_text: string | null;
9931
9934
  distance_miles: number | null;
9932
- category_id: number | null;
9935
+ /** za: a ref such as `"p6dnh"`. */
9936
+ category_id: number | string | null;
9933
9937
  category_name: string | null;
9934
- /** Root-to-leaf category ids. */
9935
- category_ids: number[];
9938
+ /** Root-to-leaf category ids (refs on za). */
9939
+ category_ids: (number | string)[];
9936
9940
  image_url: string | null;
9937
9941
  image_urls: string[];
9938
9942
  image_count: number | null;
@@ -9962,8 +9966,8 @@ interface GumtreeListingSummary {
9962
9966
  }
9963
9967
  /** A sub-category of a result set, with its listing count. */
9964
9968
  interface GumtreeCategoryFacet {
9965
- /** au/za: the category id `search` takes. */
9966
- id: number | null;
9969
+ /** au: the numeric category id `search` takes; za: its ref. */
9970
+ id: number | string | null;
9967
9971
  name: string | null;
9968
9972
  slug: string | null;
9969
9973
  count: number | null;
@@ -9976,7 +9980,8 @@ interface GumtreeSearchResponse {
9976
9980
  /** Category slug the search ran in. */
9977
9981
  category: string | null;
9978
9982
  category_name: string | null;
9979
- category_id: number | null;
9983
+ /** za: a ref such as `"p6dnh"`. */
9984
+ category_id: number | string | null;
9980
9985
  /** Location slug / postcode searched. */
9981
9986
  location: string | null;
9982
9987
  location_name: string | null;
@@ -10053,7 +10058,7 @@ interface GumtreeSeller {
10053
10058
  is_pro: boolean | null;
10054
10059
  /** e.g. `"6+ years"`. */
10055
10060
  posting_since: string | null;
10056
- /** au: year the account opened. */
10061
+ /** au/za: year the account opened. */
10057
10062
  member_since_year: number | null;
10058
10063
  /** au: e.g. `"yesterday"`. */
10059
10064
  last_active_text: string | null;
@@ -10061,9 +10066,9 @@ interface GumtreeSeller {
10061
10066
  last_active_at: string | null;
10062
10067
  /** Live listings right now. */
10063
10068
  total_listings: number | null;
10064
- /** za: ads ever posted. */
10069
+ /** Ads ever posted (no market publishes it at present). */
10065
10070
  lifetime_listings: number | null;
10066
- /** za: views across all their ads. */
10071
+ /** Views across all their ads (no market publishes it at present). */
10067
10072
  total_views: number | null;
10068
10073
  listings_last_year: number | null;
10069
10074
  listings_by_category: Record<string, number>;
@@ -10089,7 +10094,7 @@ interface GumtreeListingDetail {
10089
10094
  price: number | null;
10090
10095
  price_text: string | null;
10091
10096
  price_frequency: string | null;
10092
- /** au/za: `FIXED`, `NEGOTIABLE` / `MAKE_OFFER`, `FREE`, `SWAP_TRADE`… */
10097
+ /** au: `FIXED`, `NEGOTIABLE`, `FREE`, `SWAP_TRADE`…; za: `ASKING_PRICE`, `POA`… */
10093
10098
  price_type: string | null;
10094
10099
  currency: string;
10095
10100
  /** Motors trade listings: `"Inc VAT"` / `"No VAT"`. */
@@ -10101,9 +10106,11 @@ interface GumtreeListingDetail {
10101
10106
  postcode: string | null;
10102
10107
  latitude: number | null;
10103
10108
  longitude: number | null;
10104
- category_id: number | null;
10109
+ /** za: a ref such as `"p6dnh"`. */
10110
+ category_id: number | string | null;
10105
10111
  category_name: string | null;
10106
- category_ids: number[];
10112
+ /** Root-to-leaf category ids (refs on za). */
10113
+ category_ids: (number | string)[];
10107
10114
  breadcrumbs: GumtreeBreadcrumb[];
10108
10115
  image_urls: string[];
10109
10116
  video_urls: string[];
@@ -10146,7 +10153,7 @@ interface GumtreeSellerListingsResponse {
10146
10153
  total_results: number | null;
10147
10154
  page: number;
10148
10155
  total_pages: number | null;
10149
- /** `za`: another page follows (the site gives no total upfront). `null` elsewhere. */
10156
+ /** `za`: another page follows. `null` elsewhere. */
10150
10157
  has_next?: boolean | null;
10151
10158
  result_count: number;
10152
10159
  listings: GumtreeListingSummary[];
@@ -10168,7 +10175,8 @@ interface GumtreeAutocompleteResponse {
10168
10175
  }
10169
10176
  /** A Gumtree location matched by name or postcode prefix. */
10170
10177
  interface GumtreeLocationSuggestion {
10171
- id: number | null;
10178
+ /** za: a ref such as `"pfw8k"`. */
10179
+ id: number | string | null;
10172
10180
  name: string | null;
10173
10181
  /** uk: location / outcode / postcode; au/za: region / area. */
10174
10182
  type: string | null;
@@ -10185,7 +10193,8 @@ interface GumtreeLocationAutocompleteResponse {
10185
10193
  }
10186
10194
  /** A category or location node. `slug` (uk) or `id` (au/za) is what `search` takes. */
10187
10195
  interface GumtreeTreeNode {
10188
- id: number;
10196
+ /** A number on uk/au, a ref such as `"p6dnh"` on za. */
10197
+ id: number | string;
10189
10198
  name: string | null;
10190
10199
  slug: string | null;
10191
10200
  has_children: boolean | null;
@@ -10194,7 +10203,8 @@ interface GumtreeTreeNode {
10194
10203
  interface GumtreeTreeResponse {
10195
10204
  /** `uk` = gumtree.com, `au` = gumtree.com.au, `za` = gumtree.co.za. */
10196
10205
  market: string;
10197
- id: number;
10206
+ /** A number on uk/au, a ref such as `"l4dq6"` on za. */
10207
+ id: number | string;
10198
10208
  name: string | null;
10199
10209
  slug: string | null;
10200
10210
  result_count: number;
@@ -10236,14 +10246,16 @@ interface GumtreeSearchParams {
10236
10246
  query?: string;
10237
10247
  /**
10238
10248
  * uk: category slug, e.g. `"cars"`, `"for-sale"`, `"property-to-rent"`.
10239
- * au/za: numeric category id as a string, e.g. `"18320"` (au cars) or
10240
- * `"9077"` (za cars). Browse the tree with `listCategories`. Default `"all"`.
10249
+ * au: numeric category id as a string, e.g. `"18320"` (cars). za: category
10250
+ * ref, e.g. `"p6dnh"` (Cars & Bakkies). Browse the tree with
10251
+ * `listCategories`. Default `"all"`.
10241
10252
  */
10242
10253
  category?: string;
10243
10254
  /**
10244
10255
  * uk: location slug (`"london"`), town name or UK postcode (`"SW1A 1AA"`).
10245
- * au/za: numeric location id as a string, e.g. `"3003435"` (au Sydney) or
10246
- * `"3100003"` (za Gauteng). Resolve one with `locationAutocomplete`.
10256
+ * au: numeric location id as a string, e.g. `"3003435"` (Sydney). za:
10257
+ * location ref, e.g. `"dkp8y"` (Gauteng). Resolve one with
10258
+ * `locationAutocomplete`.
10247
10259
  * Default: the whole country.
10248
10260
  */
10249
10261
  location?: string;
@@ -10264,24 +10276,27 @@ interface GumtreeSearchParams {
10264
10276
  /**
10265
10277
  * Category-specific filters as comma-separated `key:value` pairs, e.g.
10266
10278
  * `"vehicle_make:bmw,vehicle_fuel_type:petrol,min_vehicle_mileage:10000"` (uk)
10267
- * or `"ma:toyota,fu:petrol,max_km:100000"` (za). Range filters take
10279
+ * or `"make:toyota,fuelType:petrol,max_mileageKm:100000"` (za). Range filters take
10268
10280
  * `min_<key>`/`max_<key>`. Discover keys with `searchFilters` for the same market.
10269
10281
  */
10270
10282
  filters?: string;
10271
- /** Page number, 1-50. */
10283
+ /** Page number, 1-50 (za: only the first 375 matches are reachable). */
10272
10284
  page?: number;
10273
10285
  /** Which Gumtree. Unset = the server default, `"uk"`. */
10274
10286
  market?: GumtreeMarket;
10275
10287
  }
10276
10288
  /** Parameters for `GET /v1/gumtree/search/filters`. All optional. */
10277
10289
  interface GumtreeSearchFiltersParams {
10278
- /** uk: category slug; au/za: numeric category id. Default `"all"`. */
10290
+ /** uk: category slug; au: numeric category id; za: category ref (`"p6dnh"`). Default `"all"`. */
10279
10291
  category?: string;
10280
- /** uk: location slug, town or UK postcode; au/za: numeric location id. Default: the whole country. */
10292
+ /**
10293
+ * uk: location slug, town or UK postcode; au: numeric location id; za:
10294
+ * location ref (`"dkp8y"`). Default: the whole country.
10295
+ */
10281
10296
  location?: string;
10282
10297
  /** Optional keywords to scope the counts. */
10283
10298
  query?: string;
10284
- /** za only: filters already applied, e.g. `"ma:toyota"` to list the Toyota models. */
10299
+ /** za only: filters already applied, e.g. `"make:toyota"` to narrow the model counts. */
10285
10300
  filters?: string;
10286
10301
  /** Which Gumtree. Unset = the server default, `"uk"`. */
10287
10302
  market?: GumtreeMarket;
@@ -10298,8 +10313,8 @@ interface GumtreeSellerListingsParams extends GumtreeMarketParams {
10298
10313
  }
10299
10314
  /** Options for `listLocations` and `listCategories`. */
10300
10315
  interface GumtreeTreeParams extends GumtreeMarketParams {
10301
- /** Node id to list the children of. Unset = the market's root. */
10302
- parent_id?: number;
10316
+ /** Node id (uk/au: a number; za: a ref such as `"dkp8y"`). Unset = the market's root. */
10317
+ parent_id?: number | string;
10303
10318
  }
10304
10319
 
10305
10320
  /**
@@ -10315,8 +10330,8 @@ interface GumtreeTreeParams extends GumtreeMarketParams {
10315
10330
  * Three markets, chosen per call with `market`: `"uk"` (gumtree.com, GBP — the
10316
10331
  * server default), `"au"` (gumtree.com.au, AUD) and `"za"` (gumtree.co.za,
10317
10332
  * ZAR). They are separate sites: uk takes slugs for category and location,
10318
- * au/za take numeric ids from `listCategories` / `listLocations` of the same
10319
- * market.
10333
+ * au takes numeric ids and za takes refs (`"p6dnh"`) from `listCategories` /
10334
+ * `listLocations` of the same market.
10320
10335
  */
10321
10336
 
10322
10337
  /**
@@ -10345,9 +10360,14 @@ interface GumtreeTreeParams extends GumtreeMarketParams {
10345
10360
  * distance: 10,
10346
10361
  * });
10347
10362
  *
10348
- * // South Africa: cars (9077) in Gauteng (3100003); listing ids are 26 digits
10349
- * const za = await client.gumtree.search({ market: "za", category: "9077", location: "3100003" });
10350
- * const detail = await client.gumtree.getListing("10013681289561010209976109", { market: "za" });
10363
+ * // South Africa: refs — Cars & Bakkies (p6dnh) in Gauteng (dkp8y)
10364
+ * const za = await client.gumtree.search({
10365
+ * market: "za",
10366
+ * category: "p6dnh",
10367
+ * location: "dkp8y",
10368
+ * filters: "make:toyota",
10369
+ * });
10370
+ * const detail = await client.gumtree.getListing("ls26bvmcpnsqmz7l9jz", { market: "za" });
10351
10371
  * console.log(detail.seller?.name);
10352
10372
  *
10353
10373
  * // Browse a market's category tree
@@ -10386,9 +10406,8 @@ declare class GumtreeClient {
10386
10406
  * Full listing: description, every attribute, images, location, seller and
10387
10407
  * similar ads. Motors listings carry the full vehicle spec.
10388
10408
  *
10389
- * @param listingId - Gumtree listing id — the number at the end of the
10390
- * listing URL (uk/au: ~10 digits; za: the full 26-digit ad id, not the
10391
- * short one).
10409
+ * @param listingId - Gumtree listing id from the end of the listing URL
10410
+ * (uk/au: ~10 digits; za: the listing ref, e.g. `"ls26bvmcpnsqmz7l9jz"`).
10392
10411
  * @param options - Optional parameters (market).
10393
10412
  * @throws NotFoundError - If the listing does not exist or has expired.
10394
10413
  */
@@ -10397,8 +10416,8 @@ declare class GumtreeClient {
10397
10416
  * Every live listing by the seller of `listingId`. Gumtree keys a seller's
10398
10417
  * ad list by one of their ads, so any listing id of theirs works.
10399
10418
  *
10400
- * @param listingId - Any Gumtree listing id belonging to the seller (za: the
10401
- * 26-digit id).
10419
+ * @param listingId - Any Gumtree listing id belonging to the seller (za: a
10420
+ * listing ref, e.g. `"ls26bvmcpnsqmz7l9jz"`).
10402
10421
  * @param options - Page number (1-50), or `{ page, market }`.
10403
10422
  */
10404
10423
  getSellerListings(listingId: string, options?: number | GumtreeSellerListingsParams): Promise<GumtreeSellerListingsResponse>;
@@ -10411,7 +10430,8 @@ declare class GumtreeClient {
10411
10430
  autocomplete(query: string, options?: GumtreeMarketParams): Promise<GumtreeAutocompleteResponse>;
10412
10431
  /**
10413
10432
  * Resolve a place name or postcode prefix to Gumtree locations. The `id`
10414
- * (au/za) or `name` (uk) is what {@link search} takes as `location`.
10433
+ * (au: a number; za: a ref such as `"pfw8k"`) or `name` (uk) is what
10434
+ * {@link search} takes as `location`.
10415
10435
  *
10416
10436
  * @param query - Town, area or postcode prefix (min 2 chars), e.g. `"manch"` or `"SW1A"`.
10417
10437
  * @param options - Optional parameters (market).
@@ -10419,20 +10439,22 @@ declare class GumtreeClient {
10419
10439
  locationAutocomplete(query: string, options?: GumtreeMarketParams): Promise<GumtreeLocationAutocompleteResponse>;
10420
10440
  /**
10421
10441
  * Browse Gumtree's location tree. uk: UK -> nations -> counties -> towns;
10422
- * au: states -> regions -> areas; za: provinces -> towns.
10442
+ * au: states -> regions -> areas; za: provinces -> towns and suburbs.
10423
10443
  *
10424
- * @param options - Location id to list the children of, or
10444
+ * @param options - Location id (uk/au: a number; za: a ref such as
10445
+ * `"dkp8y"` for Gauteng) to list the children of, or
10425
10446
  * `{ parent_id, market }`. Unset = the market's root (the whole country).
10426
10447
  */
10427
- listLocations(options?: number | GumtreeTreeParams): Promise<GumtreeTreeResponse>;
10448
+ listLocations(options?: number | string | GumtreeTreeParams): Promise<GumtreeTreeResponse>;
10428
10449
  /**
10429
- * Browse Gumtree's category tree. A node's `slug` (uk) or `id` (au/za) is
10430
- * the {@link search} category.
10450
+ * Browse Gumtree's category tree. A node's `slug` (uk) or `id` (au: a
10451
+ * number; za: a ref such as `"p6dnh"`) is the {@link search} category.
10431
10452
  *
10432
- * @param options - Category id to list the children of, or
10453
+ * @param options - Category id (uk/au: a number; za: a ref such as
10454
+ * `"l4dq6"` for Vehicles) to list the children of, or
10433
10455
  * `{ parent_id, market }`. Unset = the market's root (all categories).
10434
10456
  */
10435
- listCategories(options?: number | GumtreeTreeParams): Promise<GumtreeTreeResponse>;
10457
+ listCategories(options?: number | string | GumtreeTreeParams): Promise<GumtreeTreeResponse>;
10436
10458
  /**
10437
10459
  * The Gumtree sites this API covers (`uk`, `au`, `za`), with their domain,
10438
10460
  * currency, distance unit, page size and id format.
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.60.0";
12
+ var SDK_VERSION = "0.61.0";
13
13
 
14
14
  // src/internal/exceptions.ts
15
15
  var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
@@ -88,6 +88,25 @@ var ValidationError = class _ValidationError extends ScrapeBadgerError {
88
88
  Object.setPrototypeOf(this, _ValidationError.prototype);
89
89
  }
90
90
  };
91
+ var BlockedError = class _BlockedError extends ValidationError {
92
+ /** The wall's class; undefined on older responses */
93
+ blockKind;
94
+ /** The protection vendor that served it, e.g. "cloudflare", "datadome", "aws_waf" */
95
+ vendor;
96
+ /** The CAPTCHA gating the page when blockKind is "captcha" */
97
+ captcha;
98
+ /** The scrape result the API returned with the block */
99
+ data;
100
+ constructor(message = "Blocking page detected.", details = {}) {
101
+ super(message);
102
+ this.name = "BlockedError";
103
+ this.blockKind = details.blockKind ?? void 0;
104
+ this.vendor = details.vendor ?? void 0;
105
+ this.captcha = details.captcha ?? void 0;
106
+ this.data = details.data ?? void 0;
107
+ Object.setPrototypeOf(this, _BlockedError.prototype);
108
+ }
109
+ };
91
110
  var ServerError = class _ServerError extends ScrapeBadgerError {
92
111
  /** HTTP status code */
93
112
  statusCode;
@@ -383,6 +402,14 @@ var BaseClient = class _BaseClient {
383
402
  case 409:
384
403
  throw new ConflictError(message);
385
404
  case 422:
405
+ if (errorData.error === "blocking_page_detected") {
406
+ throw new BlockedError(message, {
407
+ blockKind: errorData.block_kind,
408
+ vendor: errorData.vendor,
409
+ captcha: errorData.captcha,
410
+ data: errorData.data
411
+ });
412
+ }
386
413
  throw new ValidationError(message, errorData.errors);
387
414
  case 429:
388
415
  throw new RateLimitError(message, {
@@ -6591,9 +6618,8 @@ var GumtreeClient = class {
6591
6618
  * Full listing: description, every attribute, images, location, seller and
6592
6619
  * similar ads. Motors listings carry the full vehicle spec.
6593
6620
  *
6594
- * @param listingId - Gumtree listing id — the number at the end of the
6595
- * listing URL (uk/au: ~10 digits; za: the full 26-digit ad id, not the
6596
- * short one).
6621
+ * @param listingId - Gumtree listing id from the end of the listing URL
6622
+ * (uk/au: ~10 digits; za: the listing ref, e.g. `"ls26bvmcpnsqmz7l9jz"`).
6597
6623
  * @param options - Optional parameters (market).
6598
6624
  * @throws NotFoundError - If the listing does not exist or has expired.
6599
6625
  */
@@ -6606,8 +6632,8 @@ var GumtreeClient = class {
6606
6632
  * Every live listing by the seller of `listingId`. Gumtree keys a seller's
6607
6633
  * ad list by one of their ads, so any listing id of theirs works.
6608
6634
  *
6609
- * @param listingId - Any Gumtree listing id belonging to the seller (za: the
6610
- * 26-digit id).
6635
+ * @param listingId - Any Gumtree listing id belonging to the seller (za: a
6636
+ * listing ref, e.g. `"ls26bvmcpnsqmz7l9jz"`).
6611
6637
  * @param options - Page number (1-50), or `{ page, market }`.
6612
6638
  */
6613
6639
  async getSellerListings(listingId, options = {}) {
@@ -6630,7 +6656,8 @@ var GumtreeClient = class {
6630
6656
  }
6631
6657
  /**
6632
6658
  * Resolve a place name or postcode prefix to Gumtree locations. The `id`
6633
- * (au/za) or `name` (uk) is what {@link search} takes as `location`.
6659
+ * (au: a number; za: a ref such as `"pfw8k"`) or `name` (uk) is what
6660
+ * {@link search} takes as `location`.
6634
6661
  *
6635
6662
  * @param query - Town, area or postcode prefix (min 2 chars), e.g. `"manch"` or `"SW1A"`.
6636
6663
  * @param options - Optional parameters (market).
@@ -6643,9 +6670,10 @@ var GumtreeClient = class {
6643
6670
  }
6644
6671
  /**
6645
6672
  * Browse Gumtree's location tree. uk: UK -> nations -> counties -> towns;
6646
- * au: states -> regions -> areas; za: provinces -> towns.
6673
+ * au: states -> regions -> areas; za: provinces -> towns and suburbs.
6647
6674
  *
6648
- * @param options - Location id to list the children of, or
6675
+ * @param options - Location id (uk/au: a number; za: a ref such as
6676
+ * `"dkp8y"` for Gauteng) to list the children of, or
6649
6677
  * `{ parent_id, market }`. Unset = the market's root (the whole country).
6650
6678
  */
6651
6679
  async listLocations(options = {}) {
@@ -6654,10 +6682,11 @@ var GumtreeClient = class {
6654
6682
  });
6655
6683
  }
6656
6684
  /**
6657
- * Browse Gumtree's category tree. A node's `slug` (uk) or `id` (au/za) is
6658
- * the {@link search} category.
6685
+ * Browse Gumtree's category tree. A node's `slug` (uk) or `id` (au: a
6686
+ * number; za: a ref such as `"p6dnh"`) is the {@link search} category.
6659
6687
  *
6660
- * @param options - Category id to list the children of, or
6688
+ * @param options - Category id (uk/au: a number; za: a ref such as
6689
+ * `"l4dq6"` for Vehicles) to list the children of, or
6661
6690
  * `{ parent_id, market }`. Unset = the market's root (all categories).
6662
6691
  */
6663
6692
  async listCategories(options = {}) {
@@ -6674,7 +6703,7 @@ var GumtreeClient = class {
6674
6703
  }
6675
6704
  };
6676
6705
  function treeParams(options) {
6677
- const { parent_id, market } = typeof options === "number" ? { parent_id: options } : options;
6706
+ const { parent_id, market } = typeof options === "object" ? options : { parent_id: options };
6678
6707
  return { parent_id, market };
6679
6708
  }
6680
6709
 
@@ -10309,6 +10338,7 @@ exports.BingMediaClient = MediaClient3;
10309
10338
  exports.BingNewsClient = NewsClient2;
10310
10339
  exports.BingReferenceClient = ReferenceClient8;
10311
10340
  exports.BingSearchClient = SearchClient11;
10341
+ exports.BlockedError = BlockedError;
10312
10342
  exports.ChatGPTAskClient = AskClient;
10313
10343
  exports.ChatGPTBrandClient = BrandClient;
10314
10344
  exports.ChatGPTClient = ChatGPTClient;