scrapebadger 0.1.4 → 0.1.6
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-BMStDLm1.d.cts → index-qYk-iloT.d.cts} +53 -1
- package/dist/{index-BMStDLm1.d.ts → index-qYk-iloT.d.ts} +53 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -0
- 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 +61 -0
- package/dist/twitter/index.js.map +1 -1
- package/dist/twitter/index.mjs +61 -0
- package/dist/twitter/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -192,7 +192,9 @@ interface Url {
|
|
|
192
192
|
*/
|
|
193
193
|
interface Hashtag {
|
|
194
194
|
/** The hashtag text (without #) */
|
|
195
|
-
|
|
195
|
+
text: string;
|
|
196
|
+
/** Character positions of the hashtag in the tweet text */
|
|
197
|
+
indices?: number[] | null;
|
|
196
198
|
}
|
|
197
199
|
/**
|
|
198
200
|
* A user mention entity in tweet text.
|
|
@@ -853,6 +855,56 @@ declare class TweetsClient {
|
|
|
853
855
|
* ```
|
|
854
856
|
*/
|
|
855
857
|
getSimilar(tweetId: string): Promise<PaginatedResponse<Tweet>>;
|
|
858
|
+
/**
|
|
859
|
+
* Get tweets that quote a specific tweet.
|
|
860
|
+
*
|
|
861
|
+
* @param tweetId - The tweet ID to get quote tweets for.
|
|
862
|
+
* @param options - Pagination options.
|
|
863
|
+
* @returns Paginated response containing tweets that quote this tweet.
|
|
864
|
+
*
|
|
865
|
+
* @example
|
|
866
|
+
* ```typescript
|
|
867
|
+
* const quotes = await client.twitter.tweets.getQuotes("1234567890");
|
|
868
|
+
* for (const quote of quotes.data) {
|
|
869
|
+
* console.log(`@${quote.username} quoted: ${quote.text.slice(0, 100)}...`);
|
|
870
|
+
* }
|
|
871
|
+
*
|
|
872
|
+
* // Get next page
|
|
873
|
+
* if (quotes.hasMore) {
|
|
874
|
+
* const more = await client.twitter.tweets.getQuotes("1234567890", {
|
|
875
|
+
* cursor: quotes.nextCursor
|
|
876
|
+
* });
|
|
877
|
+
* }
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
getQuotes(tweetId: string, options?: PaginationOptions): Promise<PaginatedResponse<Tweet>>;
|
|
881
|
+
/**
|
|
882
|
+
* Iterate through all quote tweets with automatic pagination.
|
|
883
|
+
*
|
|
884
|
+
* This is a convenience method that automatically handles pagination,
|
|
885
|
+
* yielding quote tweets one at a time.
|
|
886
|
+
*
|
|
887
|
+
* @param tweetId - The tweet ID to get quote tweets for.
|
|
888
|
+
* @param options - Iteration options.
|
|
889
|
+
* @yields Tweet objects that quote the specified tweet.
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```typescript
|
|
893
|
+
* // Get all quote tweets (up to 500)
|
|
894
|
+
* for await (const quote of client.twitter.tweets.getQuotesAll("1234567890", {
|
|
895
|
+
* maxItems: 500
|
|
896
|
+
* })) {
|
|
897
|
+
* console.log(`@${quote.username}: ${quote.text}`);
|
|
898
|
+
* }
|
|
899
|
+
*
|
|
900
|
+
* // Collect into an array
|
|
901
|
+
* import { collectAll } from "scrapebadger";
|
|
902
|
+
* const quotes = await collectAll(
|
|
903
|
+
* client.twitter.tweets.getQuotesAll("1234567890", { maxItems: 100 })
|
|
904
|
+
* );
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
getQuotesAll(tweetId: string, options?: IteratorOptions): AsyncGenerator<Tweet, void, undefined>;
|
|
856
908
|
/**
|
|
857
909
|
* Search for tweets.
|
|
858
910
|
*
|
|
@@ -192,7 +192,9 @@ interface Url {
|
|
|
192
192
|
*/
|
|
193
193
|
interface Hashtag {
|
|
194
194
|
/** The hashtag text (without #) */
|
|
195
|
-
|
|
195
|
+
text: string;
|
|
196
|
+
/** Character positions of the hashtag in the tweet text */
|
|
197
|
+
indices?: number[] | null;
|
|
196
198
|
}
|
|
197
199
|
/**
|
|
198
200
|
* A user mention entity in tweet text.
|
|
@@ -853,6 +855,56 @@ declare class TweetsClient {
|
|
|
853
855
|
* ```
|
|
854
856
|
*/
|
|
855
857
|
getSimilar(tweetId: string): Promise<PaginatedResponse<Tweet>>;
|
|
858
|
+
/**
|
|
859
|
+
* Get tweets that quote a specific tweet.
|
|
860
|
+
*
|
|
861
|
+
* @param tweetId - The tweet ID to get quote tweets for.
|
|
862
|
+
* @param options - Pagination options.
|
|
863
|
+
* @returns Paginated response containing tweets that quote this tweet.
|
|
864
|
+
*
|
|
865
|
+
* @example
|
|
866
|
+
* ```typescript
|
|
867
|
+
* const quotes = await client.twitter.tweets.getQuotes("1234567890");
|
|
868
|
+
* for (const quote of quotes.data) {
|
|
869
|
+
* console.log(`@${quote.username} quoted: ${quote.text.slice(0, 100)}...`);
|
|
870
|
+
* }
|
|
871
|
+
*
|
|
872
|
+
* // Get next page
|
|
873
|
+
* if (quotes.hasMore) {
|
|
874
|
+
* const more = await client.twitter.tweets.getQuotes("1234567890", {
|
|
875
|
+
* cursor: quotes.nextCursor
|
|
876
|
+
* });
|
|
877
|
+
* }
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
getQuotes(tweetId: string, options?: PaginationOptions): Promise<PaginatedResponse<Tweet>>;
|
|
881
|
+
/**
|
|
882
|
+
* Iterate through all quote tweets with automatic pagination.
|
|
883
|
+
*
|
|
884
|
+
* This is a convenience method that automatically handles pagination,
|
|
885
|
+
* yielding quote tweets one at a time.
|
|
886
|
+
*
|
|
887
|
+
* @param tweetId - The tweet ID to get quote tweets for.
|
|
888
|
+
* @param options - Iteration options.
|
|
889
|
+
* @yields Tweet objects that quote the specified tweet.
|
|
890
|
+
*
|
|
891
|
+
* @example
|
|
892
|
+
* ```typescript
|
|
893
|
+
* // Get all quote tweets (up to 500)
|
|
894
|
+
* for await (const quote of client.twitter.tweets.getQuotesAll("1234567890", {
|
|
895
|
+
* maxItems: 500
|
|
896
|
+
* })) {
|
|
897
|
+
* console.log(`@${quote.username}: ${quote.text}`);
|
|
898
|
+
* }
|
|
899
|
+
*
|
|
900
|
+
* // Collect into an array
|
|
901
|
+
* import { collectAll } from "scrapebadger";
|
|
902
|
+
* const quotes = await collectAll(
|
|
903
|
+
* client.twitter.tweets.getQuotesAll("1234567890", { maxItems: 100 })
|
|
904
|
+
* );
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
getQuotesAll(tweetId: string, options?: IteratorOptions): AsyncGenerator<Tweet, void, undefined>;
|
|
856
908
|
/**
|
|
857
909
|
* Search for tweets.
|
|
858
910
|
*
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TwitterClient, S as ScrapeBadgerConfig } from './index-
|
|
2
|
-
export { A as ApiResponse, C as CommunitiesClient, t as Community, r as CommunityBanner, u as CommunityMember, s as CommunityRule, g as CommunityTweetType, G as GeoClient, e as GeoSearchOptions, H as Hashtag, I as IteratorOptions, q as List, z as ListResponse, L as ListsClient, w as Location, M as Media, P as PaginatedResponse, a as PaginationOptions, y as Place, x as PlaceTrends, i as Poll, h as PollOption, Q as QueryType, R as ResolvedConfig, v as Trend, f as TrendCategory, d as TrendsClient, m as Tweet, l as TweetPlace, b as TweetsClient, j as Url, n as User, o as UserAbout, p as UserIds, k as UserMention, U as UsersClient, c as collectAll } from './index-
|
|
1
|
+
import { T as TwitterClient, S as ScrapeBadgerConfig } from './index-qYk-iloT.cjs';
|
|
2
|
+
export { A as ApiResponse, C as CommunitiesClient, t as Community, r as CommunityBanner, u as CommunityMember, s as CommunityRule, g as CommunityTweetType, G as GeoClient, e as GeoSearchOptions, H as Hashtag, I as IteratorOptions, q as List, z as ListResponse, L as ListsClient, w as Location, M as Media, P as PaginatedResponse, a as PaginationOptions, y as Place, x as PlaceTrends, i as Poll, h as PollOption, Q as QueryType, R as ResolvedConfig, v as Trend, f as TrendCategory, d as TrendsClient, m as Tweet, l as TweetPlace, b as TweetsClient, j as Url, n as User, o as UserAbout, p as UserIds, k as UserMention, U as UsersClient, c as collectAll } from './index-qYk-iloT.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Main ScrapeBadger client.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as TwitterClient, S as ScrapeBadgerConfig } from './index-
|
|
2
|
-
export { A as ApiResponse, C as CommunitiesClient, t as Community, r as CommunityBanner, u as CommunityMember, s as CommunityRule, g as CommunityTweetType, G as GeoClient, e as GeoSearchOptions, H as Hashtag, I as IteratorOptions, q as List, z as ListResponse, L as ListsClient, w as Location, M as Media, P as PaginatedResponse, a as PaginationOptions, y as Place, x as PlaceTrends, i as Poll, h as PollOption, Q as QueryType, R as ResolvedConfig, v as Trend, f as TrendCategory, d as TrendsClient, m as Tweet, l as TweetPlace, b as TweetsClient, j as Url, n as User, o as UserAbout, p as UserIds, k as UserMention, U as UsersClient, c as collectAll } from './index-
|
|
1
|
+
import { T as TwitterClient, S as ScrapeBadgerConfig } from './index-qYk-iloT.js';
|
|
2
|
+
export { A as ApiResponse, C as CommunitiesClient, t as Community, r as CommunityBanner, u as CommunityMember, s as CommunityRule, g as CommunityTweetType, G as GeoClient, e as GeoSearchOptions, H as Hashtag, I as IteratorOptions, q as List, z as ListResponse, L as ListsClient, w as Location, M as Media, P as PaginatedResponse, a as PaginationOptions, y as Place, x as PlaceTrends, i as Poll, h as PollOption, Q as QueryType, R as ResolvedConfig, v as Trend, f as TrendCategory, d as TrendsClient, m as Tweet, l as TweetPlace, b as TweetsClient, j as Url, n as User, o as UserAbout, p as UserIds, k as UserMention, U as UsersClient, c as collectAll } from './index-qYk-iloT.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Main ScrapeBadger client.
|
package/dist/index.js
CHANGED
|
@@ -430,6 +430,67 @@ var TweetsClient = class {
|
|
|
430
430
|
);
|
|
431
431
|
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
432
432
|
}
|
|
433
|
+
/**
|
|
434
|
+
* Get tweets that quote a specific tweet.
|
|
435
|
+
*
|
|
436
|
+
* @param tweetId - The tweet ID to get quote tweets for.
|
|
437
|
+
* @param options - Pagination options.
|
|
438
|
+
* @returns Paginated response containing tweets that quote this tweet.
|
|
439
|
+
*
|
|
440
|
+
* @example
|
|
441
|
+
* ```typescript
|
|
442
|
+
* const quotes = await client.twitter.tweets.getQuotes("1234567890");
|
|
443
|
+
* for (const quote of quotes.data) {
|
|
444
|
+
* console.log(`@${quote.username} quoted: ${quote.text.slice(0, 100)}...`);
|
|
445
|
+
* }
|
|
446
|
+
*
|
|
447
|
+
* // Get next page
|
|
448
|
+
* if (quotes.hasMore) {
|
|
449
|
+
* const more = await client.twitter.tweets.getQuotes("1234567890", {
|
|
450
|
+
* cursor: quotes.nextCursor
|
|
451
|
+
* });
|
|
452
|
+
* }
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
async getQuotes(tweetId, options = {}) {
|
|
456
|
+
const response = await this.client.request(
|
|
457
|
+
`/v1/twitter/tweets/tweet/${tweetId}/quotes`,
|
|
458
|
+
{ params: { cursor: options.cursor } }
|
|
459
|
+
);
|
|
460
|
+
return createPaginatedResponse(response.data ?? [], response.next_cursor);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Iterate through all quote tweets with automatic pagination.
|
|
464
|
+
*
|
|
465
|
+
* This is a convenience method that automatically handles pagination,
|
|
466
|
+
* yielding quote tweets one at a time.
|
|
467
|
+
*
|
|
468
|
+
* @param tweetId - The tweet ID to get quote tweets for.
|
|
469
|
+
* @param options - Iteration options.
|
|
470
|
+
* @yields Tweet objects that quote the specified tweet.
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```typescript
|
|
474
|
+
* // Get all quote tweets (up to 500)
|
|
475
|
+
* for await (const quote of client.twitter.tweets.getQuotesAll("1234567890", {
|
|
476
|
+
* maxItems: 500
|
|
477
|
+
* })) {
|
|
478
|
+
* console.log(`@${quote.username}: ${quote.text}`);
|
|
479
|
+
* }
|
|
480
|
+
*
|
|
481
|
+
* // Collect into an array
|
|
482
|
+
* import { collectAll } from "scrapebadger";
|
|
483
|
+
* const quotes = await collectAll(
|
|
484
|
+
* client.twitter.tweets.getQuotesAll("1234567890", { maxItems: 100 })
|
|
485
|
+
* );
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
async *getQuotesAll(tweetId, options = {}) {
|
|
489
|
+
const fetchPage = async (cursor) => {
|
|
490
|
+
return this.getQuotes(tweetId, { ...options, cursor });
|
|
491
|
+
};
|
|
492
|
+
yield* paginate(fetchPage, options);
|
|
493
|
+
}
|
|
433
494
|
/**
|
|
434
495
|
* Search for tweets.
|
|
435
496
|
*
|