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.
@@ -2141,6 +2141,51 @@ declare class ValidationError extends ScrapeBadgerError {
2141
2141
  readonly errors: Record<string, string[]> | undefined;
2142
2142
  constructor(message?: string, errors?: Record<string, string[]>);
2143
2143
  }
2144
+ /** Why the Web Scraping API reported a target as blocked (SCR-306). */
2145
+ type BlockKind = "antibot" | "captcha" | "rate_limit" | "ip_ban" | "geo_block" | "auth_wall" | "empty" | "other";
2146
+ /** The CAPTCHA gating a blocked page. */
2147
+ interface BlockingCaptcha {
2148
+ system: string;
2149
+ confidence: number;
2150
+ details?: string | null;
2151
+ version?: string | null;
2152
+ gate?: boolean;
2153
+ solvable?: boolean;
2154
+ params?: Record<string, unknown>;
2155
+ }
2156
+ /**
2157
+ * Raised when a web scrape hit an anti-bot wall on every attempt (HTTP 422,
2158
+ * `error: "blocking_page_detected"`). Extends `ValidationError`, which is
2159
+ * what this threw before 0.61.0, so existing handlers still match. Blocked
2160
+ * requests are not charged.
2161
+ *
2162
+ * @example
2163
+ * ```ts
2164
+ * try {
2165
+ * await client.web.scrape({ url: "https://example.com" });
2166
+ * } catch (err) {
2167
+ * if (err instanceof BlockedError) {
2168
+ * console.log(err.blockKind, err.vendor, err.captcha?.params);
2169
+ * }
2170
+ * }
2171
+ * ```
2172
+ */
2173
+ declare class BlockedError extends ValidationError {
2174
+ /** The wall's class; undefined on older responses */
2175
+ readonly blockKind: BlockKind | undefined;
2176
+ /** The protection vendor that served it, e.g. "cloudflare", "datadome", "aws_waf" */
2177
+ readonly vendor: string | undefined;
2178
+ /** The CAPTCHA gating the page when blockKind is "captcha" */
2179
+ readonly captcha: BlockingCaptcha | undefined;
2180
+ /** The scrape result the API returned with the block */
2181
+ readonly data: Record<string, unknown> | undefined;
2182
+ constructor(message?: string, details?: {
2183
+ blockKind?: BlockKind | null;
2184
+ vendor?: string | null;
2185
+ captcha?: BlockingCaptcha | null;
2186
+ data?: Record<string, unknown> | null;
2187
+ });
2188
+ }
2144
2189
  /**
2145
2190
  * Raised when an internal server error occurs.
2146
2191
  */
