scrapebadger 0.51.1 → 0.52.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-Dz6kHfFt.d.cts → index-BzPGfcwJ.d.cts} +15 -1
- package/dist/{index-Dz6kHfFt.d.ts → index-BzPGfcwJ.d.ts} +15 -1
- package/dist/index.d.cts +26 -6
- package/dist/index.d.ts +26 -6
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -1
- package/dist/index.mjs.map +1 -1
- package/dist/twitter/index.d.cts +1 -1
- package/dist/twitter/index.d.ts +1 -1
- package/dist/twitter/index.js.map +1 -1
- package/dist/twitter/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2084,6 +2084,20 @@ declare class ScrapeBadgerError extends Error {
|
|
|
2084
2084
|
declare class AuthenticationError extends ScrapeBadgerError {
|
|
2085
2085
|
constructor(message?: string);
|
|
2086
2086
|
}
|
|
2087
|
+
/**
|
|
2088
|
+
* Raised when the API key is not permitted to call this API (HTTP 403,
|
|
2089
|
+
* `error: "insufficient_scope"`). Keys can be restricted to specific APIs in
|
|
2090
|
+
* the dashboard; a refused call is not charged.
|
|
2091
|
+
*
|
|
2092
|
+
* Extends `AuthenticationError`, which is what a 403 threw before 0.52.0.
|
|
2093
|
+
*/
|
|
2094
|
+
declare class PermissionDeniedError extends AuthenticationError {
|
|
2095
|
+
/** The API the request needed, e.g. `"twitter"` */
|
|
2096
|
+
readonly requiredScope: string | undefined;
|
|
2097
|
+
/** The APIs this key may call */
|
|
2098
|
+
readonly allowedScopes: string[];
|
|
2099
|
+
constructor(message?: string, requiredScope?: string, allowedScopes?: string[]);
|
|
2100
|
+
}
|
|
2087
2101
|
/**
|
|
2088
2102
|
* Raised when rate limit is exceeded.
|
|
2089
2103
|
*/
|
|
@@ -3152,4 +3166,4 @@ declare class TwitterClient {
|
|
|
3152
3166
|
removeWebhookFromMonitor(webhookId: string, body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
3153
3167
|
}
|
|
3154
3168
|
|
|
3155
|
-
export { type
|
|
3169
|
+
export { type Place as $, AuthenticationError as A, BaseClient as B, ConflictError as C, type UserAbout as D, type UserIds as E, type List as F, GeoClient as G, type Hashtag as H, InsufficientCreditsError as I, type CommunityBanner as J, type CommunityRule as K, ListsClient as L, type Media as M, NotFoundError as N, type Community 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 CommunityMember as X, type Trend as Y, type Location as Z, type PlaceTrends as _, ScrapeBadgerError as a, type Article as a0, type CommunityNote as a1, type Space as a2, type Broadcast as a3, type ApiResponse as a4, type ListResponse as a5, type MonitorStatus as a6, type StreamMonitor as a7, type StreamMonitorList as a8, type CreateMonitorParams as a9, type UpdateMonitorParams as aa, type StreamTweet as ab, type ConnectedEvent as ac, type PingEvent as ad, type TweetEvent as ae, type ErrorEvent as af, type StreamEvent as ag, type StreamEventType as ah, type DeliveryLog as ai, type DeliveryLogList as aj, type BillingLog as ak, type BillingLogList as al, type ConnectOptions as am, type FilterRuleStatus as an, type FilterRuleResponse as ao, type FilterRuleCreate as ap, type FilterRuleUpdate as aq, type FilterRulePricingTier as ar, type FilterRuleListResponse as as, type FilterRuleValidateResponse as at, type FilterRuleDeliveryLog as au, type FilterRuleDeliveryLogListResponse as av, type FilterRulePricingTiersResponse as aw, RateLimitError as b, ServerError as c, TimeoutError as d, AccountRestrictedError as e, type PaginatedResponse as f, type PaginationOptions as g, type IteratorOptions as h, collectAll as i, TweetsClient as j, CommunitiesClient as k, TrendsClient as l, type GeoSearchOptions as m, StreamClient as n, type StreamEmitter as o, SpacesClient as p, type TrendCategory as q, type CommunityTweetType as r, type PollOption as s, type Poll as t, type Url as u, verifyWebhookSignature as v, type UserMention as w, type TweetPlace as x, type Tweet as y, type User as z };
|
|
@@ -2084,6 +2084,20 @@ declare class ScrapeBadgerError extends Error {
|
|
|
2084
2084
|
declare class AuthenticationError extends ScrapeBadgerError {
|
|
2085
2085
|
constructor(message?: string);
|
|
2086
2086
|
}
|
|
2087
|
+
/**
|
|
2088
|
+
* Raised when the API key is not permitted to call this API (HTTP 403,
|
|
2089
|
+
* `error: "insufficient_scope"`). Keys can be restricted to specific APIs in
|
|
2090
|
+
* the dashboard; a refused call is not charged.
|
|
2091
|
+
*
|
|
2092
|
+
* Extends `AuthenticationError`, which is what a 403 threw before 0.52.0.
|
|
2093
|
+
*/
|
|
2094
|
+
declare class PermissionDeniedError extends AuthenticationError {
|
|
2095
|
+
/** The API the request needed, e.g. `"twitter"` */
|
|
2096
|
+
readonly requiredScope: string | undefined;
|
|
2097
|
+
/** The APIs this key may call */
|
|
2098
|
+
readonly allowedScopes: string[];
|
|
2099
|
+
constructor(message?: string, requiredScope?: string, allowedScopes?: string[]);
|
|
2100
|
+
}
|
|
2087
2101
|
/**
|
|
2088
2102
|
* Raised when rate limit is exceeded.
|
|
2089
2103
|
*/
|
|
@@ -3152,4 +3166,4 @@ declare class TwitterClient {
|
|
|
3152
3166
|
removeWebhookFromMonitor(webhookId: string, body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>>;
|
|
3153
3167
|
}
|
|
3154
3168
|
|
|
3155
|
-
export { type
|
|
3169
|
+
export { type Place as $, AuthenticationError as A, BaseClient as B, ConflictError as C, type UserAbout as D, type UserIds as E, type List as F, GeoClient as G, type Hashtag as H, InsufficientCreditsError as I, type CommunityBanner as J, type CommunityRule as K, ListsClient as L, type Media as M, NotFoundError as N, type Community 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 CommunityMember as X, type Trend as Y, type Location as Z, type PlaceTrends as _, ScrapeBadgerError as a, type Article as a0, type CommunityNote as a1, type Space as a2, type Broadcast as a3, type ApiResponse as a4, type ListResponse as a5, type MonitorStatus as a6, type StreamMonitor as a7, type StreamMonitorList as a8, type CreateMonitorParams as a9, type UpdateMonitorParams as aa, type StreamTweet as ab, type ConnectedEvent as ac, type PingEvent as ad, type TweetEvent as ae, type ErrorEvent as af, type StreamEvent as ag, type StreamEventType as ah, type DeliveryLog as ai, type DeliveryLogList as aj, type BillingLog as ak, type BillingLogList as al, type ConnectOptions as am, type FilterRuleStatus as an, type FilterRuleResponse as ao, type FilterRuleCreate as ap, type FilterRuleUpdate as aq, type FilterRulePricingTier as ar, type FilterRuleListResponse as as, type FilterRuleValidateResponse as at, type FilterRuleDeliveryLog as au, type FilterRuleDeliveryLogListResponse as av, type FilterRulePricingTiersResponse as aw, RateLimitError as b, ServerError as c, TimeoutError as d, AccountRestrictedError as e, type PaginatedResponse as f, type PaginationOptions as g, type IteratorOptions as h, collectAll as i, TweetsClient as j, CommunitiesClient as k, TrendsClient as l, type GeoSearchOptions as m, StreamClient as n, type StreamEmitter as o, SpacesClient as p, type TrendCategory as q, type CommunityTweetType as r, type PollOption as s, type Poll as t, type Url as u, verifyWebhookSignature as v, type UserMention as w, type TweetPlace as x, type Tweet as y, type User 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-
|
|
2
|
-
export { e as AccountRestrictedError,
|
|
1
|
+
import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-BzPGfcwJ.cjs';
|
|
2
|
+
export { e as AccountRestrictedError, a4 as ApiResponse, a0 as Article, A as AuthenticationError, ak as BillingLog, al as BillingLogList, a3 as Broadcast, k as CommunitiesClient, O as Community, J as CommunityBanner, X as CommunityMember, a1 as CommunityNote, K as CommunityRule, r as CommunityTweetType, C as ConflictError, am as ConnectOptions, ac as ConnectedEvent, a9 as CreateMonitorParams, ai as DeliveryLog, aj as DeliveryLogList, af as ErrorEvent, ap as FilterRuleCreate, au as FilterRuleDeliveryLog, av as FilterRuleDeliveryLogListResponse, as as FilterRuleListResponse, ar as FilterRulePricingTier, aw as FilterRulePricingTiersResponse, ao as FilterRuleResponse, an as FilterRuleStatus, aq as FilterRuleUpdate, at as FilterRuleValidateResponse, G as GeoClient, m as GeoSearchOptions, H as Hashtag, I as InsufficientCreditsError, h as IteratorOptions, F as List, a5 as ListResponse, L as ListsClient, Z as Location, M as Media, a6 as MonitorStatus, N as NotFoundError, f as PaginatedResponse, g as PaginationOptions, P as PermissionDeniedError, ad as PingEvent, $ as Place, _ as PlaceTrends, t as Poll, s as PollOption, Q as QueryType, b as RateLimitError, R as ResolvedConfig, a as ScrapeBadgerError, c as ServerError, a2 as Space, p as SpacesClient, n as StreamClient, o as StreamEmitter, ag as StreamEvent, ah as StreamEventType, a7 as StreamMonitor, a8 as StreamMonitorList, ab as StreamTweet, d as TimeoutError, Y as Trend, q as TrendCategory, l as TrendsClient, y as Tweet, ae as TweetEvent, x as TweetPlace, j as TweetsClient, aa as UpdateMonitorParams, u as Url, z as User, D as UserAbout, E as UserIds, w as UserMention, U as UsersClient, V as ValidationError, W as WebSocketStreamError, i as collectAll, v as verifyWebhookSignature } from './index-BzPGfcwJ.cjs';
|
|
3
3
|
import 'node:events';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1498,11 +1498,23 @@ interface LensSearchParams {
|
|
|
1498
1498
|
language?: string;
|
|
1499
1499
|
gl?: string;
|
|
1500
1500
|
hl?: string;
|
|
1501
|
-
/**
|
|
1501
|
+
/**
|
|
1502
|
+
* NOT YET SUPPORTED. Accepted for API compatibility and echoed in the
|
|
1503
|
+
* response's `warnings` array; it does not change the results.
|
|
1504
|
+
*/
|
|
1502
1505
|
product?: boolean;
|
|
1503
|
-
/**
|
|
1506
|
+
/**
|
|
1507
|
+
* Visual matches are the only surface this endpoint serves, so they are
|
|
1508
|
+
* always returned. `false` is echoed in `warnings`. (default: true)
|
|
1509
|
+
*/
|
|
1504
1510
|
visual_matches?: boolean;
|
|
1505
|
-
/**
|
|
1511
|
+
/**
|
|
1512
|
+
* Return just the pages hosting this image, each flagged `exact_match`,
|
|
1513
|
+
* instead of the broad visual grid — what a copyright or provenance
|
|
1514
|
+
* check needs. Google exposes this set for most images but not all (6-7
|
|
1515
|
+
* of 10 in our sampling); when it is unavailable the full grid is
|
|
1516
|
+
* returned and `warnings` says the filter was not applied.
|
|
1517
|
+
*/
|
|
1506
1518
|
exact_matches?: boolean;
|
|
1507
1519
|
}
|
|
1508
1520
|
/**
|
|
@@ -1792,12 +1804,20 @@ declare class JobsClient {
|
|
|
1792
1804
|
* parsed from. `related_searches` chips come alongside. Legacy
|
|
1793
1805
|
* `results` alias retained for backwards compat.
|
|
1794
1806
|
*
|
|
1807
|
+
* Also carries a `warnings` array naming any parameter that could not be
|
|
1808
|
+
* applied. `exact_matches: true` returns just the pages hosting the image,
|
|
1809
|
+
* flagged `exact_match`, for most images; when Google does not expose that
|
|
1810
|
+
* set the grid comes back and `warnings` says so. `product` is still not
|
|
1811
|
+
* supported and always lands in `warnings`.
|
|
1812
|
+
*
|
|
1795
1813
|
* @example
|
|
1796
1814
|
* ```typescript
|
|
1797
1815
|
* const out = await client.google.lens.search({
|
|
1798
1816
|
* url: "https://example.com/photo.jpg",
|
|
1799
|
-
*
|
|
1817
|
+
* query: "wallpaper", // text refinement — honoured
|
|
1800
1818
|
* });
|
|
1819
|
+
* // GoogleResponse is Record<string, unknown>, so narrow before use.
|
|
1820
|
+
* console.warn(out.warnings as string[] | undefined);
|
|
1801
1821
|
* for (const match of out.lens_results) {
|
|
1802
1822
|
* console.log(match.title, match.price?.value, match.price?.currency);
|
|
1803
1823
|
* }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-
|
|
2
|
-
export { e as AccountRestrictedError,
|
|
1
|
+
import { B as BaseClient, T as TwitterClient, S as ScrapeBadgerConfig } from './index-BzPGfcwJ.js';
|
|
2
|
+
export { e as AccountRestrictedError, a4 as ApiResponse, a0 as Article, A as AuthenticationError, ak as BillingLog, al as BillingLogList, a3 as Broadcast, k as CommunitiesClient, O as Community, J as CommunityBanner, X as CommunityMember, a1 as CommunityNote, K as CommunityRule, r as CommunityTweetType, C as ConflictError, am as ConnectOptions, ac as ConnectedEvent, a9 as CreateMonitorParams, ai as DeliveryLog, aj as DeliveryLogList, af as ErrorEvent, ap as FilterRuleCreate, au as FilterRuleDeliveryLog, av as FilterRuleDeliveryLogListResponse, as as FilterRuleListResponse, ar as FilterRulePricingTier, aw as FilterRulePricingTiersResponse, ao as FilterRuleResponse, an as FilterRuleStatus, aq as FilterRuleUpdate, at as FilterRuleValidateResponse, G as GeoClient, m as GeoSearchOptions, H as Hashtag, I as InsufficientCreditsError, h as IteratorOptions, F as List, a5 as ListResponse, L as ListsClient, Z as Location, M as Media, a6 as MonitorStatus, N as NotFoundError, f as PaginatedResponse, g as PaginationOptions, P as PermissionDeniedError, ad as PingEvent, $ as Place, _ as PlaceTrends, t as Poll, s as PollOption, Q as QueryType, b as RateLimitError, R as ResolvedConfig, a as ScrapeBadgerError, c as ServerError, a2 as Space, p as SpacesClient, n as StreamClient, o as StreamEmitter, ag as StreamEvent, ah as StreamEventType, a7 as StreamMonitor, a8 as StreamMonitorList, ab as StreamTweet, d as TimeoutError, Y as Trend, q as TrendCategory, l as TrendsClient, y as Tweet, ae as TweetEvent, x as TweetPlace, j as TweetsClient, aa as UpdateMonitorParams, u as Url, z as User, D as UserAbout, E as UserIds, w as UserMention, U as UsersClient, V as ValidationError, W as WebSocketStreamError, i as collectAll, v as verifyWebhookSignature } from './index-BzPGfcwJ.js';
|
|
3
3
|
import 'node:events';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1498,11 +1498,23 @@ interface LensSearchParams {
|
|
|
1498
1498
|
language?: string;
|
|
1499
1499
|
gl?: string;
|
|
1500
1500
|
hl?: string;
|
|
1501
|
-
/**
|
|
1501
|
+
/**
|
|
1502
|
+
* NOT YET SUPPORTED. Accepted for API compatibility and echoed in the
|
|
1503
|
+
* response's `warnings` array; it does not change the results.
|
|
1504
|
+
*/
|
|
1502
1505
|
product?: boolean;
|
|
1503
|
-
/**
|
|
1506
|
+
/**
|
|
1507
|
+
* Visual matches are the only surface this endpoint serves, so they are
|
|
1508
|
+
* always returned. `false` is echoed in `warnings`. (default: true)
|
|
1509
|
+
*/
|
|
1504
1510
|
visual_matches?: boolean;
|
|
1505
|
-
/**
|
|
1511
|
+
/**
|
|
1512
|
+
* Return just the pages hosting this image, each flagged `exact_match`,
|
|
1513
|
+
* instead of the broad visual grid — what a copyright or provenance
|
|
1514
|
+
* check needs. Google exposes this set for most images but not all (6-7
|
|
1515
|
+
* of 10 in our sampling); when it is unavailable the full grid is
|
|
1516
|
+
* returned and `warnings` says the filter was not applied.
|
|
1517
|
+
*/
|
|
1506
1518
|
exact_matches?: boolean;
|
|
1507
1519
|
}
|
|
1508
1520
|
/**
|
|
@@ -1792,12 +1804,20 @@ declare class JobsClient {
|
|
|
1792
1804
|
* parsed from. `related_searches` chips come alongside. Legacy
|
|
1793
1805
|
* `results` alias retained for backwards compat.
|
|
1794
1806
|
*
|
|
1807
|
+
* Also carries a `warnings` array naming any parameter that could not be
|
|
1808
|
+
* applied. `exact_matches: true` returns just the pages hosting the image,
|
|
1809
|
+
* flagged `exact_match`, for most images; when Google does not expose that
|
|
1810
|
+
* set the grid comes back and `warnings` says so. `product` is still not
|
|
1811
|
+
* supported and always lands in `warnings`.
|
|
1812
|
+
*
|
|
1795
1813
|
* @example
|
|
1796
1814
|
* ```typescript
|
|
1797
1815
|
* const out = await client.google.lens.search({
|
|
1798
1816
|
* url: "https://example.com/photo.jpg",
|
|
1799
|
-
*
|
|
1817
|
+
* query: "wallpaper", // text refinement — honoured
|
|
1800
1818
|
* });
|
|
1819
|
+
* // GoogleResponse is Record<string, unknown>, so narrow before use.
|
|
1820
|
+
* console.warn(out.warnings as string[] | undefined);
|
|
1801
1821
|
* for (const match of out.lens_results) {
|
|
1802
1822
|
* console.log(match.title, match.price?.value, match.price?.currency);
|
|
1803
1823
|
* }
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,19 @@ var AuthenticationError = class _AuthenticationError extends ScrapeBadgerError {
|
|
|
26
26
|
Object.setPrototypeOf(this, _AuthenticationError.prototype);
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
+
var PermissionDeniedError = class _PermissionDeniedError extends AuthenticationError {
|
|
30
|
+
/** The API the request needed, e.g. `"twitter"` */
|
|
31
|
+
requiredScope;
|
|
32
|
+
/** The APIs this key may call */
|
|
33
|
+
allowedScopes;
|
|
34
|
+
constructor(message = "This API key is not permitted to call this API.", requiredScope, allowedScopes = []) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = "PermissionDeniedError";
|
|
37
|
+
this.requiredScope = requiredScope;
|
|
38
|
+
this.allowedScopes = allowedScopes;
|
|
39
|
+
Object.setPrototypeOf(this, _PermissionDeniedError.prototype);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
29
42
|
var RateLimitError = class _RateLimitError extends ScrapeBadgerError {
|
|
30
43
|
/** Unix timestamp when the rate limit resets */
|
|
31
44
|
retryAfter;
|
|
@@ -341,6 +354,13 @@ var BaseClient = class _BaseClient {
|
|
|
341
354
|
case 402:
|
|
342
355
|
throw new InsufficientCreditsError(message, errorData.credits_balance);
|
|
343
356
|
case 403:
|
|
357
|
+
if (errorData.error === "insufficient_scope") {
|
|
358
|
+
throw new PermissionDeniedError(
|
|
359
|
+
message,
|
|
360
|
+
errorData.required_scope,
|
|
361
|
+
errorData.allowed_scopes ?? []
|
|
362
|
+
);
|
|
363
|
+
}
|
|
344
364
|
if (message.toLowerCase().includes("restricted")) {
|
|
345
365
|
throw new AccountRestrictedError(message, errorData.reason);
|
|
346
366
|
}
|
|
@@ -9119,6 +9139,7 @@ exports.LoopNetListingsClient = ListingsClient2;
|
|
|
9119
9139
|
exports.LoopNetReferenceClient = ReferenceClient15;
|
|
9120
9140
|
exports.LoopNetSearchClient = SearchClient18;
|
|
9121
9141
|
exports.NotFoundError = NotFoundError;
|
|
9142
|
+
exports.PermissionDeniedError = PermissionDeniedError;
|
|
9122
9143
|
exports.RateLimitError = RateLimitError;
|
|
9123
9144
|
exports.RealtorClient = RealtorClient;
|
|
9124
9145
|
exports.RealtorPropertiesClient = PropertiesClient;
|