scrapebadger 0.3.1 → 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.
@@ -328,6 +328,10 @@ interface Tweet {
328
328
  in_reply_to_status_id?: string;
329
329
  /** ID of the user being replied to */
330
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[];
331
335
  /** List of attached media */
332
336
  media: Media[];
333
337
  /** List of URLs in the tweet */
@@ -394,6 +398,10 @@ interface User {
394
398
  profile_image_url?: string;
395
399
  /** Banner image URL */
396
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;
397
405
  /** Number of followers */
398
406
  followers_count?: number;
399
407
  /** Number of accounts followed */
@@ -412,6 +420,8 @@ interface User {
412
420
  verified_type?: string;
413
421
  /** Whether the user has Twitter Blue */
414
422
  is_blue_verified?: boolean;
423
+ /** Structured verification metadata returned by the API */
424
+ verification_info?: Record<string, unknown>;
415
425
  /** Account creation timestamp */
416
426
  created_at?: string;
417
427
  /** Default profile */
@@ -450,6 +460,14 @@ interface User {
450
460
  professional_type?: string;
451
461
  /** Advertiser account type */
452
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;
453
471
  /** IDs of pinned tweets */
454
472
  pinned_tweet_ids?: string[];
455
473
  /** Countries where withheld */
@@ -548,6 +566,18 @@ interface List {
548
566
  user_id?: string;
549
567
  /** Owner's username */
550
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;
551
581
  }
552
582
  /**
553
583
  * Banner image for a community.
@@ -628,6 +658,10 @@ interface Community {
628
658
  admin_name?: string;
629
659
  /** List of community rules */
630
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;
631
665
  }
632
666
  /**
633
667
  * A member of a community.
@@ -743,6 +777,104 @@ interface Place {
743
777
  /** Additional place attributes */
744
778
  attributes?: Record<string, string>;
745
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
+ }
746
878
  /**
747
879
  * Generic API response with data and optional cursor.
748
880
  */
@@ -1037,6 +1169,47 @@ declare class TweetsClient {
1037
1169
  * ```
1038
1170
  */
1039
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>;
1040
1213
  }
1041
1214
 
1042
1215
  /**
@@ -1294,6 +1467,72 @@ declare class UsersClient {
1294
1467
  * @yields User objects matching the search query.
1295
1468
  */
1296
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>>;
1297
1536
  }
1298
1537
 
1299
1538
  /**
@@ -1426,6 +1665,25 @@ declare class ListsClient {
1426
1665
  getMyLists(options?: PaginationOptions & {
1427
1666
  count?: number;
1428
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>>;
1429
1687
  }
1430
1688
 
1431
1689
  /**
@@ -2729,6 +2987,63 @@ declare class StreamClient {
2729
2987
  */
2730
2988
  declare function verifyWebhookSignature(secret: string, body: string | Buffer, signatureHeader: string): boolean;
2731
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
+
2732
3047
  /**
2733
3048
  * Twitter API client.
2734
3049
  *
@@ -2746,6 +3061,7 @@ declare function verifyWebhookSignature(secret: string, body: string | Buffer, s
2746
3061
  * - `trends` - Trending topics and locations
2747
3062
  * - `geo` - Geographic place information
2748
3063
  * - `stream` - Real-time stream monitor management and WebSocket streaming
3064
+ * - `spaces` - Twitter Spaces and live broadcast details
2749
3065
  *
2750
3066
  * @example
2751
3067
  * ```typescript
@@ -2785,6 +3101,8 @@ declare class TwitterClient {
2785
3101
  readonly geo: GeoClient;
2786
3102
  /** Client for real-time stream monitor management and WebSocket streaming */
2787
3103
  readonly stream: StreamClient;
3104
+ /** Client for Twitter Spaces and live broadcast operations */
3105
+ readonly spaces: SpacesClient;
2788
3106
  /**
2789
3107
  * Create a new Twitter client.
2790
3108
  *
@@ -2793,4 +3111,4 @@ declare class TwitterClient {
2793
3111
  constructor(client: BaseClient);
2794
3112
  }
2795
3113
 
2796
- export { type ListResponse as $, AuthenticationError as A, BaseClient as B, ConflictError as C, type List as D, type CommunityBanner as E, type CommunityRule as F, GeoClient as G, type Hashtag as H, InsufficientCreditsError as I, type Community as J, type CommunityMember as K, ListsClient as L, type Media as M, NotFoundError as N, type Trend 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 Location as X, type PlaceTrends as Y, type Place as Z, type ApiResponse as _, ScrapeBadgerError as a, type MonitorStatus as a0, type StreamMonitor as a1, type StreamMonitorList as a2, type CreateMonitorParams as a3, type UpdateMonitorParams as a4, type StreamTweet as a5, type ConnectedEvent as a6, type PingEvent as a7, type TweetEvent as a8, type ErrorEvent as a9, type StreamEvent as aa, type StreamEventType as ab, type DeliveryLog as ac, type DeliveryLogList as ad, type BillingLog as ae, type BillingLogList as af, type ConnectOptions as ag, type FilterRuleStatus as ah, type FilterRuleResponse as ai, type FilterRuleCreate as aj, type FilterRuleUpdate as ak, type FilterRulePricingTier as al, type FilterRuleListResponse as am, type FilterRuleValidateResponse as an, type FilterRuleDeliveryLog as ao, type FilterRuleDeliveryLogListResponse as ap, type FilterRulePricingTiersResponse as aq, 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, type TrendCategory as o, type CommunityTweetType as p, type PollOption as q, type Poll as r, type Url as s, type UserMention as t, type TweetPlace as u, verifyWebhookSignature as v, type Tweet as w, type User as x, type UserAbout as y, type UserIds as z };
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 };