@@ -3175,4 +3220,4 @@ declare class TwitterClient {
3175
3220
  removeWebhookFromMonitor(webhookId: string, body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
3176
3221
  }
3177
3222
 
3178
- export { type PlaceTrends as $, AuthenticationError as A, BaseClient as B, ConflictError as C, type User as D, type UserAbout as E, type UserIds as F, GeoClient as G, type Hashtag as H, InsufficientCreditsError as I, type List as J, type CommunityBanner as K, ListsClient as L, type Media as M, NotFoundError as N, type CommunityRule as O, PermissionDeniedError as P, type QueryType as Q, type ResolvedConfig as R, type ScrapeBadgerConfig as S, TwitterClient as T, UsersClient as U, ValidationError as V, WebSocketStreamError as W, type Community as X, type CommunityMember as Y, type Trend as Z, type Location as _, ScrapeBadgerError as a, type Place as a0, type Article as a1, type CommunityNote as a2, type Space as a3, type Broadcast as a4, type ApiResponse as a5, type ListResponse as a6, type MonitorStatus as a7, type StreamMonitor as a8, type StreamMonitorList as a9, type CreateMonitorParams as aa, type UpdateMonitorParams as ab, type StreamTweet as ac, type ConnectedEvent as ad, type PingEvent as ae, type TweetEvent as af, type ErrorEvent as ag, type StreamEvent as ah, type StreamEventType as ai, type DeliveryLog as aj, type DeliveryLogList as ak, type BillingLog as al, type BillingLogList as am, type ConnectOptions as an, type FilterRuleStatus as ao, type FilterRuleResponse as ap, type FilterRuleCreate as aq, type FilterRuleUpdate as ar, type FilterRulePricingTier as as, type FilterRuleListResponse as at, type FilterRuleValidateResponse as au, type FilterRuleDeliveryLog as av, type FilterRuleDeliveryLogListResponse as aw, type FilterRulePricingTiersResponse as ax, RateLimitError as b, ServerError as c, TimeoutError as d, AccountRestrictedError as e, IPNotAllowedError as f, type PaginatedResponse as g, type PaginationOptions as h, type IteratorOptions as i, collectAll as j, TweetsClient as k, CommunitiesClient as l, TrendsClient as m, type GeoSearchOptions as n, StreamClient as o, type StreamEmitter as p, SpacesClient as q, type TrendCategory as r, type CommunityTweetType as s, type PollOption as t, type Poll as u, verifyWebhookSignature as v, type Url as w, type UserMention as x, type TweetPlace as y, type Tweet as z };
3223
+ export { type CommunityMember as $, AuthenticationError as A, BaseClient as B, ConflictError as C, type UserMention as D, type TweetPlace as E, type Tweet as F, GeoClient as G, type Hashtag as H, InsufficientCreditsError as I, type User as J, type UserAbout as K, ListsClient as L, type Media as M, NotFoundError as N, type UserIds as O, PermissionDeniedError as P, type QueryType as Q, type ResolvedConfig as R, type ScrapeBadgerConfig as S, TwitterClient as T, UsersClient as U, ValidationError as V, WebSocketStreamError as W, type List as X, type CommunityBanner as Y, type CommunityRule as Z, type Community as _, ScrapeBadgerError as a, type Trend as a0, type Location as a1, type PlaceTrends as a2, type Place as a3, type Article as a4, type CommunityNote as a5, type Space as a6, type Broadcast as a7, type ApiResponse as a8, type ListResponse as a9, type FilterRulePricingTiersResponse as aA, type MonitorStatus as aa, type StreamMonitor as ab, type StreamMonitorList as ac, type CreateMonitorParams as ad, type UpdateMonitorParams as ae, type StreamTweet as af, type ConnectedEvent as ag, type PingEvent as ah, type TweetEvent as ai, type ErrorEvent as aj, type StreamEvent as ak, type StreamEventType as al, type DeliveryLog as am, type DeliveryLogList as an, type BillingLog as ao, type BillingLogList as ap, type ConnectOptions as aq, type FilterRuleStatus as ar, type FilterRuleResponse as as, type FilterRuleCreate as at, type FilterRuleUpdate as au, type FilterRulePricingTier as av, type FilterRuleListResponse as aw, type FilterRuleValidateResponse as ax, type FilterRuleDeliveryLog as ay, type FilterRuleDeliveryLogListResponse as az, RateLimitError as b, BlockedError as c, ServerError as d, TimeoutError as e, AccountRestrictedError as f, IPNotAllowedError as g, type BlockKind as h, type BlockingCaptcha as i, type PaginatedResponse as j, type PaginationOptions as k, type IteratorOptions as l, collectAll as m, TweetsClient as n, CommunitiesClient as o, TrendsClient as p, type GeoSearchOptions as q, StreamClient as r, type StreamEmitter as s, SpacesClient as t, type TrendCategory as u, verifyWebhookSignature as v, type CommunityTweetType as w, type PollOption as x, type Poll as y, type Url as z };
@@ -2141,6 +2141,51 @@ declare class ValidationError extends ScrapeBadgerError {
2141
2141
  readonly errors: Record<string, string[]> | undefined;
2142
2142
  constructor(message?: string, errors?: Record<string, string[]>);
2143
2143
  }
2144
+ /** Why the Web Scraping API reported a target as blocked (SCR-306). */
2145
+ type BlockKind = "antibot" | "captcha" | "rate_limit" | "ip_ban" | "geo_block" | "auth_wall" | "empty" | "other";
2146
+ /** The CAPTCHA gating a blocked page. */
2147
+ interface BlockingCaptcha {
2148
+ system: string;
2149
+ confidence: number;
2150
+ details?: string | null;
2151
+ version?: string | null;
2152
+ gate?: boolean;
2153
+ solvable?: boolean;
2154
+ params?: Record<string, unknown>;
2155
+ }
2156
+ /**
2157
+ * Raised when a web scrape hit an anti-bot wall on every attempt (HTTP 422,
2158
+ * `error: "blocking_page_detected"`). Extends `ValidationError`, which is
2159
+ * what this threw before 0.61.0, so existing handlers still match. Blocked
2160
+ * requests are not charged.
2161
+ *
2162
+ * @example
2163
+ * ```ts
2164
+ * try {
2165
+ * await client.web.scrape({ url: "https://example.com" });
2166
+ * } catch (err) {
2167
+ * if (err instanceof BlockedError) {
2168
+ * console.log(err.blockKind, err.vendor, err.captcha?.params);
2169
+ * }
2170
+ * }
2171
+ * ```
2172
+ */
2173
+ declare class BlockedError extends ValidationError {
2174
+ /** The wall's class; undefined on older responses */
2175
+ readonly blockKind: BlockKind | undefined;
2176
+ /** The protection vendor that served it, e.g. "cloudflare", "datadome", "aws_waf" */
2177
+ readonly vendor: string | undefined;
2178
+ /** The CAPTCHA gating the page when blockKind is "captcha" */
2179
+ readonly captcha: BlockingCaptcha | undefined;
2180
+ /** The scrape result the API returned with the block */
2181
+ readonly data: Record<string, unknown> | undefined;
2182
+ constructor(message?: string, details?: {
2183
+ blockKind?: BlockKind | null;
2184
+ vendor?: string | null;
2185
+ captcha?: BlockingCaptcha | null;
2186
+ data?: Record<string, unknown> | null;
2187
+ });
2188
+ }
2144
2189
  /**
2145
2190
  * Raised when an internal server error occurs.
2146
2191
  */
@@ -3175,4 +3220,4 @@ declare class TwitterClient {
3175
3220
  removeWebhookFromMonitor(webhookId: string, body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
3176
3221
  }
3177
3222
 
3178
- export { type PlaceTrends as $, AuthenticationError as A, BaseClient as B, ConflictError as C, type User as D, type UserAbout as E, type UserIds as F, GeoClient as G, type Hashtag as H, InsufficientCreditsError as I, type List as J, type CommunityBanner as K, ListsClient as L, type Media as M, NotFoundError as N, type CommunityRule as O, PermissionDeniedError as P, type QueryType as Q, type ResolvedConfig as R, type ScrapeBadgerConfig as S, TwitterClient as T, UsersClient as U, ValidationError as V, WebSocketStreamError as W, type Community as X, type CommunityMember as Y, type Trend as Z, type Location as _, ScrapeBadgerError as a, type Place as a0, type Article as a1, type CommunityNote as a2, type Space as a3, type Broadcast as a4, type ApiResponse as a5, type ListResponse as a6, type MonitorStatus as a7, type StreamMonitor as a8, type StreamMonitorList as a9, type CreateMonitorParams as aa, type UpdateMonitorParams as ab, type StreamTweet as ac, type ConnectedEvent as ad, type PingEvent as ae, type TweetEvent as af, type ErrorEvent as ag, type StreamEvent as ah, type StreamEventType as ai, type DeliveryLog as aj, type DeliveryLogList as ak, type BillingLog as al, type BillingLogList as am, type ConnectOptions as an, type FilterRuleStatus as ao, type FilterRuleResponse as ap, type FilterRuleCreate as aq, type FilterRuleUpdate as ar, type FilterRulePricingTier as as, type FilterRuleListResponse as at, type FilterRuleValidateResponse as au, type FilterRuleDeliveryLog as av, type FilterRuleDeliveryLogListResponse as aw, type FilterRulePricingTiersResponse as ax, RateLimitError as b, ServerError as c, TimeoutError as d, AccountRestrictedError as e, IPNotAllowedError as f, type PaginatedResponse as g, type PaginationOptions as h, type IteratorOptions as i, collectAll as j, TweetsClient as k, CommunitiesClient as l, TrendsClient as m, type GeoSearchOptions as n, StreamClient as o, type StreamEmitter as p, SpacesClient as q, type TrendCategory as r, type CommunityTweetType as s, type PollOption as t, type Poll as u, verifyWebhookSignature as v, type Url as w, type UserMention as x, type TweetPlace as y, type Tweet as z };
3223
+ export { type CommunityMember as $, AuthenticationError as A, BaseClient as B, ConflictError as C, type UserMention as D, type TweetPlace as E, type Tweet as F, GeoClient as G, type Hashtag as H, InsufficientCreditsError as I, type User as J, type UserAbout as K, ListsClient as L, type Media as M, NotFoundError as N, type UserIds as O, PermissionDeniedError as P, type QueryType as Q, type ResolvedConfig as R, type ScrapeBadgerConfig as S, TwitterClient as T, UsersClient as U, ValidationError as V, WebSocketStreamError as W, type List as X, type CommunityBanner as Y, type CommunityRule as Z, type Community as _, ScrapeBadgerError as a, type Trend as a0, type Location as a1, type PlaceTrends as a2, type Place as a3, type Article as a4, type CommunityNote as a5, type Space as a6, type Broadcast as a7, type ApiResponse as a8, type ListResponse as a9, type FilterRulePricingTiersResponse as aA, type MonitorStatus as aa, type StreamMonitor as ab, type StreamMonitorList as ac, type CreateMonitorParams as ad, type UpdateMonitorParams as ae, type StreamTweet as af, type ConnectedEvent as ag, type PingEvent as ah, type TweetEvent as ai, type ErrorEvent as aj, type StreamEvent as ak, type StreamEventType as al, type DeliveryLog as am, type DeliveryLogList as an, type BillingLog as ao, type BillingLogList as ap, type ConnectOptions as aq, type FilterRuleStatus as ar, type FilterRuleResponse as as, type FilterRuleCreate as at, type FilterRuleUpdate as au, type FilterRulePricingTier as av, type FilterRuleListResponse as aw, type FilterRuleValidateResponse as ax, type FilterRuleDeliveryLog as ay, type FilterRuleDeliveryLogListResponse as az, RateLimitError as b, BlockedError as c, ServerError as d, TimeoutError as e, AccountRestrictedError as f, IPNotAllowedError as g, type BlockKind as h, type BlockingCaptcha as i, type PaginatedResponse as j, type PaginationOptions as k, type IteratorOptions as l, collectAll as m, TweetsClient as n, CommunitiesClient as o, TrendsClient as p, type GeoSearchOptions as q, StreamClient as r, type StreamEmitter as s, SpacesClient as t, type TrendCategory as u, verifyWebhookSignature as v, type CommunityTweetType as w, type PollOption as x, type Poll as y, type Url as z };
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-DBk60c2e.cjs';
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.cjs';
1
+ import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-MBQ1Ksjt.cjs';
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.cjs';
3
3
  import 'node:events';
4
4
 
5
5
  /**
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
  /**
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.1";
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, {
@@ -10311,6 +10338,7 @@ exports.BingMediaClient = MediaClient3;
10311
10338
  exports.BingNewsClient = NewsClient2;
10312
10339
  exports.BingReferenceClient = ReferenceClient8;
10313
10340
  exports.BingSearchClient = SearchClient11;
10341
+ exports.BlockedError = BlockedError;
10314
10342
  exports.ChatGPTAskClient = AskClient;
10315
10343
  exports.ChatGPTBrandClient = BrandClient;
10316
10344
  exports.ChatGPTClient = ChatGPTClient;