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.
- package/dist/{index-Cg0sNluO.d.cts → index-CIZUd1Zr.d.cts} +319 -1
- package/dist/{index-Cg0sNluO.d.ts → index-CIZUd1Zr.d.ts} +319 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +206 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +206 -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 +206 -0
- package/dist/twitter/index.js.map +1 -1
- package/dist/twitter/index.mjs +206 -1
- package/dist/twitter/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/twitter/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a3 as ApiResponse, $ as Article, aj as BillingLog, ak as BillingLogList, a2 as Broadcast, j as CommunitiesClient, K as Community, F as CommunityBanner, O as CommunityMember, a0 as CommunityNote, J as CommunityRule, q as CommunityTweetType, al as ConnectOptions, ab as ConnectedEvent, a8 as CreateMonitorParams, ah as DeliveryLog, ai as DeliveryLogList, ae as ErrorEvent, ao as FilterRuleCreate, at as FilterRuleDeliveryLog, au as FilterRuleDeliveryLogListResponse, ar as FilterRuleListResponse, aq as FilterRulePricingTier, av as FilterRulePricingTiersResponse, an as FilterRuleResponse, am as FilterRuleStatus, ap as FilterRuleUpdate, as as FilterRuleValidateResponse, G as GeoClient, l as GeoSearchOptions, H as Hashtag, E as List, a4 as ListResponse, L as ListsClient, Y as Location, M as Media, a5 as MonitorStatus, ac as PingEvent, _ as Place, Z as PlaceTrends, s as Poll, r as PollOption, Q as QueryType, a1 as Space, o as SpacesClient, m as StreamClient, n as StreamEmitter, af as StreamEvent, ag as StreamEventType, a6 as StreamMonitor, a7 as StreamMonitorList, aa as StreamTweet, X as Trend, p as TrendCategory, k as TrendsClient, x as Tweet, ad as TweetEvent, w as TweetPlace, i as TweetsClient, T as TwitterClient, a9 as UpdateMonitorParams, t as Url, y as User, z as UserAbout, D as UserIds, u as UserMention, U as UsersClient, v as verifyWebhookSignature } from '../index-CIZUd1Zr.cjs';
|
|
2
2
|
import 'node:events';
|
package/dist/twitter/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { a3 as ApiResponse, $ as Article, aj as BillingLog, ak as BillingLogList, a2 as Broadcast, j as CommunitiesClient, K as Community, F as CommunityBanner, O as CommunityMember, a0 as CommunityNote, J as CommunityRule, q as CommunityTweetType, al as ConnectOptions, ab as ConnectedEvent, a8 as CreateMonitorParams, ah as DeliveryLog, ai as DeliveryLogList, ae as ErrorEvent, ao as FilterRuleCreate, at as FilterRuleDeliveryLog, au as FilterRuleDeliveryLogListResponse, ar as FilterRuleListResponse, aq as FilterRulePricingTier, av as FilterRulePricingTiersResponse, an as FilterRuleResponse, am as FilterRuleStatus, ap as FilterRuleUpdate, as as FilterRuleValidateResponse, G as GeoClient, l as GeoSearchOptions, H as Hashtag, E as List, a4 as ListResponse, L as ListsClient, Y as Location, M as Media, a5 as MonitorStatus, ac as PingEvent, _ as Place, Z as PlaceTrends, s as Poll, r as PollOption, Q as QueryType, a1 as Space, o as SpacesClient, m as StreamClient, n as StreamEmitter, af as StreamEvent, ag as StreamEventType, a6 as StreamMonitor, a7 as StreamMonitorList, aa as StreamTweet, X as Trend, p as TrendCategory, k as TrendsClient, x as Tweet, ad as TweetEvent, w as TweetPlace, i as TweetsClient, T as TwitterClient, a9 as UpdateMonitorParams, t as Url, y as User, z as UserAbout, D as UserIds, u as UserMention, U as UsersClient, v as verifyWebhookSignature } from '../index-CIZUd1Zr.js';
|
|
2
2
|
import 'node:events';
|
package/dist/twitter/index.js
CHANGED
|
@@ -371,6 +371,59 @@ var TweetsClient = class {
|
|
|
371
371
|
};
|
|
372
372
|
yield* paginate(fetchPage, options);
|
|
373
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* Get the edit history of a tweet.
|
|
376
|
+
*
|
|
377
|
+
* @param tweetId - The tweet ID to get edit history for.
|
|
378
|
+
* @returns Paginated response containing tweet versions.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```typescript
|
|
382
|
+
* const history = await client.twitter.tweets.getEditHistory("1234567890");
|
|
383
|
+
* console.log(`${history.data.length} version(s) of this tweet`);
|
|
384
|
+
* ```
|
|
385
|
+
*/
|
|
386
|
+
async getEditHistory(tweetId) {
|
|
387
|
+
const response = await this.client.request(
|
|
388
|
+
`/v1/twitter/tweets/tweet/${tweetId}/edit_history`
|
|
389
|
+
);
|
|
390
|
+
return createPaginatedResponse(response.data ?? [], void 0);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Get community notes (Birdwatch) attached to a tweet.
|
|
394
|
+
*
|
|
395
|
+
* @param tweetId - The tweet ID to get community notes for.
|
|
396
|
+
* @returns Paginated response containing community notes.
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```typescript
|
|
400
|
+
* const notes = await client.twitter.tweets.getCommunityNotes("1234567890");
|
|
401
|
+
* for (const note of notes.data) {
|
|
402
|
+
* console.log(note.text);
|
|
403
|
+
* }
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
async getCommunityNotes(tweetId) {
|
|
407
|
+
const response = await this.client.request(
|
|
408
|
+
`/v1/twitter/tweets/tweet/${tweetId}/community_notes`
|
|
409
|
+
);
|
|
410
|
+
return createPaginatedResponse(response.data ?? [], void 0);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Get a long-form article by its ID.
|
|
414
|
+
*
|
|
415
|
+
* @param articleId - The article ID to fetch.
|
|
416
|
+
* @returns The article data.
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```typescript
|
|
420
|
+
* const article = await client.twitter.tweets.getArticle("abc123");
|
|
421
|
+
* console.log(`${article.title}: ${article.text?.slice(0, 100)}...`);
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
async getArticle(articleId) {
|
|
425
|
+
return this.client.request(`/v1/twitter/tweets/article/${articleId}`);
|
|
426
|
+
}
|
|
374
427
|
};
|
|
375
428
|
|
|
376
429
|
// src/twitter/users.ts
|
|
@@ -682,6 +735,92 @@ var UsersClient = class {
|
|
|
682
735
|
};
|
|
683
736
|
yield* paginate(fetchPage, options);
|
|
684
737
|
}
|
|
738
|
+
/**
|
|
739
|
+
* Get multiple users by their numeric IDs in a single request.
|
|
740
|
+
*
|
|
741
|
+
* @param userIds - List of user IDs to fetch.
|
|
742
|
+
* @returns Paginated response containing the matching users.
|
|
743
|
+
*
|
|
744
|
+
* @example
|
|
745
|
+
* ```typescript
|
|
746
|
+
* const users = await client.twitter.users.getByIds(["44196397", "783214"]);
|
|
747
|
+
* for (const user of users.data) {
|
|
748
|
+
* console.log(`@${user.username}`);
|
|
749
|
+
* }
|
|
750
|
+
* ```
|
|
751
|
+
*/
|
|
752
|
+
async getByIds(userIds) {
|
|
753
|
+
const response = await this.client.request(
|
|
754
|
+
"/v1/twitter/users/batch_by_ids",
|
|
755
|
+
{ params: { user_ids: userIds.join(",") } }
|
|
756
|
+
);
|
|
757
|
+
return createPaginatedResponse(response.data ?? [], void 0);
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Get multiple users by their usernames in a single request.
|
|
761
|
+
*
|
|
762
|
+
* @param usernames - List of usernames (without @) to fetch.
|
|
763
|
+
* @returns Paginated response containing the matching users.
|
|
764
|
+
*
|
|
765
|
+
* @example
|
|
766
|
+
* ```typescript
|
|
767
|
+
* const users = await client.twitter.users.getByUsernames(["elonmusk", "twitter"]);
|
|
768
|
+
* for (const user of users.data) {
|
|
769
|
+
* console.log(`${user.name}: ${user.followers_count?.toLocaleString()} followers`);
|
|
770
|
+
* }
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
async getByUsernames(usernames) {
|
|
774
|
+
const response = await this.client.request(
|
|
775
|
+
"/v1/twitter/users/batch_by_usernames",
|
|
776
|
+
{ params: { usernames: usernames.join(",") } }
|
|
777
|
+
);
|
|
778
|
+
return createPaginatedResponse(response.data ?? [], void 0);
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Get tweets that mention a user.
|
|
782
|
+
*
|
|
783
|
+
* @param username - The user's username (without @).
|
|
784
|
+
* @param options - Pagination options with optional count.
|
|
785
|
+
* @returns Paginated response containing tweets mentioning the user.
|
|
786
|
+
*
|
|
787
|
+
* @example
|
|
788
|
+
* ```typescript
|
|
789
|
+
* const mentions = await client.twitter.users.getMentions("elonmusk");
|
|
790
|
+
* for (const tweet of mentions.data) {
|
|
791
|
+
* console.log(`@${tweet.username}: ${tweet.text.slice(0, 100)}...`);
|
|
792
|
+
* }
|
|
793
|
+
* ```
|
|
794
|
+
*/
|
|
795
|
+
async getMentions(username, options = {}) {
|
|
796
|
+
const response = await this.client.request(
|
|
797
|
+
`/v1/twitter/users/${username}/mentions`,
|
|
798
|
+
{ params: { count: options.count, cursor: options.cursor } }
|
|
799
|
+
);
|
|
800
|
+
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Get long-form articles authored by a user.
|
|
804
|
+
*
|
|
805
|
+
* @param userId - The user's numeric ID.
|
|
806
|
+
* @param options - Pagination options with optional count.
|
|
807
|
+
* @returns Paginated response containing the user's articles as tweets.
|
|
808
|
+
*
|
|
809
|
+
* @example
|
|
810
|
+
* ```typescript
|
|
811
|
+
* const articles = await client.twitter.users.getArticles("44196397");
|
|
812
|
+
* for (const article of articles.data) {
|
|
813
|
+
* console.log(article.text?.slice(0, 100));
|
|
814
|
+
* }
|
|
815
|
+
* ```
|
|
816
|
+
*/
|
|
817
|
+
async getArticles(userId, options = {}) {
|
|
818
|
+
const response = await this.client.request(
|
|
819
|
+
`/v1/twitter/users/${userId}/articles`,
|
|
820
|
+
{ params: { count: options.count, cursor: options.cursor } }
|
|
821
|
+
);
|
|
822
|
+
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
823
|
+
}
|
|
685
824
|
};
|
|
686
825
|
|
|
687
826
|
// src/twitter/lists.ts
|
|
@@ -828,6 +967,29 @@ var ListsClient = class {
|
|
|
828
967
|
);
|
|
829
968
|
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
830
969
|
}
|
|
970
|
+
/**
|
|
971
|
+
* Search tweets within a specific list.
|
|
972
|
+
*
|
|
973
|
+
* @param listId - The list ID to search within.
|
|
974
|
+
* @param query - Search query string.
|
|
975
|
+
* @param options - Pagination options with optional count.
|
|
976
|
+
* @returns Paginated response containing matching tweets from the list.
|
|
977
|
+
*
|
|
978
|
+
* @example
|
|
979
|
+
* ```typescript
|
|
980
|
+
* const results = await client.twitter.lists.searchTweets("123456", "python");
|
|
981
|
+
* for (const tweet of results.data) {
|
|
982
|
+
* console.log(`@${tweet.username}: ${tweet.text.slice(0, 100)}...`);
|
|
983
|
+
* }
|
|
984
|
+
* ```
|
|
985
|
+
*/
|
|
986
|
+
async searchTweets(listId, query, options = {}) {
|
|
987
|
+
const response = await this.client.request(
|
|
988
|
+
`/v1/twitter/lists/${listId}/search_tweets`,
|
|
989
|
+
{ params: { query, count: options.count, cursor: options.cursor } }
|
|
990
|
+
);
|
|
991
|
+
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
992
|
+
}
|
|
831
993
|
};
|
|
832
994
|
|
|
833
995
|
// src/twitter/communities.ts
|
|
@@ -1870,6 +2032,46 @@ function verifyWebhookSignature(secret, body, signatureHeader) {
|
|
|
1870
2032
|
}
|
|
1871
2033
|
}
|
|
1872
2034
|
|
|
2035
|
+
// src/twitter/spaces.ts
|
|
2036
|
+
var SpacesClient = class {
|
|
2037
|
+
client;
|
|
2038
|
+
constructor(client) {
|
|
2039
|
+
this.client = client;
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Get details for a specific Twitter Space.
|
|
2043
|
+
*
|
|
2044
|
+
* @param spaceId - The Space ID to fetch.
|
|
2045
|
+
* @returns The Space data.
|
|
2046
|
+
* @throws NotFoundError - If the Space doesn't exist.
|
|
2047
|
+
*
|
|
2048
|
+
* @example
|
|
2049
|
+
* ```typescript
|
|
2050
|
+
* const space = await client.twitter.spaces.getDetail("1eaKbrPPbPwKX");
|
|
2051
|
+
* console.log(`${space.title} — ${space.participant_count} participants`);
|
|
2052
|
+
* ```
|
|
2053
|
+
*/
|
|
2054
|
+
async getDetail(spaceId) {
|
|
2055
|
+
return this.client.request(`/v1/twitter/spaces/${spaceId}`);
|
|
2056
|
+
}
|
|
2057
|
+
/**
|
|
2058
|
+
* Get details for a live video broadcast.
|
|
2059
|
+
*
|
|
2060
|
+
* @param broadcastId - The broadcast ID to fetch.
|
|
2061
|
+
* @returns The broadcast data.
|
|
2062
|
+
* @throws NotFoundError - If the broadcast doesn't exist.
|
|
2063
|
+
*
|
|
2064
|
+
* @example
|
|
2065
|
+
* ```typescript
|
|
2066
|
+
* const broadcast = await client.twitter.spaces.getBroadcast("broadcast123");
|
|
2067
|
+
* console.log(`${broadcast.title}: ${broadcast.total_viewers} viewers`);
|
|
2068
|
+
* ```
|
|
2069
|
+
*/
|
|
2070
|
+
async getBroadcast(broadcastId) {
|
|
2071
|
+
return this.client.request(`/v1/twitter/spaces/broadcast/${broadcastId}`);
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
2074
|
+
|
|
1873
2075
|
// src/twitter/client.ts
|
|
1874
2076
|
var TwitterClient = class {
|
|
1875
2077
|
/** Client for tweet operations */
|
|
@@ -1886,6 +2088,8 @@ var TwitterClient = class {
|
|
|
1886
2088
|
geo;
|
|
1887
2089
|
/** Client for real-time stream monitor management and WebSocket streaming */
|
|
1888
2090
|
stream;
|
|
2091
|
+
/** Client for Twitter Spaces and live broadcast operations */
|
|
2092
|
+
spaces;
|
|
1889
2093
|
/**
|
|
1890
2094
|
* Create a new Twitter client.
|
|
1891
2095
|
*
|
|
@@ -1899,12 +2103,14 @@ var TwitterClient = class {
|
|
|
1899
2103
|
this.trends = new TrendsClient(client);
|
|
1900
2104
|
this.geo = new GeoClient(client);
|
|
1901
2105
|
this.stream = new StreamClient(client);
|
|
2106
|
+
this.spaces = new SpacesClient(client);
|
|
1902
2107
|
}
|
|
1903
2108
|
};
|
|
1904
2109
|
|
|
1905
2110
|
exports.CommunitiesClient = CommunitiesClient;
|
|
1906
2111
|
exports.GeoClient = GeoClient;
|
|
1907
2112
|
exports.ListsClient = ListsClient;
|
|
2113
|
+
exports.SpacesClient = SpacesClient;
|
|
1908
2114
|
exports.StreamClient = StreamClient;
|
|
1909
2115
|
exports.TrendsClient = TrendsClient;
|
|
1910
2116
|
exports.TweetsClient = TweetsClient;
|