scrapebadger 0.60.1 → 0.61.1

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.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.60.1";
6
+ var SDK_VERSION = "0.61.1";
7
7
 
8
8
  // src/internal/exceptions.ts
9
9
  var ScrapeBadgerError = class _ScrapeBadgerError extends Error {
@@ -82,6 +82,25 @@ var ValidationError = class _ValidationError extends ScrapeBadgerError {
82
82
  Object.setPrototypeOf(this, _ValidationError.prototype);
83
83
  }
84
84
  };
85
+ var BlockedError = class _BlockedError extends ValidationError {
86
+ /** The wall's class; undefined on older responses */
87
+ blockKind;
88
+ /** The protection vendor that served it, e.g. "cloudflare", "datadome", "aws_waf" */
89
+ vendor;
90
+ /** The CAPTCHA gating the page when blockKind is "captcha" */
91
+ captcha;
92
+ /** The scrape result the API returned with the block */
93
+ data;
94
+ constructor(message = "Blocking page detected.", details = {}) {
95
+ super(message);
96
+ this.name = "BlockedError";
97
+ this.blockKind = details.blockKind ?? void 0;
98
+ this.vendor = details.vendor ?? void 0;
99
+ this.captcha = details.captcha ?? void 0;
100
+ this.data = details.data ?? void 0;
101
+ Object.setPrototypeOf(this, _BlockedError.prototype);
102
+ }
103
+ };
85
104
  var ServerError = class _ServerError extends ScrapeBadgerError {
86
105
  /** HTTP status code */
87
106
  statusCode;
@@ -377,6 +396,14 @@ var BaseClient = class _BaseClient {
377
396
  case 409:
378
397
  throw new ConflictError(message);
379
398
  case 422:
399
+ if (errorData.error === "blocking_page_detected") {
400
+ throw new BlockedError(message, {
401
+ blockKind: errorData.block_kind,
402
+ vendor: errorData.vendor,
403
+ captcha: errorData.captcha,
404
+ data: errorData.data
405
+ });
406
+ }
380
407
  throw new ValidationError(message, errorData.errors);
381
408
  case 429:
382
409
  throw new RateLimitError(message, {
@@ -6999,8 +7026,6 @@ var BaiduClient = class {
6999
7026
  /**
7000
7027
  * Search baidu.com — the web SERP.
7001
7028
  *
7002
- * Costs 5 credits.
7003
- *
7004
7029
  * @param query - Search keywords, e.g. `"咖啡机"` or `"coffee machine"` (required).
7005
7030
  * @param options - Optional parameters (page, num, language, timeFrom, timeTo).
7006
7031
  * @returns Search response with organic results and Baidu's related searches.
@@ -7022,8 +7047,6 @@ var BaiduClient = class {
7022
7047
  /**
7023
7048
  * Search the Baidu news vertical.
7024
7049
  *
7025
- * Costs 5 credits.
7026
- *
7027
7050
  * @param query - Search keywords, e.g. `"人工智能"` (required).
7028
7051
  * @param options - Optional parameters (page, sort).
7029
7052
  * @returns News response with articles carrying publisher, date and real URLs.
@@ -7038,8 +7061,6 @@ var BaiduClient = class {
7038
7061
  /**
7039
7062
  * Search Baidu images.
7040
7063
  *
7041
- * Costs 5 credits.
7042
- *
7043
7064
  * @param query - Search keywords, e.g. `"猫"` (required).
7044
7065
  * @param options - Optional parameters (page). Baidu serves 30 images per page.
7045
7066
  * @returns Images response with full-size image URLs, Baidu-hosted thumbnail
@@ -7055,8 +7076,6 @@ var BaiduClient = class {
7055
7076
  /**
7056
7077
  * Baidu search-box suggestions — the cheapest call in this API.
7057
7078
  *
7058
- * Costs 1 credit.
7059
- *
7060
7079
  * @param query - Partial search term, e.g. `"咖啡"` or `"coff"` (required).
7061
7080
  * @returns Autocomplete response with Baidu's suggestions for the term.
7062
7081
  * @throws AuthenticationError - If the API key is invalid.
@@ -9232,8 +9251,6 @@ var SearchClient19 = class {
9232
9251
  /**
9233
9252
  * Search LoopNet for for-lease / for-sale / auction commercial listings.
9234
9253
  *
9235
- * Costs 10 credits.
9236
- *
9237
9254
  * @param params - Search parameters including location, filters, and pagination.
9238
9255
  * @returns Search results with listing cards and pagination metadata.
9239
9256
  * @throws AuthenticationError - If the API key is invalid.
@@ -9266,8 +9283,6 @@ var ListingsClient2 = class {
9266
9283
  /**
9267
9284
  * Get a single LoopNet listing's full detail by listing id.
9268
9285
  *
9269
- * Costs 12 credits.
9270
- *
9271
9286
  * @param listingId - The LoopNet listing id.
9272
9287
  * @param params - Optional market selector.
9273
9288
  * @returns Listing detail response.
@@ -9289,8 +9304,6 @@ var BrokersClient = class {
9289
9304
  /**
9290
9305
  * Get a LoopNet broker's profile and their active listings.
9291
9306
  *
9292
- * Costs 8 credits.
9293
- *
9294
9307
  * @param slug - The broker's profile URL slug.
9295
9308
  * @param brokerId - The LoopNet broker id.
9296
9309
  * @param params - Optional market selector.
@@ -9390,8 +9403,6 @@ var DepopClient = class {
9390
9403
  /**
9391
9404
  * Search Depop for products.
9392
9405
  *
9393
- * Costs 10 credits.
9394
- *
9395
9406
  * @param query - Search keywords (required).
9396
9407
  * @param options - Optional parameters (market, perPage, page, price/brand/
9397
9408
  * size/colour/condition/gender filters, sort).
@@ -9420,8 +9431,6 @@ var DepopClient = class {
9420
9431
  /**
9421
9432
  * Get a single Depop product's full detail by slug.
9422
9433
  *
9423
- * Costs 10 credits.
9424
- *
9425
9434
  * @param slug - The Depop product slug.
9426
9435
  * @param options - Optional parameters (market).
9427
9436
  * @returns Full product detail.
@@ -9435,8 +9444,6 @@ var DepopClient = class {
9435
9444
  /**
9436
9445
  * Get a Depop shop / seller profile by username.
9437
9446
  *
9438
- * Costs 10 credits.
9439
- *
9440
9447
  * @param username - The Depop seller username.
9441
9448
  * @param options - Optional parameters (market).
9442
9449
  * @returns Shop profile.
@@ -9450,8 +9457,6 @@ var DepopClient = class {
9450
9457
  /**
9451
9458
  * Get a Depop seller's products.
9452
9459
  *
9453
- * Costs 10 credits.
9454
- *
9455
9460
  * @param username - The Depop seller username.
9456
9461
  * @param options - Optional parameters (market, perPage, page).
9457
9462
  * @returns User products response with product cards and pagination meta.
@@ -9497,8 +9502,6 @@ var WallapopClient = class {
9497
9502
  * Needs a query, a `categoryId`, or both — unless `nextPage` is given, in
9498
9503
  * which case every other parameter is ignored.
9499
9504
  *
9500
- * Costs 5 credits.
9501
- *
9502
9505
  * @param query - Search text, e.g. "iphone 14" (optional with `categoryId` or `nextPage`).
9503
9506
  * @param options - Optional parameters (market, location/radius, category,
9504
9507
  * price, condition, brand/model/colour, cars filters, sort, cursor).
@@ -9540,8 +9543,6 @@ var WallapopClient = class {
9540
9543
  /**
9541
9544
  * Get a single listing's full detail.
9542
9545
  *
9543
- * Costs 5 credits.
9544
- *
9545
9546
  * @param itemId - Listing id (e.g. "nzxeknm5x562") or listing slug.
9546
9547
  * @param options - Optional parameters (market).
9547
9548
  * @returns Full listing detail with attributes, counters and location.
@@ -9557,8 +9558,6 @@ var WallapopClient = class {
9557
9558
  * Get a seller's profile with ratings, sales counters, response rate and
9558
9559
  * verifications.
9559
9560
  *
9560
- * Costs 5 credits.
9561
- *
9562
9561
  * @param userId - User id (e.g. "dqjwdd53wwzo") or profile slug (e.g. "alexc-25115753").
9563
9562
  * @param options - Optional parameters (market).
9564
9563
  * @returns User profile.
@@ -9573,8 +9572,6 @@ var WallapopClient = class {
9573
9572
  /**
9574
9573
  * Get a seller's live listings (40 per page).
9575
9574
  *
9576
- * Costs 5 credits.
9577
- *
9578
9575
  * @param userId - User id or profile slug.
9579
9576
  * @param options - Optional parameters (market, nextPage).
9580
9577
  * @returns The seller's listings and the next-page cursor.
@@ -9589,8 +9586,6 @@ var WallapopClient = class {
9589
9586
  /**
9590
9587
  * Get the reviews a seller received, newest first (40 per page).
9591
9588
  *
9592
- * Costs 5 credits.
9593
- *
9594
9589
  * @param userId - User id or profile slug.
9595
9590
  * @param options - Optional parameters (market, nextPage).
9596
9591
  * @returns Reviews and the next-page cursor.
@@ -9605,8 +9600,6 @@ var WallapopClient = class {
9605
9600
  /**
9606
9601
  * Get Wallapop's search-box suggestions for a partial query.
9607
9602
  *
9608
- * Costs 1 credit.
9609
- *
9610
9603
  * @param query - Partial search text, e.g. "bici".
9611
9604
  * @param options - Optional parameters (market).
9612
9605
  * @returns Autocomplete suggestions.
@@ -9619,8 +9612,6 @@ var WallapopClient = class {
9619
9612
  /**
9620
9613
  * Get the full category tree; ids are usable as the search `categoryId`.
9621
9614
  *
9622
- * Costs 1 credit.
9623
- *
9624
9615
  * @param options - Optional parameters (market — localises names).
9625
9616
  * @returns Category tree.
9626
9617
  */
@@ -9633,8 +9624,6 @@ var WallapopClient = class {
9633
9624
  * Get the search filters Wallapop offers for a category and/or query,
9634
9625
  * with their option ids.
9635
9626
  *
9636
- * Costs 2 credits.
9637
- *
9638
9627
  * @param options - Optional parameters (categoryId, query, market).
9639
9628
  * @returns Available filters.
9640
9629
  */
@@ -9651,8 +9640,6 @@ var WallapopClient = class {
9651
9640
  * Get a filter's long option list (brands, models) that Wallapop serves
9652
9641
  * separately — filters flagged `options_endpoint` in `listFilters`.
9653
9642
  *
9654
- * Costs 2 credits.
9655
- *
9656
9643
  * @param filterId - Filter id, e.g. "brand".
9657
9644
  * @param options - Optional parameters (categoryId, query, market).
9658
9645
  * @returns The filter's options.
@@ -9857,7 +9844,7 @@ var AskClient = class {
9857
9844
  /**
9858
9845
  * Ask ChatGPT a question and get the answer with its sources.
9859
9846
  *
9860
- * Costs 20 credits. Typical latency is 20-25s ungrounded, 30-70s with web search.
9847
+ * Typical latency is 20-25s ungrounded, 30-70s with web search.
9861
9848
  *
9862
9849
  * @param params - Ask parameters.
9863
9850
  * @param params.prompt - The prompt to send (max 4096 characters).
@@ -9902,8 +9889,6 @@ var BrandClient = class {
9902
9889
  /**
9903
9890
  * Analyse how a brand shows up in ChatGPT's answer to a prompt.
9904
9891
  *
9905
- * Costs 25 credits.
9906
- *
9907
9892
  * @param params - Brand-visibility parameters.
9908
9893
  * @param params.prompt - The prompt to send (max 4096 characters).
9909
9894
  * @param params.brand - The brand name to look for in the answer.
@@ -9954,8 +9939,6 @@ var ReferenceClient16 = class {
9954
9939
  /**
9955
9940
  * Get the models chatgpt.com currently offers.
9956
9941
  *
9957
- * Costs 1 credit.
9958
- *
9959
9942
  * @param params - Optional parameters.
9960
9943
  * @param params.country - ISO-3166 alpha-2 egress country (default: "US").
9961
9944
  * @returns The available models.
@@ -10290,6 +10273,6 @@ var ScrapeBadger = class {
10290
10273
  }
10291
10274
  };
10292
10275
 
10293
- export { AccountRestrictedError, AmazonClient, ListingsClient as AmazonListingsClient, ProductsClient2 as AmazonProductsClient, ReferenceClient2 as AmazonReferenceClient, SearchClient5 as AmazonSearchClient, SellersClient as AmazonSellersClient, ApartmentsClient, AuthenticationError, BaiduClient, BingClient, MediaClient3 as BingMediaClient, NewsClient2 as BingNewsClient, ReferenceClient8 as BingReferenceClient, SearchClient11 as BingSearchClient, AskClient as ChatGPTAskClient, BrandClient as ChatGPTBrandClient, ChatGPTClient, ReferenceClient16 as ChatGPTReferenceClient, CommunitiesClient, ConflictError, DepopClient, DuckDuckGoClient, MediaClient2 as DuckDuckGoMediaClient, ReferenceClient7 as DuckDuckGoReferenceClient, SearchClient10 as DuckDuckGoSearchClient, CategoriesClient as EbayCategoriesClient, EbayClient, ItemsClient2 as EbayItemsClient, ReferenceClient5 as EbayReferenceClient, SearchClient8 as EbaySearchClient, SellersClient2 as EbaySellersClient, AskClient2 as GeminiAskClient, BrandClient2 as GeminiBrandClient, GeminiClient, GeoClient, AdsClient as GoogleAdsClient, AiModeClient as GoogleAiModeClient, AutocompleteClient as GoogleAutocompleteClient, GoogleClient, FinanceClient as GoogleFinanceClient, FlightsClient as GoogleFlightsClient, HotelsClient as GoogleHotelsClient, ImagesClient as GoogleImagesClient, JobsClient as GoogleJobsClient, LensClient as GoogleLensClient, MapsClient as GoogleMapsClient, NewsClient as GoogleNewsClient, PatentsClient as GooglePatentsClient, ProductsClient as GoogleProductsClient, ScholarClient as GoogleScholarClient, SearchClient2 as GoogleSearchClient, ShoppingClient as GoogleShoppingClient, ShortsClient as GoogleShortsClient, TrendsClient2 as GoogleTrendsClient, VideosClient as GoogleVideosClient, GumtreeClient, IPNotAllowedError, ImmobiliareClient, AudioClient as InstagramAudioClient, InstagramClient, HashtagsClient as InstagramHashtagsClient, LocationsClient as InstagramLocationsClient, MediaClient as InstagramMediaClient, SearchClient4 as InstagramSearchClient, UsersClient4 as InstagramUsersClient, InsufficientCreditsError, AdsClient3 as LeboncoinAdsClient, LeboncoinClient, ReferenceClient13 as LeboncoinReferenceClient, SearchClient17 as LeboncoinSearchClient, SellersClient4 as LeboncoinSellersClient, LinkedInClient, ListsClient, BrokersClient as LoopNetBrokersClient, LoopNetClient, ListingsClient2 as LoopNetListingsClient, ReferenceClient15 as LoopNetReferenceClient, SearchClient19 as LoopNetSearchClient, NaverClient, ContentClient as NaverContentClient, PlacesClient as NaverPlacesClient, ProductsClient5 as NaverProductsClient, ReviewsClient2 as NaverReviewsClient, SearchClient12 as NaverSearchClient, ShoppingClient2 as NaverShoppingClient, ShoppingLiveClient as NaverShoppingLiveClient, StoresClient2 as NaverStoresClient, NotFoundError, PermissionDeniedError, RateLimitError, RealtorClient, PropertiesClient as RealtorPropertiesClient, ReferenceClient12 as RealtorReferenceClient, SearchClient16 as RealtorSearchClient, RedditClient, PostsClient as RedditPostsClient, SearchClient3 as RedditSearchClient, SubredditsClient as RedditSubredditsClient, UsersClient3 as RedditUsersClient, RedfinClient, ScrapeBadger, ScrapeBadgerError, ServerError, ShopeeClient, ProductsClient3 as ShopeeProductsClient, ReferenceClient3 as ShopeeReferenceClient, ReviewsClient as ShopeeReviewsClient, SearchClient6 as ShopeeSearchClient, SpacesClient, StreamClient, AdsClient2 as TikTokAdsClient, TikTokClient, HashtagsClient2 as TikTokHashtagsClient, MusicClient as TikTokMusicClient, ReferenceClient4 as TikTokReferenceClient, SearchClient7 as TikTokSearchClient, TrendingClient as TikTokTrendingClient, UsersClient5 as TikTokUsersClient, VideosClient2 as TikTokVideosClient, TimeoutError, TrendsClient, TweetsClient, TwitterClient, UsersClient, ValidationError, VintedClient, ItemsClient as VintedItemsClient, ReferenceClient as VintedReferenceClient, SearchClient as VintedSearchClient, UsersClient2 as VintedUsersClient, WallapopClient, WalmartClient, ProductsClient4 as WalmartProductsClient, ReferenceClient6 as WalmartReferenceClient, SearchClient9 as WalmartSearchClient, SellersClient3 as WalmartSellersClient, StoresClient as WalmartStoresClient, WebClient, WebSocketStreamError, YahooClient, MediaClient4 as YahooMediaClient, NewsClient3 as YahooNewsClient, ReferenceClient9 as YahooReferenceClient, SearchClient13 as YahooSearchClient, YandexClient, ImagesClient2 as YandexImagesClient, ReferenceClient10 as YandexReferenceClient, SearchClient14 as YandexSearchClient, ChannelsClient as YoutubeChannelsClient, YoutubeClient, CommunityClient as YoutubeCommunityClient, MusicClient2 as YoutubeMusicClient, PlaylistsClient as YoutubePlaylistsClient, ReferenceClient11 as YoutubeReferenceClient, SearchClient15 as YoutubeSearchClient, ShortsClient2 as YoutubeShortsClient, TrendingClient2 as YoutubeTrendingClient, VideosClient3 as YoutubeVideosClient, AgentClient as ZillowAgentClient, ZillowClient, PropertiesClient2 as ZillowPropertiesClient, ReferenceClient14 as ZillowReferenceClient, SearchClient18 as ZillowSearchClient, collectAll, verifyWebhookSignature };
10276
+ export { AccountRestrictedError, AmazonClient, ListingsClient as AmazonListingsClient, ProductsClient2 as AmazonProductsClient, ReferenceClient2 as AmazonReferenceClient, SearchClient5 as AmazonSearchClient, SellersClient as AmazonSellersClient, ApartmentsClient, AuthenticationError, BaiduClient, BingClient, MediaClient3 as BingMediaClient, NewsClient2 as BingNewsClient, ReferenceClient8 as BingReferenceClient, SearchClient11 as BingSearchClient, BlockedError, AskClient as ChatGPTAskClient, BrandClient as ChatGPTBrandClient, ChatGPTClient, ReferenceClient16 as ChatGPTReferenceClient, CommunitiesClient, ConflictError, DepopClient, DuckDuckGoClient, MediaClient2 as DuckDuckGoMediaClient, ReferenceClient7 as DuckDuckGoReferenceClient, SearchClient10 as DuckDuckGoSearchClient, CategoriesClient as EbayCategoriesClient, EbayClient, ItemsClient2 as EbayItemsClient, ReferenceClient5 as EbayReferenceClient, SearchClient8 as EbaySearchClient, SellersClient2 as EbaySellersClient, AskClient2 as GeminiAskClient, BrandClient2 as GeminiBrandClient, GeminiClient, GeoClient, AdsClient as GoogleAdsClient, AiModeClient as GoogleAiModeClient, AutocompleteClient as GoogleAutocompleteClient, GoogleClient, FinanceClient as GoogleFinanceClient, FlightsClient as GoogleFlightsClient, HotelsClient as GoogleHotelsClient, ImagesClient as GoogleImagesClient, JobsClient as GoogleJobsClient, LensClient as GoogleLensClient, MapsClient as GoogleMapsClient, NewsClient as GoogleNewsClient, PatentsClient as GooglePatentsClient, ProductsClient as GoogleProductsClient, ScholarClient as GoogleScholarClient, SearchClient2 as GoogleSearchClient, ShoppingClient as GoogleShoppingClient, ShortsClient as GoogleShortsClient, TrendsClient2 as GoogleTrendsClient, VideosClient as GoogleVideosClient, GumtreeClient, IPNotAllowedError, ImmobiliareClient, AudioClient as InstagramAudioClient, InstagramClient, HashtagsClient as InstagramHashtagsClient, LocationsClient as InstagramLocationsClient, MediaClient as InstagramMediaClient, SearchClient4 as InstagramSearchClient, UsersClient4 as InstagramUsersClient, InsufficientCreditsError, AdsClient3 as LeboncoinAdsClient, LeboncoinClient, ReferenceClient13 as LeboncoinReferenceClient, SearchClient17 as LeboncoinSearchClient, SellersClient4 as LeboncoinSellersClient, LinkedInClient, ListsClient, BrokersClient as LoopNetBrokersClient, LoopNetClient, ListingsClient2 as LoopNetListingsClient, ReferenceClient15 as LoopNetReferenceClient, SearchClient19 as LoopNetSearchClient, NaverClient, ContentClient as NaverContentClient, PlacesClient as NaverPlacesClient, ProductsClient5 as NaverProductsClient, ReviewsClient2 as NaverReviewsClient, SearchClient12 as NaverSearchClient, ShoppingClient2 as NaverShoppingClient, ShoppingLiveClient as NaverShoppingLiveClient, StoresClient2 as NaverStoresClient, NotFoundError, PermissionDeniedError, RateLimitError, RealtorClient, PropertiesClient as RealtorPropertiesClient, ReferenceClient12 as RealtorReferenceClient, SearchClient16 as RealtorSearchClient, RedditClient, PostsClient as RedditPostsClient, SearchClient3 as RedditSearchClient, SubredditsClient as RedditSubredditsClient, UsersClient3 as RedditUsersClient, RedfinClient, ScrapeBadger, ScrapeBadgerError, ServerError, ShopeeClient, ProductsClient3 as ShopeeProductsClient, ReferenceClient3 as ShopeeReferenceClient, ReviewsClient as ShopeeReviewsClient, SearchClient6 as ShopeeSearchClient, SpacesClient, StreamClient, AdsClient2 as TikTokAdsClient, TikTokClient, HashtagsClient2 as TikTokHashtagsClient, MusicClient as TikTokMusicClient, ReferenceClient4 as TikTokReferenceClient, SearchClient7 as TikTokSearchClient, TrendingClient as TikTokTrendingClient, UsersClient5 as TikTokUsersClient, VideosClient2 as TikTokVideosClient, TimeoutError, TrendsClient, TweetsClient, TwitterClient, UsersClient, ValidationError, VintedClient, ItemsClient as VintedItemsClient, ReferenceClient as VintedReferenceClient, SearchClient as VintedSearchClient, UsersClient2 as VintedUsersClient, WallapopClient, WalmartClient, ProductsClient4 as WalmartProductsClient, ReferenceClient6 as WalmartReferenceClient, SearchClient9 as WalmartSearchClient, SellersClient3 as WalmartSellersClient, StoresClient as WalmartStoresClient, WebClient, WebSocketStreamError, YahooClient, MediaClient4 as YahooMediaClient, NewsClient3 as YahooNewsClient, ReferenceClient9 as YahooReferenceClient, SearchClient13 as YahooSearchClient, YandexClient, ImagesClient2 as YandexImagesClient, ReferenceClient10 as YandexReferenceClient, SearchClient14 as YandexSearchClient, ChannelsClient as YoutubeChannelsClient, YoutubeClient, CommunityClient as YoutubeCommunityClient, MusicClient2 as YoutubeMusicClient, PlaylistsClient as YoutubePlaylistsClient, ReferenceClient11 as YoutubeReferenceClient, SearchClient15 as YoutubeSearchClient, ShortsClient2 as YoutubeShortsClient, TrendingClient2 as YoutubeTrendingClient, VideosClient3 as YoutubeVideosClient, AgentClient as ZillowAgentClient, ZillowClient, PropertiesClient2 as ZillowPropertiesClient, ReferenceClient14 as ZillowReferenceClient, SearchClient18 as ZillowSearchClient, collectAll, verifyWebhookSignature };
10294
10277
  //# sourceMappingURL=index.mjs.map
10295
10278
  //# sourceMappingURL=index.mjs.map