@the-convocation/twitter-scraper 0.17.2 → 0.18.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/default/cjs/index.js +208 -10
- package/dist/default/cjs/index.js.map +1 -1
- package/dist/default/esm/index.mjs +208 -10
- package/dist/default/esm/index.mjs.map +1 -1
- package/dist/node/cjs/index.cjs +208 -10
- package/dist/node/cjs/index.cjs.map +1 -1
- package/dist/node/esm/index.mjs +208 -10
- package/dist/node/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +185 -1
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -267,9 +267,15 @@ interface LegacyUserRaw {
|
|
|
267
267
|
entities?: {
|
|
268
268
|
url?: {
|
|
269
269
|
urls?: {
|
|
270
|
+
url?: string;
|
|
270
271
|
expanded_url?: string;
|
|
272
|
+
display_url?: string;
|
|
273
|
+
indices?: [number, number];
|
|
271
274
|
}[];
|
|
272
275
|
};
|
|
276
|
+
description?: {
|
|
277
|
+
urls?: any[];
|
|
278
|
+
};
|
|
273
279
|
};
|
|
274
280
|
favourites_count?: number;
|
|
275
281
|
followers_count?: number;
|
|
@@ -292,6 +298,39 @@ interface LegacyUserRaw {
|
|
|
292
298
|
has_extended_profile?: boolean;
|
|
293
299
|
url?: string;
|
|
294
300
|
can_dm?: boolean;
|
|
301
|
+
id?: number;
|
|
302
|
+
utc_offset?: any;
|
|
303
|
+
time_zone?: any;
|
|
304
|
+
lang?: any;
|
|
305
|
+
contributors_enabled?: boolean;
|
|
306
|
+
is_translator?: boolean;
|
|
307
|
+
is_translation_enabled?: boolean;
|
|
308
|
+
profile_background_image_url?: string;
|
|
309
|
+
profile_background_image_url_https?: string;
|
|
310
|
+
profile_background_tile?: boolean;
|
|
311
|
+
profile_image_url?: string;
|
|
312
|
+
profile_link_color?: string;
|
|
313
|
+
profile_sidebar_border_color?: string;
|
|
314
|
+
profile_sidebar_fill_color?: string;
|
|
315
|
+
profile_text_color?: string;
|
|
316
|
+
profile_use_background_image?: boolean;
|
|
317
|
+
default_profile?: boolean;
|
|
318
|
+
default_profile_image?: boolean;
|
|
319
|
+
can_secret_dm?: boolean;
|
|
320
|
+
can_media_tag?: boolean;
|
|
321
|
+
following?: boolean;
|
|
322
|
+
follow_request_sent?: boolean;
|
|
323
|
+
notifications?: boolean;
|
|
324
|
+
blocking?: boolean;
|
|
325
|
+
subscribed_by?: boolean;
|
|
326
|
+
blocked_by?: boolean;
|
|
327
|
+
want_retweets?: boolean;
|
|
328
|
+
dm_blocked_by?: boolean;
|
|
329
|
+
dm_blocking?: boolean;
|
|
330
|
+
business_profile_state?: string;
|
|
331
|
+
translator_type?: string;
|
|
332
|
+
withheld_in_countries?: any[];
|
|
333
|
+
followed_by?: boolean;
|
|
295
334
|
}
|
|
296
335
|
/**
|
|
297
336
|
* A parsed profile object.
|
|
@@ -323,6 +362,120 @@ interface Profile {
|
|
|
323
362
|
canDm?: boolean;
|
|
324
363
|
}
|
|
325
364
|
|
|
365
|
+
interface DmInboxResponse {
|
|
366
|
+
inbox_initial_state: DmInbox;
|
|
367
|
+
}
|
|
368
|
+
interface DmInbox {
|
|
369
|
+
last_seen_event_id: string;
|
|
370
|
+
trusted_last_seen_event_id: string;
|
|
371
|
+
untrusted_last_seen_event_id: string;
|
|
372
|
+
cursor: string;
|
|
373
|
+
inbox_timelines: DmInboxTimelines;
|
|
374
|
+
entries: DmMessageEntry[];
|
|
375
|
+
users: {
|
|
376
|
+
[key: string]: LegacyUserRaw;
|
|
377
|
+
};
|
|
378
|
+
conversations: {
|
|
379
|
+
[key: string]: DmConversation;
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
interface DmConversationResponse {
|
|
383
|
+
conversation_timeline: DmConversationTimeline;
|
|
384
|
+
}
|
|
385
|
+
interface DmConversationTimeline {
|
|
386
|
+
status: DmStatus;
|
|
387
|
+
min_entry_id: string;
|
|
388
|
+
max_entry_id: string;
|
|
389
|
+
entries: DmMessageEntry[];
|
|
390
|
+
users: {
|
|
391
|
+
[key: string]: LegacyUserRaw;
|
|
392
|
+
};
|
|
393
|
+
conversations: {
|
|
394
|
+
[key: string]: DmConversation;
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
interface DmConversation {
|
|
398
|
+
conversation_id: string;
|
|
399
|
+
type: string;
|
|
400
|
+
sort_event_id: string;
|
|
401
|
+
sort_timestamp: string;
|
|
402
|
+
participants: DmParticipant[];
|
|
403
|
+
nsfw: boolean;
|
|
404
|
+
notifications_disabled: boolean;
|
|
405
|
+
mention_notifications_disabled: boolean;
|
|
406
|
+
last_read_event_id: string;
|
|
407
|
+
read_only: boolean;
|
|
408
|
+
trusted: boolean;
|
|
409
|
+
muted: boolean;
|
|
410
|
+
status: DmStatus;
|
|
411
|
+
min_entry_id: string;
|
|
412
|
+
max_entry_id: string;
|
|
413
|
+
}
|
|
414
|
+
type DmStatus = 'AT_END' | 'HAS_MORE';
|
|
415
|
+
interface DmParticipant {
|
|
416
|
+
user_id: string;
|
|
417
|
+
last_read_event_id?: string;
|
|
418
|
+
}
|
|
419
|
+
interface DmMessageEntry {
|
|
420
|
+
welcome_message_create?: DmWelcomeMessage;
|
|
421
|
+
message?: DmMessage;
|
|
422
|
+
}
|
|
423
|
+
interface DmMessage {
|
|
424
|
+
id: string;
|
|
425
|
+
time: string;
|
|
426
|
+
affects_sort: boolean;
|
|
427
|
+
request_id: string;
|
|
428
|
+
conversation_id: string;
|
|
429
|
+
message_data: DmMessageData;
|
|
430
|
+
message_reactions: DmReaction[];
|
|
431
|
+
}
|
|
432
|
+
interface DmMessageData {
|
|
433
|
+
id: string;
|
|
434
|
+
time: string;
|
|
435
|
+
recipient_id: string;
|
|
436
|
+
sender_id: string;
|
|
437
|
+
text: string;
|
|
438
|
+
edit_count?: number;
|
|
439
|
+
entities?: DmMessageEntities;
|
|
440
|
+
}
|
|
441
|
+
interface DmReaction {
|
|
442
|
+
id: string;
|
|
443
|
+
time: string;
|
|
444
|
+
conversation_id: string;
|
|
445
|
+
message_id: string;
|
|
446
|
+
reaction_key: string;
|
|
447
|
+
emoji_reaction: string;
|
|
448
|
+
sender_id: string;
|
|
449
|
+
}
|
|
450
|
+
interface DmMessageEntities {
|
|
451
|
+
hashtags: any[];
|
|
452
|
+
symbols: any[];
|
|
453
|
+
user_mentions: any[];
|
|
454
|
+
urls: DmMessageUrl[];
|
|
455
|
+
}
|
|
456
|
+
interface DmMessageUrl {
|
|
457
|
+
url: string;
|
|
458
|
+
expanded_url: string;
|
|
459
|
+
display_url: string;
|
|
460
|
+
indices: number[];
|
|
461
|
+
}
|
|
462
|
+
interface DmWelcomeMessage extends DmMessage {
|
|
463
|
+
welcome_message_id: string;
|
|
464
|
+
}
|
|
465
|
+
interface DmInboxTimelines {
|
|
466
|
+
trusted: DmTimelineState;
|
|
467
|
+
untrusted: DmTimelineState;
|
|
468
|
+
untrusted_low_quality: DmTimelineState;
|
|
469
|
+
}
|
|
470
|
+
interface DmTimelineState {
|
|
471
|
+
status: DmStatus;
|
|
472
|
+
min_entry_id: string;
|
|
473
|
+
}
|
|
474
|
+
interface DmCursorOptions {
|
|
475
|
+
maxId?: string;
|
|
476
|
+
minId?: string;
|
|
477
|
+
}
|
|
478
|
+
|
|
326
479
|
interface Mention {
|
|
327
480
|
id: string;
|
|
328
481
|
username?: string;
|
|
@@ -749,6 +902,37 @@ declare class Scraper {
|
|
|
749
902
|
* @returns The {@link Tweet} object, or `null` if it couldn't be fetched.
|
|
750
903
|
*/
|
|
751
904
|
getTweet(id: string): Promise<Tweet | null>;
|
|
905
|
+
/**
|
|
906
|
+
* Retrieves the direct message inbox for the authenticated user.
|
|
907
|
+
*
|
|
908
|
+
* @return A promise that resolves to an object representing the direct message inbox.
|
|
909
|
+
*/
|
|
910
|
+
getDmInbox(): Promise<DmInbox>;
|
|
911
|
+
/**
|
|
912
|
+
* Retrieves the direct message conversation for the specified conversation ID.
|
|
913
|
+
*
|
|
914
|
+
* @param conversationId - The unique identifier of the DM conversation to retrieve.
|
|
915
|
+
* @param cursor - Use `maxId` to get messages before a message ID (older messages), or `minId` to get messages after a message ID (newer messages).
|
|
916
|
+
* @return A promise that resolves to the timeline of the DM conversation.
|
|
917
|
+
*/
|
|
918
|
+
getDmConversation(conversationId: string, cursor?: DmCursorOptions): Promise<DmConversationTimeline>;
|
|
919
|
+
/**
|
|
920
|
+
* Retrieves direct messages from a specific conversation.
|
|
921
|
+
*
|
|
922
|
+
* @param conversationId - The unique identifier of the conversation to fetch messages from.
|
|
923
|
+
* @param [maxMessages=20] - The maximum number of messages to retrieve per request.
|
|
924
|
+
* @param cursor - Use `maxId` to get messages before a message ID (older messages), or `minId` to get messages after a message ID (newer messages).
|
|
925
|
+
* @returns An {@link AsyncGenerator} of messages from the provided conversation.
|
|
926
|
+
*/
|
|
927
|
+
getDmMessages(conversationId: string, maxMessages?: number, cursor?: DmCursorOptions): AsyncGenerator<DmMessageEntry, void>;
|
|
928
|
+
/**
|
|
929
|
+
* Retrieves a list of direct message conversations for a specific user based on their user ID.
|
|
930
|
+
*
|
|
931
|
+
* @param inbox - The DM inbox containing all available conversations.
|
|
932
|
+
* @param userId - The unique identifier of the user whose DM conversations are to be retrieved.
|
|
933
|
+
* @return An array of DM conversations associated with the specified user ID.
|
|
934
|
+
*/
|
|
935
|
+
findDmConversationsByUserId(inbox: DmInbox, userId: string): DmConversation[];
|
|
752
936
|
/**
|
|
753
937
|
* Returns if the scraper has a guest token. The token may not be valid.
|
|
754
938
|
* @returns `true` if the scraper has a guest token; otherwise `false`.
|
|
@@ -804,4 +988,4 @@ declare class Scraper {
|
|
|
804
988
|
private handleResponse;
|
|
805
989
|
}
|
|
806
990
|
|
|
807
|
-
export { ApiError, AuthenticationError, ErrorRateLimitStrategy, type FetchParameters, type FetchTransformOptions, type FlowSubtaskHandler, type FlowSubtaskHandlerApi, type FlowTokenResult, type FlowTokenResultError, type FlowTokenResultSuccess, type Mention, type Photo, type PlaceRaw, type Profile, type QueryProfilesResponse, type QueryTweetsResponse, type RateLimitEvent, type RateLimitStrategy, Scraper, type ScraperOptions, SearchMode, type Tweet, type TweetQuery, type TwitterApiErrorExtensions, type TwitterApiErrorPosition, type TwitterApiErrorRaw, type TwitterApiErrorTraceInfo, type TwitterUserAuthCredentials, type TwitterUserAuthFlowInitRequest, type TwitterUserAuthFlowRequest, type TwitterUserAuthFlowResponse, type TwitterUserAuthFlowSubtaskRequest, type Video, WaitingRateLimitStrategy };
|
|
991
|
+
export { ApiError, AuthenticationError, type DmConversation, type DmConversationResponse, type DmConversationTimeline, type DmInbox, type DmInboxResponse, type DmInboxTimelines, type DmMessage, type DmMessageData, type DmMessageEntities, type DmMessageEntry, type DmMessageUrl, type DmParticipant, type DmReaction, type DmStatus, type DmTimelineState, type DmWelcomeMessage, ErrorRateLimitStrategy, type FetchParameters, type FetchTransformOptions, type FlowSubtaskHandler, type FlowSubtaskHandlerApi, type FlowTokenResult, type FlowTokenResultError, type FlowTokenResultSuccess, type Mention, type Photo, type PlaceRaw, type Profile, type QueryProfilesResponse, type QueryTweetsResponse, type RateLimitEvent, type RateLimitStrategy, Scraper, type ScraperOptions, SearchMode, type Tweet, type TweetQuery, type TwitterApiErrorExtensions, type TwitterApiErrorPosition, type TwitterApiErrorRaw, type TwitterApiErrorTraceInfo, type TwitterUserAuthCredentials, type TwitterUserAuthFlowInitRequest, type TwitterUserAuthFlowRequest, type TwitterUserAuthFlowResponse, type TwitterUserAuthFlowSubtaskRequest, type Video, WaitingRateLimitStrategy };
|