scrapebadger 0.60.1 → 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.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.0";
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, {
@@ -10290,6 +10317,6 @@ var ScrapeBadger = class {
10290
10317
  }
10291
10318
  };
10292
10319
 
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 };
10320
+ 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
10321
  //# sourceMappingURL=index.mjs.map
10295
10322
  //# sourceMappingURL=index.mjs.map