scrapebadger 0.3.0 → 0.4.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/README.md +31 -5
- package/dist/{index-DQ_jDTcQ.d.cts → index-CIZUd1Zr.d.cts} +341 -1
- package/dist/{index-DQ_jDTcQ.d.ts → index-CIZUd1Zr.d.ts} +341 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +317 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +317 -20
- 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 +255 -10
- package/dist/twitter/index.js.map +1 -1
- package/dist/twitter/index.mjs +255 -11
- package/dist/twitter/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,8 @@ The official Node.js/TypeScript client library for the [ScrapeBadger](https://sc
|
|
|
19
19
|
- **Full TypeScript Support** - Complete type definitions for all API endpoints
|
|
20
20
|
- **Modern ESM & CommonJS** - Works with both module systems
|
|
21
21
|
- **Async Iterators** - Automatic pagination with `for await...of` syntax
|
|
22
|
-
- **
|
|
22
|
+
- **Smart Rate Limit Handling** - Reads API rate limit headers and automatically throttles pagination to avoid hitting limits
|
|
23
|
+
- **Resilient Retries** - 10 automatic retries with exponential backoff on server errors, with colored console warnings on each retry
|
|
23
24
|
- **Error Handling** - Typed exceptions for different error scenarios
|
|
24
25
|
- **Tree Shakeable** - Import only what you need
|
|
25
26
|
|
|
@@ -345,20 +346,45 @@ const client = new ScrapeBadger({
|
|
|
345
346
|
// Required: Your API key (or use SCRAPEBADGER_API_KEY env var)
|
|
346
347
|
apiKey: "your-api-key",
|
|
347
348
|
|
|
348
|
-
// Optional: Custom base URL (default: https://
|
|
349
|
-
baseUrl: "https://
|
|
349
|
+
// Optional: Custom base URL (default: https://scrapebadger.com)
|
|
350
|
+
baseUrl: "https://scrapebadger.com",
|
|
350
351
|
|
|
351
352
|
// Optional: Request timeout in milliseconds (default: 30000)
|
|
352
353
|
timeout: 30000,
|
|
353
354
|
|
|
354
|
-
// Optional: Maximum retry attempts (default:
|
|
355
|
-
maxRetries:
|
|
355
|
+
// Optional: Maximum retry attempts (default: 10)
|
|
356
|
+
maxRetries: 10,
|
|
356
357
|
|
|
357
358
|
// Optional: Initial retry delay in milliseconds (default: 1000)
|
|
358
359
|
retryDelay: 1000,
|
|
359
360
|
});
|
|
360
361
|
```
|
|
361
362
|
|
|
363
|
+
### Retry Behavior
|
|
364
|
+
|
|
365
|
+
The SDK automatically retries requests that fail with server errors (5xx) or rate
|
|
366
|
+
limits (429) using exponential backoff (1s, 2s, 4s, 8s, ...). Each retry prints a
|
|
367
|
+
colored warning:
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
⚠ ScrapeBadger: 503 Service Unavailable — retrying in 4s (attempt 3/10)
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Rate Limit Aware Pagination
|
|
374
|
+
|
|
375
|
+
When using `*All` pagination methods (e.g. `searchAll`, `getFollowersAll`), the SDK
|
|
376
|
+
reads `X-RateLimit-Remaining` and `X-RateLimit-Reset` headers from each response.
|
|
377
|
+
When remaining requests drop below 20% of your tier's limit, pagination automatically
|
|
378
|
+
slows down to spread requests across the remaining window — preventing 429 errors:
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
⚠ ScrapeBadger: Rate limit: 25/300 remaining (resets in 42s), throttling pagination
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
This works transparently with all tier levels (Free: 60/min, Basic: 300/min,
|
|
385
|
+
Pro: 1000/min, Enterprise: 5000/min).
|
|
386
|
+
```
|
|
387
|
+
|
|
362
388
|
## API Reference
|
|
363
389
|
|
|
364
390
|
### Client
|
|
@@ -27,6 +27,15 @@ interface ResolvedConfig {
|
|
|
27
27
|
* Base HTTP client with retry logic and error handling.
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
interface RateLimit {
|
|
31
|
+
limit: number;
|
|
32
|
+
remaining: number;
|
|
33
|
+
reset: number;
|
|
34
|
+
}
|
|
35
|
+
interface ResponseWithHeaders<T> {
|
|
36
|
+
data: T;
|
|
37
|
+
rateLimit?: RateLimit;
|
|
38
|
+
}
|
|
30
39
|
interface RequestOptions {
|
|
31
40
|
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
32
41
|
params?: Record<string, string | number | boolean | undefined>;
|
|
@@ -43,10 +52,22 @@ declare class BaseClient {
|
|
|
43
52
|
* Make an HTTP request to the API.
|
|
44
53
|
*/
|
|
45
54
|
request<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Make an HTTP request and return both data and rate limit headers.
|
|
57
|
+
*/
|
|
58
|
+
requestWithHeaders<T>(path: string, options?: RequestOptions): Promise<ResponseWithHeaders<T>>;
|
|
59
|
+
/**
|
|
60
|
+
* Internal method that builds the request and executes it, returning data and rate limit info.
|
|
61
|
+
*/
|
|
62
|
+
private requestRaw;
|
|
46
63
|
/**
|
|
47
64
|
* Execute request with exponential backoff retry logic.
|
|
48
65
|
*/
|
|
49
66
|
private executeWithRetry;
|
|
67
|
+
/**
|
|
68
|
+
* Parse rate limit headers from an HTTP response.
|
|
69
|
+
*/
|
|
70
|
+
private parseRateLimitHeaders;
|
|
50
71
|
/**
|
|
51
72
|
* Fetch with timeout support.
|
|
52
73
|
*/
|
|
@@ -64,6 +85,7 @@ declare class BaseClient {
|
|
|
64
85
|
/**
|
|
65
86
|
* Pagination utilities for the ScrapeBadger SDK.
|
|
66
87
|
*/
|
|
88
|
+
|
|
67
89
|
/**
|
|
68
90
|
* Response wrapper for paginated API responses.
|
|
69
91
|
*/
|
|
@@ -306,6 +328,10 @@ interface Tweet {
|
|
|
306
328
|
in_reply_to_status_id?: string;
|
|
307
329
|
/** ID of the user being replied to */
|
|
308
330
|
in_reply_to_user_id?: string;
|
|
331
|
+
/** Screen name of the user being replied to */
|
|
332
|
+
in_reply_to_screen_name?: string;
|
|
333
|
+
/** Character range [start, end] of the display text within the full text */
|
|
334
|
+
display_text_range?: number[];
|
|
309
335
|
/** List of attached media */
|
|
310
336
|
media: Media[];
|
|
311
337
|
/** List of URLs in the tweet */
|
|
@@ -372,6 +398,10 @@ interface User {
|
|
|
372
398
|
profile_image_url?: string;
|
|
373
399
|
/** Banner image URL */
|
|
374
400
|
profile_banner_url?: string;
|
|
401
|
+
/** Shape of the profile image (e.g. "Circle") */
|
|
402
|
+
profile_image_shape?: string;
|
|
403
|
+
/** Interstitial type shown before viewing the profile */
|
|
404
|
+
profile_interstitial_type?: string;
|
|
375
405
|
/** Number of followers */
|
|
376
406
|
followers_count?: number;
|
|
377
407
|
/** Number of accounts followed */
|
|
@@ -390,6 +420,8 @@ interface User {
|
|
|
390
420
|
verified_type?: string;
|
|
391
421
|
/** Whether the user has Twitter Blue */
|
|
392
422
|
is_blue_verified?: boolean;
|
|
423
|
+
/** Structured verification metadata returned by the API */
|
|
424
|
+
verification_info?: Record<string, unknown>;
|
|
393
425
|
/** Account creation timestamp */
|
|
394
426
|
created_at?: string;
|
|
395
427
|
/** Default profile */
|
|
@@ -428,6 +460,14 @@ interface User {
|
|
|
428
460
|
professional_type?: string;
|
|
429
461
|
/** Advertiser account type */
|
|
430
462
|
advertiser_account_type?: string;
|
|
463
|
+
/** Number of creator subscriptions (Super Follows) this user has */
|
|
464
|
+
creator_subscriptions_count?: number;
|
|
465
|
+
/** Whether the user is eligible to offer Super Follows */
|
|
466
|
+
super_follow_eligible?: boolean;
|
|
467
|
+
/** Whether the authenticated user is Super Following this user */
|
|
468
|
+
super_following?: boolean;
|
|
469
|
+
/** Whether this user is Super Following the authenticated user */
|
|
470
|
+
super_followed_by?: boolean;
|
|
431
471
|
/** IDs of pinned tweets */
|
|
432
472
|
pinned_tweet_ids?: string[];
|
|
433
473
|
/** Countries where withheld */
|
|
@@ -526,6 +566,18 @@ interface List {
|
|
|
526
566
|
user_id?: string;
|
|
527
567
|
/** Owner's username */
|
|
528
568
|
username?: string;
|
|
569
|
+
/** Profile image URLs of a selection of list members (facepile) */
|
|
570
|
+
facepile_urls?: string[];
|
|
571
|
+
/** Human-readable followers context, e.g. "2.4K followers including @user" */
|
|
572
|
+
followers_context?: string;
|
|
573
|
+
/** Human-readable members count string, e.g. "87 members" */
|
|
574
|
+
members_context?: string;
|
|
575
|
+
/** Owner's user ID (alternative field name returned by some endpoints) */
|
|
576
|
+
owner_id?: string;
|
|
577
|
+
/** Owner's username (alternative field name returned by some endpoints) */
|
|
578
|
+
owner_username?: string;
|
|
579
|
+
/** Owner's display name */
|
|
580
|
+
owner_name?: string;
|
|
529
581
|
}
|
|
530
582
|
/**
|
|
531
583
|
* Banner image for a community.
|
|
@@ -606,6 +658,10 @@ interface Community {
|
|
|
606
658
|
admin_name?: string;
|
|
607
659
|
/** List of community rules */
|
|
608
660
|
rules?: CommunityRule[];
|
|
661
|
+
/** Primary topic for the community, e.g. "Software" */
|
|
662
|
+
primary_community_topic?: string;
|
|
663
|
+
/** Custom banner image distinct from the standard banner */
|
|
664
|
+
custom_banner?: CommunityBanner;
|
|
609
665
|
}
|
|
610
666
|
/**
|
|
611
667
|
* A member of a community.
|
|
@@ -721,6 +777,104 @@ interface Place {
|
|
|
721
777
|
/** Additional place attributes */
|
|
722
778
|
attributes?: Record<string, string>;
|
|
723
779
|
}
|
|
780
|
+
/**
|
|
781
|
+
* A long-form article on Twitter.
|
|
782
|
+
*/
|
|
783
|
+
interface Article {
|
|
784
|
+
/** Article identifier */
|
|
785
|
+
id: string;
|
|
786
|
+
/** Article title */
|
|
787
|
+
title?: string;
|
|
788
|
+
/** Article text content */
|
|
789
|
+
text?: string;
|
|
790
|
+
/** Cover image URL */
|
|
791
|
+
cover_image_url?: string;
|
|
792
|
+
/** Creation timestamp */
|
|
793
|
+
created_at?: string;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* A community note (Birdwatch) on a tweet.
|
|
797
|
+
*/
|
|
798
|
+
interface CommunityNote {
|
|
799
|
+
/** Note identifier */
|
|
800
|
+
id?: string;
|
|
801
|
+
/** Note text content */
|
|
802
|
+
text?: string;
|
|
803
|
+
/** Creation timestamp */
|
|
804
|
+
created_at?: string;
|
|
805
|
+
/** Note status */
|
|
806
|
+
status?: string;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* A Twitter Space (audio room).
|
|
810
|
+
*/
|
|
811
|
+
interface Space {
|
|
812
|
+
/** Space identifier */
|
|
813
|
+
id: string;
|
|
814
|
+
/** Space title */
|
|
815
|
+
title?: string;
|
|
816
|
+
/** Current state (e.g. 'Running', 'Ended') */
|
|
817
|
+
state?: string;
|
|
818
|
+
/** Creation timestamp */
|
|
819
|
+
created_at?: string;
|
|
820
|
+
/** Start timestamp */
|
|
821
|
+
started_at?: string;
|
|
822
|
+
/** End timestamp */
|
|
823
|
+
ended_at?: string;
|
|
824
|
+
/** Scheduled start time */
|
|
825
|
+
scheduled_start?: string;
|
|
826
|
+
/** Last updated timestamp */
|
|
827
|
+
updated_at?: string;
|
|
828
|
+
/** Whether the space is locked */
|
|
829
|
+
is_locked?: boolean;
|
|
830
|
+
/** Whether replay is available */
|
|
831
|
+
is_space_available_for_replay?: boolean;
|
|
832
|
+
/** Whether clipping is available */
|
|
833
|
+
is_space_available_for_clipping?: boolean;
|
|
834
|
+
/** Total replay views */
|
|
835
|
+
total_replay_watched?: number;
|
|
836
|
+
/** Peak live listeners */
|
|
837
|
+
total_live_listeners?: number;
|
|
838
|
+
/** Media key for the space */
|
|
839
|
+
media_key?: string;
|
|
840
|
+
/** Content type (e.g. 'visual_audio') */
|
|
841
|
+
content_type?: string;
|
|
842
|
+
/** Creator's user ID */
|
|
843
|
+
creator_id?: string;
|
|
844
|
+
/** Creator's username */
|
|
845
|
+
creator_username?: string;
|
|
846
|
+
/** Creator's display name */
|
|
847
|
+
creator_name?: string;
|
|
848
|
+
/** Number of admins */
|
|
849
|
+
admin_count?: number;
|
|
850
|
+
/** Number of speakers */
|
|
851
|
+
speaker_count?: number;
|
|
852
|
+
/** Number of listeners */
|
|
853
|
+
listener_count?: number;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* A live video broadcast.
|
|
857
|
+
*/
|
|
858
|
+
interface Broadcast {
|
|
859
|
+
/** Broadcast identifier */
|
|
860
|
+
id: string;
|
|
861
|
+
/** Broadcast title */
|
|
862
|
+
title?: string;
|
|
863
|
+
/** Current state */
|
|
864
|
+
state?: string;
|
|
865
|
+
/** Media key */
|
|
866
|
+
media_key?: string;
|
|
867
|
+
/** Creation timestamp */
|
|
868
|
+
created_at?: string;
|
|
869
|
+
/** Start timestamp */
|
|
870
|
+
started_at?: string;
|
|
871
|
+
/** Video width */
|
|
872
|
+
width?: number;
|
|
873
|
+
/** Video height */
|
|
874
|
+
height?: number;
|
|
875
|
+
/** Total viewer count */
|
|
876
|
+
total_viewers?: number;
|
|
877
|
+
}
|
|
724
878
|
/**
|
|
725
879
|
* Generic API response with data and optional cursor.
|
|
726
880
|
*/
|
|
@@ -1015,6 +1169,47 @@ declare class TweetsClient {
|
|
|
1015
1169
|
* ```
|
|
1016
1170
|
*/
|
|
1017
1171
|
getUserTweetsAll(username: string, options?: IteratorOptions): AsyncGenerator<Tweet, void, undefined>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Get the edit history of a tweet.
|
|
1174
|
+
*
|
|
1175
|
+
* @param tweetId - The tweet ID to get edit history for.
|
|
1176
|
+
* @returns Paginated response containing tweet versions.
|
|
1177
|
+
*
|
|
1178
|
+
* @example
|
|
1179
|
+
* ```typescript
|
|
1180
|
+
* const history = await client.twitter.tweets.getEditHistory("1234567890");
|
|
1181
|
+
* console.log(`${history.data.length} version(s) of this tweet`);
|
|
1182
|
+
* ```
|
|
1183
|
+
*/
|
|
1184
|
+
getEditHistory(tweetId: string): Promise<PaginatedResponse<Tweet>>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Get community notes (Birdwatch) attached to a tweet.
|
|
1187
|
+
*
|
|
1188
|
+
* @param tweetId - The tweet ID to get community notes for.
|
|
1189
|
+
* @returns Paginated response containing community notes.
|
|
1190
|
+
*
|
|
1191
|
+
* @example
|
|
1192
|
+
* ```typescript
|
|
1193
|
+
* const notes = await client.twitter.tweets.getCommunityNotes("1234567890");
|
|
1194
|
+
* for (const note of notes.data) {
|
|
1195
|
+
* console.log(note.text);
|
|
1196
|
+
* }
|
|
1197
|
+
* ```
|
|
1198
|
+
*/
|
|
1199
|
+
getCommunityNotes(tweetId: string): Promise<PaginatedResponse<CommunityNote>>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Get a long-form article by its ID.
|
|
1202
|
+
*
|
|
1203
|
+
* @param articleId - The article ID to fetch.
|
|
1204
|
+
* @returns The article data.
|
|
1205
|
+
*
|
|
1206
|
+
* @example
|
|
1207
|
+
* ```typescript
|
|
1208
|
+
* const article = await client.twitter.tweets.getArticle("abc123");
|
|
1209
|
+
* console.log(`${article.title}: ${article.text?.slice(0, 100)}...`);
|
|
1210
|
+
* ```
|
|
1211
|
+
*/
|
|
1212
|
+
getArticle(articleId: string): Promise<Article>;
|
|
1018
1213
|
}
|
|
1019
1214
|
|
|
1020
1215
|
/**
|
|
@@ -1272,6 +1467,72 @@ declare class UsersClient {
|
|
|
1272
1467
|
* @yields User objects matching the search query.
|
|
1273
1468
|
*/
|
|
1274
1469
|
searchAll(query: string, options?: IteratorOptions): AsyncGenerator<User, void, undefined>;
|
|
1470
|
+
/**
|
|
1471
|
+
* Get multiple users by their numeric IDs in a single request.
|
|
1472
|
+
*
|
|
1473
|
+
* @param userIds - List of user IDs to fetch.
|
|
1474
|
+
* @returns Paginated response containing the matching users.
|
|
1475
|
+
*
|
|
1476
|
+
* @example
|
|
1477
|
+
* ```typescript
|
|
1478
|
+
* const users = await client.twitter.users.getByIds(["44196397", "783214"]);
|
|
1479
|
+
* for (const user of users.data) {
|
|
1480
|
+
* console.log(`@${user.username}`);
|
|
1481
|
+
* }
|
|
1482
|
+
* ```
|
|
1483
|
+
*/
|
|
1484
|
+
getByIds(userIds: string[]): Promise<PaginatedResponse<User>>;
|
|
1485
|
+
/**
|
|
1486
|
+
* Get multiple users by their usernames in a single request.
|
|
1487
|
+
*
|
|
1488
|
+
* @param usernames - List of usernames (without @) to fetch.
|
|
1489
|
+
* @returns Paginated response containing the matching users.
|
|
1490
|
+
*
|
|
1491
|
+
* @example
|
|
1492
|
+
* ```typescript
|
|
1493
|
+
* const users = await client.twitter.users.getByUsernames(["elonmusk", "twitter"]);
|
|
1494
|
+
* for (const user of users.data) {
|
|
1495
|
+
* console.log(`${user.name}: ${user.followers_count?.toLocaleString()} followers`);
|
|
1496
|
+
* }
|
|
1497
|
+
* ```
|
|
1498
|
+
*/
|
|
1499
|
+
getByUsernames(usernames: string[]): Promise<PaginatedResponse<User>>;
|
|
1500
|
+
/**
|
|
1501
|
+
* Get tweets that mention a user.
|
|
1502
|
+
*
|
|
1503
|
+
* @param username - The user's username (without @).
|
|
1504
|
+
* @param options - Pagination options with optional count.
|
|
1505
|
+
* @returns Paginated response containing tweets mentioning the user.
|
|
1506
|
+
*
|
|
1507
|
+
* @example
|
|
1508
|
+
* ```typescript
|
|
1509
|
+
* const mentions = await client.twitter.users.getMentions("elonmusk");
|
|
1510
|
+
* for (const tweet of mentions.data) {
|
|
1511
|
+
* console.log(`@${tweet.username}: ${tweet.text.slice(0, 100)}...`);
|
|
1512
|
+
* }
|
|
1513
|
+
* ```
|
|
1514
|
+
*/
|
|
1515
|
+
getMentions(username: string, options?: PaginationOptions & {
|
|
1516
|
+
count?: number;
|
|
1517
|
+
}): Promise<PaginatedResponse<Tweet>>;
|
|
1518
|
+
/**
|
|
1519
|
+
* Get long-form articles authored by a user.
|
|
1520
|
+
*
|
|
1521
|
+
* @param userId - The user's numeric ID.
|
|
1522
|
+
* @param options - Pagination options with optional count.
|
|
1523
|
+
* @returns Paginated response containing the user's articles as tweets.
|
|
1524
|
+
*
|
|
1525
|
+
* @example
|
|
1526
|
+
* ```typescript
|
|
1527
|
+
* const articles = await client.twitter.users.getArticles("44196397");
|
|
1528
|
+
* for (const article of articles.data) {
|
|
1529
|
+
* console.log(article.text?.slice(0, 100));
|
|
1530
|
+
* }
|
|
1531
|
+
* ```
|
|
1532
|
+
*/
|
|
1533
|
+
getArticles(userId: string, options?: PaginationOptions & {
|
|
1534
|
+
count?: number;
|
|
1535
|
+
}): Promise<PaginatedResponse<Tweet>>;
|
|
1275
1536
|
}
|
|
1276
1537
|
|
|
1277
1538
|
/**
|
|
@@ -1404,6 +1665,25 @@ declare class ListsClient {
|
|
|
1404
1665
|
getMyLists(options?: PaginationOptions & {
|
|
1405
1666
|
count?: number;
|
|
1406
1667
|
}): Promise<PaginatedResponse<List>>;
|
|
1668
|
+
/**
|
|
1669
|
+
* Search tweets within a specific list.
|
|
1670
|
+
*
|
|
1671
|
+
* @param listId - The list ID to search within.
|
|
1672
|
+
* @param query - Search query string.
|
|
1673
|
+
* @param options - Pagination options with optional count.
|
|
1674
|
+
* @returns Paginated response containing matching tweets from the list.
|
|
1675
|
+
*
|
|
1676
|
+
* @example
|
|
1677
|
+
* ```typescript
|
|
1678
|
+
* const results = await client.twitter.lists.searchTweets("123456", "python");
|
|
1679
|
+
* for (const tweet of results.data) {
|
|
1680
|
+
* console.log(`@${tweet.username}: ${tweet.text.slice(0, 100)}...`);
|
|
1681
|
+
* }
|
|
1682
|
+
* ```
|
|
1683
|
+
*/
|
|
1684
|
+
searchTweets(listId: string, query: string, options?: PaginationOptions & {
|
|
1685
|
+
count?: number;
|
|
1686
|
+
}): Promise<PaginatedResponse<Tweet>>;
|
|
1407
1687
|
}
|
|
1408
1688
|
|
|
1409
1689
|
/**
|
|
@@ -2707,6 +2987,63 @@ declare class StreamClient {
|
|
|
2707
2987
|
*/
|
|
2708
2988
|
declare function verifyWebhookSignature(secret: string, body: string | Buffer, signatureHeader: string): boolean;
|
|
2709
2989
|
|
|
2990
|
+
/**
|
|
2991
|
+
* Twitter Spaces API client.
|
|
2992
|
+
*
|
|
2993
|
+
* Provides methods for fetching Twitter Spaces and live broadcasts.
|
|
2994
|
+
*/
|
|
2995
|
+
|
|
2996
|
+
/**
|
|
2997
|
+
* Client for Twitter Spaces endpoints.
|
|
2998
|
+
*
|
|
2999
|
+
* Provides async methods for fetching Space details and live broadcast data.
|
|
3000
|
+
*
|
|
3001
|
+
* @example
|
|
3002
|
+
* ```typescript
|
|
3003
|
+
* const client = new ScrapeBadger({ apiKey: "key" });
|
|
3004
|
+
*
|
|
3005
|
+
* // Get Space details
|
|
3006
|
+
* const space = await client.twitter.spaces.getDetail("1eaKbrPPbPwKX");
|
|
3007
|
+
* console.log(`${space.title} — state: ${space.state}`);
|
|
3008
|
+
*
|
|
3009
|
+
* // Get broadcast details
|
|
3010
|
+
* const broadcast = await client.twitter.spaces.getBroadcast("broadcast123");
|
|
3011
|
+
* console.log(`${broadcast.title}: ${broadcast.total_viewers} viewers`);
|
|
3012
|
+
* ```
|
|
3013
|
+
*/
|
|
3014
|
+
declare class SpacesClient {
|
|
3015
|
+
private readonly client;
|
|
3016
|
+
constructor(client: BaseClient);
|
|
3017
|
+
/**
|
|
3018
|
+
* Get details for a specific Twitter Space.
|
|
3019
|
+
*
|
|
3020
|
+
* @param spaceId - The Space ID to fetch.
|
|
3021
|
+
* @returns The Space data.
|
|
3022
|
+
* @throws NotFoundError - If the Space doesn't exist.
|
|
3023
|
+
*
|
|
3024
|
+
* @example
|
|
3025
|
+
* ```typescript
|
|
3026
|
+
* const space = await client.twitter.spaces.getDetail("1eaKbrPPbPwKX");
|
|
3027
|
+
* console.log(`${space.title} — ${space.participant_count} participants`);
|
|
3028
|
+
* ```
|
|
3029
|
+
*/
|
|
3030
|
+
getDetail(spaceId: string): Promise<Space>;
|
|
3031
|
+
/**
|
|
3032
|
+
* Get details for a live video broadcast.
|
|
3033
|
+
*
|
|
3034
|
+
* @param broadcastId - The broadcast ID to fetch.
|
|
3035
|
+
* @returns The broadcast data.
|
|
3036
|
+
* @throws NotFoundError - If the broadcast doesn't exist.
|
|
3037
|
+
*
|
|
3038
|
+
* @example
|
|
3039
|
+
* ```typescript
|
|
3040
|
+
* const broadcast = await client.twitter.spaces.getBroadcast("broadcast123");
|
|
3041
|
+
* console.log(`${broadcast.title}: ${broadcast.total_viewers} viewers`);
|
|
3042
|
+
* ```
|
|
3043
|
+
*/
|
|
3044
|
+
getBroadcast(broadcastId: string): Promise<Broadcast>;
|
|
3045
|
+
}
|
|
3046
|
+
|
|
2710
3047
|
/**
|
|
2711
3048
|
* Twitter API client.
|
|
2712
3049
|
*
|
|
@@ -2724,6 +3061,7 @@ declare function verifyWebhookSignature(secret: string, body: string | Buffer, s
|
|
|
2724
3061
|
* - `trends` - Trending topics and locations
|
|
2725
3062
|
* - `geo` - Geographic place information
|
|
2726
3063
|
* - `stream` - Real-time stream monitor management and WebSocket streaming
|
|
3064
|
+
* - `spaces` - Twitter Spaces and live broadcast details
|
|
2727
3065
|
*
|
|
2728
3066
|
* @example
|
|
2729
3067
|
* ```typescript
|
|
@@ -2763,6 +3101,8 @@ declare class TwitterClient {
|
|
|
2763
3101
|
readonly geo: GeoClient;
|
|
2764
3102
|
/** Client for real-time stream monitor management and WebSocket streaming */
|
|
2765
3103
|
readonly stream: StreamClient;
|
|
3104
|
+
/** Client for Twitter Spaces and live broadcast operations */
|
|
3105
|
+
readonly spaces: SpacesClient;
|
|
2766
3106
|
/**
|
|
2767
3107
|
* Create a new Twitter client.
|
|
2768
3108
|
*
|
|
@@ -2771,4 +3111,4 @@ declare class TwitterClient {
|
|
|
2771
3111
|
constructor(client: BaseClient);
|
|
2772
3112
|
}
|
|
2773
3113
|
|
|
2774
|
-
export { type
|
|
3114
|
+
export { type Article as $, AuthenticationError as A, BaseClient as B, ConflictError as C, type UserIds as D, type List as E, type CommunityBanner as F, GeoClient as G, type Hashtag as H, InsufficientCreditsError as I, type CommunityRule as J, type Community as K, ListsClient as L, type Media as M, NotFoundError as N, type CommunityMember as O, type PaginatedResponse 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 Trend as X, type Location as Y, type PlaceTrends as Z, type Place as _, ScrapeBadgerError as a, type CommunityNote as a0, type Space as a1, type Broadcast as a2, type ApiResponse as a3, type ListResponse as a4, type MonitorStatus as a5, type StreamMonitor as a6, type StreamMonitorList as a7, type CreateMonitorParams as a8, type UpdateMonitorParams as a9, type StreamTweet as aa, type ConnectedEvent as ab, type PingEvent as ac, type TweetEvent as ad, type ErrorEvent as ae, type StreamEvent as af, type StreamEventType as ag, type DeliveryLog as ah, type DeliveryLogList as ai, type BillingLog as aj, type BillingLogList as ak, type ConnectOptions as al, type FilterRuleStatus as am, type FilterRuleResponse as an, type FilterRuleCreate as ao, type FilterRuleUpdate as ap, type FilterRulePricingTier as aq, type FilterRuleListResponse as ar, type FilterRuleValidateResponse as as, type FilterRuleDeliveryLog as at, type FilterRuleDeliveryLogListResponse as au, type FilterRulePricingTiersResponse as av, RateLimitError as b, ServerError as c, TimeoutError as d, AccountRestrictedError as e, type PaginationOptions as f, type IteratorOptions as g, collectAll as h, TweetsClient as i, CommunitiesClient as j, TrendsClient as k, type GeoSearchOptions as l, StreamClient as m, type StreamEmitter as n, SpacesClient as o, type TrendCategory as p, type CommunityTweetType as q, type PollOption as r, type Poll as s, type Url as t, type UserMention as u, verifyWebhookSignature as v, type TweetPlace as w, type Tweet as x, type User as y, type UserAbout as z };
|