rettiwt-api 1.0.1
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/.dockerignore +2 -0
- package/.gitattributes +3 -0
- package/Dockerfile +9 -0
- package/README.md +38 -0
- package/dist/config/env.d.ts +5 -0
- package/dist/config/env.js +9 -0
- package/dist/config/env.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/models/graphql/Global.d.ts +4 -0
- package/dist/models/graphql/Global.js +13 -0
- package/dist/models/graphql/Global.js.map +1 -0
- package/dist/models/graphql/TweetTypes.d.ts +6 -0
- package/dist/models/graphql/TweetTypes.js +156 -0
- package/dist/models/graphql/TweetTypes.js.map +1 -0
- package/dist/models/graphql/UserTypes.d.ts +3 -0
- package/dist/models/graphql/UserTypes.js +139 -0
- package/dist/models/graphql/UserTypes.js.map +1 -0
- package/dist/queries/RootQuery.d.ts +4 -0
- package/dist/queries/RootQuery.js +59 -0
- package/dist/queries/RootQuery.js.map +1 -0
- package/dist/resolvers/ResolverBase.d.ts +5 -0
- package/dist/resolvers/ResolverBase.js +11 -0
- package/dist/resolvers/ResolverBase.js.map +1 -0
- package/dist/resolvers/TweetResolver.d.ts +54 -0
- package/dist/resolvers/TweetResolver.js +328 -0
- package/dist/resolvers/TweetResolver.js.map +1 -0
- package/dist/resolvers/UserResolver.d.ts +47 -0
- package/dist/resolvers/UserResolver.js +302 -0
- package/dist/resolvers/UserResolver.js.map +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +75 -0
- package/dist/server.js.map +1 -0
- package/dist/services/AuthService.d.ts +17 -0
- package/dist/services/AuthService.js +103 -0
- package/dist/services/AuthService.js.map +1 -0
- package/dist/services/CacheService.d.ts +25 -0
- package/dist/services/CacheService.js +141 -0
- package/dist/services/CacheService.js.map +1 -0
- package/dist/services/FetcherService.d.ts +30 -0
- package/dist/services/FetcherService.js +171 -0
- package/dist/services/FetcherService.js.map +1 -0
- package/dist/services/data/TweetService.d.ts +43 -0
- package/dist/services/data/TweetService.js +229 -0
- package/dist/services/data/TweetService.js.map +1 -0
- package/dist/services/data/UserAccountService.d.ts +49 -0
- package/dist/services/data/UserAccountService.js +250 -0
- package/dist/services/data/UserAccountService.js.map +1 -0
- package/dist/services/helper/Deserializers.d.ts +19 -0
- package/dist/services/helper/Deserializers.js +115 -0
- package/dist/services/helper/Deserializers.js.map +1 -0
- package/dist/services/helper/Extractors.d.ts +101 -0
- package/dist/services/helper/Extractors.js +409 -0
- package/dist/services/helper/Extractors.js.map +1 -0
- package/dist/services/helper/Headers.d.ts +9 -0
- package/dist/services/helper/Headers.js +47 -0
- package/dist/services/helper/Headers.js.map +1 -0
- package/dist/services/helper/Parser.d.ts +28 -0
- package/dist/services/helper/Parser.js +104 -0
- package/dist/services/helper/Parser.js.map +1 -0
- package/dist/services/helper/Urls.d.ts +74 -0
- package/dist/services/helper/Urls.js +114 -0
- package/dist/services/helper/Urls.js.map +1 -0
- package/dist/test/Test.js +2 -0
- package/dist/test/Test.js.map +1 -0
- package/dist/types/Authentication.d.ts +15 -0
- package/dist/types/Authentication.js +5 -0
- package/dist/types/Authentication.js.map +1 -0
- package/dist/types/HTTP.d.ts +22 -0
- package/dist/types/HTTP.js +30 -0
- package/dist/types/HTTP.js.map +1 -0
- package/dist/types/Service.d.ts +27 -0
- package/dist/types/Service.js +19 -0
- package/dist/types/Service.js.map +1 -0
- package/dist/types/Tweet.d.ts +40 -0
- package/dist/types/Tweet.js +5 -0
- package/dist/types/Tweet.js.map +1 -0
- package/dist/types/UserAccount.d.ts +19 -0
- package/dist/types/UserAccount.js +4 -0
- package/dist/types/UserAccount.js.map +1 -0
- package/dist/types/graphql/Errors.d.ts +15 -0
- package/dist/types/graphql/Errors.js +23 -0
- package/dist/types/graphql/Errors.js.map +1 -0
- package/dist/types/raw/auth/Cookie.d.ts +16 -0
- package/dist/types/raw/auth/Cookie.js +3 -0
- package/dist/types/raw/auth/Cookie.js.map +1 -0
- package/dist/types/raw/tweet/Favouriters.d.ts +164 -0
- package/dist/types/raw/tweet/Favouriters.js +3 -0
- package/dist/types/raw/tweet/Favouriters.js.map +1 -0
- package/dist/types/raw/tweet/Retweeters.d.ts +171 -0
- package/dist/types/raw/tweet/Retweeters.js +3 -0
- package/dist/types/raw/tweet/Retweeters.js.map +1 -0
- package/dist/types/raw/tweet/Tweet.d.ts +746 -0
- package/dist/types/raw/tweet/Tweet.js +3 -0
- package/dist/types/raw/tweet/Tweet.js.map +1 -0
- package/dist/types/raw/tweet/Tweets.d.ts +386 -0
- package/dist/types/raw/tweet/Tweets.js +3 -0
- package/dist/types/raw/tweet/Tweets.js.map +1 -0
- package/dist/types/raw/user/Followers.d.ts +176 -0
- package/dist/types/raw/user/Followers.js +3 -0
- package/dist/types/raw/user/Followers.js.map +1 -0
- package/dist/types/raw/user/Following.d.ts +176 -0
- package/dist/types/raw/user/Following.js +3 -0
- package/dist/types/raw/user/Following.js.map +1 -0
- package/dist/types/raw/user/Likes.d.ts +1059 -0
- package/dist/types/raw/user/Likes.js +3 -0
- package/dist/types/raw/user/Likes.js.map +1 -0
- package/dist/types/raw/user/Tweets.d.ts +2428 -0
- package/dist/types/raw/user/Tweets.js +3 -0
- package/dist/types/raw/user/Tweets.js.map +1 -0
- package/dist/types/raw/user/User.d.ts +117 -0
- package/dist/types/raw/user/User.js +3 -0
- package/dist/types/raw/user/User.js.map +1 -0
- package/dist/types/raw/user/Users.d.ts +120 -0
- package/dist/types/raw/user/Users.js +3 -0
- package/dist/types/raw/user/Users.js.map +1 -0
- package/environment.d.ts +11 -0
- package/package.json +40 -0
- package/src/config/env.ts +5 -0
- package/src/index.ts +19 -0
- package/src/models/graphql/Global.ts +10 -0
- package/src/models/graphql/TweetTypes.ts +154 -0
- package/src/models/graphql/UserTypes.ts +137 -0
- package/src/queries/RootQuery.ts +56 -0
- package/src/resolvers/ResolverBase.ts +12 -0
- package/src/resolvers/TweetResolver.ts +257 -0
- package/src/resolvers/UserResolver.ts +239 -0
- package/src/server.ts +36 -0
- package/src/services/AuthService.ts +58 -0
- package/src/services/CacheService.ts +70 -0
- package/src/services/FetcherService.ts +84 -0
- package/src/services/data/TweetService.ts +163 -0
- package/src/services/data/UserAccountService.ts +187 -0
- package/src/services/helper/Deserializers.ts +95 -0
- package/src/services/helper/Extractors.ts +455 -0
- package/src/services/helper/Headers.ts +45 -0
- package/src/services/helper/Parser.ts +108 -0
- package/src/services/helper/Urls.ts +109 -0
- package/src/types/Authentication.ts +16 -0
- package/src/types/HTTP.ts +23 -0
- package/src/types/Service.ts +36 -0
- package/src/types/Tweet.ts +44 -0
- package/src/types/UserAccount.ts +21 -0
- package/src/types/graphql/Errors.ts +16 -0
- package/src/types/raw/auth/Cookie.ts +16 -0
- package/src/types/raw/tweet/Favouriters.ts +193 -0
- package/src/types/raw/tweet/Retweeters.ts +201 -0
- package/src/types/raw/tweet/Tweet.ts +882 -0
- package/src/types/raw/tweet/Tweets.ts +444 -0
- package/src/types/raw/user/Followers.ts +208 -0
- package/src/types/raw/user/Following.ts +208 -0
- package/src/types/raw/user/Likes.ts +1247 -0
- package/src/types/raw/user/Tweets.ts +2847 -0
- package/src/types/raw/user/User.ts +135 -0
- package/tsconfig.json +95 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @returns The url for fetching a guest token
|
|
3
|
+
*/
|
|
4
|
+
export function guestTokenUrl(): string {
|
|
5
|
+
return `https://api.twitter.com/1.1/guest/activate.json`;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @returns The url for fetching user account details.
|
|
10
|
+
* @param screenName The screen name of the target user
|
|
11
|
+
*/
|
|
12
|
+
export function userAccountUrl(screenName: string): string {
|
|
13
|
+
return `https://api.twitter.com/graphql/hVhfo_TquFTmgL7gYwf91Q/UserByScreenName?variables=%7B%22screen_name%22%3A%22${screenName}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%7D`
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @returns The url for fetching user account details.
|
|
18
|
+
* @param restid The restId of the target user
|
|
19
|
+
*/
|
|
20
|
+
export function userAccountByIdUrl(restId: string): string {
|
|
21
|
+
return `https://api.twitter.com/graphql/mi_IjXgFyr41N9zkszPz9w/UserByRestId?variables=%7B%22userId%22%3A%22${restId}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%7D`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @returns The url for fetching the list of users followed bu target user.
|
|
26
|
+
* @param userId The rest id of the target user
|
|
27
|
+
* @param count The batch size of the list of following
|
|
28
|
+
* @param cursor The cursor to next batch
|
|
29
|
+
*/
|
|
30
|
+
export function userFollowingUrl(userId: string, count: number, cursor: string): string {
|
|
31
|
+
return `https://api.twitter.com/graphql/mSnjZc5CTm2Z5Lu_i4XsPQ/Following?variables=%7B%22userId%22%3A%22${userId}%22%2C%22count%22%3A${count}%2C%22cursor%22%3A%22${cursor}%22%2C%22includePromotedContent%22%3Afalse%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22view_counts_public_visibility_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_uc_gql_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @return The url for fetching the list of followers of the target user
|
|
36
|
+
* @param userId The rest id of the target user
|
|
37
|
+
* @param count The batch size for the list of followers
|
|
38
|
+
* @param cursor The cusor to next batch
|
|
39
|
+
*/
|
|
40
|
+
export function userFollowersUrl(userId: string, count: number, cursor: string): string {
|
|
41
|
+
return `https://api.twitter.com/graphql/nwlAnaw7oKXcVLi91ehy7Q/Followers?variables=%7B%22userId%22%3A%22${userId}%22%2C%22count%22%3A${count}%2C%22cursor%22%3A%22${cursor}%22%2C%22includePromotedContent%22%3Afalse%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22view_counts_public_visibility_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_uc_gql_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @returns The url for fetching the list of tweets liked by the target user
|
|
46
|
+
* @param userId The rest id of the target user
|
|
47
|
+
* @param count The batch size for the list of tweets
|
|
48
|
+
* @param cursor The cusor to next batch
|
|
49
|
+
*/
|
|
50
|
+
export function userLikesUrl(userId: string, count: number, cursor: string): string {
|
|
51
|
+
return `https://api.twitter.com/graphql/gP4ZKghLd4tpILgS6VudAQ/Likes?variables=%7B%22userId%22%3A%22${userId}%22%2C%22count%22%3A${count}%2C%22cursor%22%3A%22${cursor}%22%2C%22includePromotedContent%22%3Afalse%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withClientEventToken%22%3Afalse%2C%22withBirdwatchNotes%22%3Afalse%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22view_counts_public_visibility_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_uc_gql_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @returns The url for fetching the list of tweets made by the target user
|
|
56
|
+
* @param userId The rest id of the target user
|
|
57
|
+
* @param count The batch size for the list of tweets
|
|
58
|
+
* @param cursor The cursor to next batch
|
|
59
|
+
*/
|
|
60
|
+
export function userTweetsUrl(userId: string, count: number, cursor: string): string {
|
|
61
|
+
return `https://api.twitter.com/graphql/MsEBEnQjKQCsRlAbC6qKcA/UserTweets?variables=%7B%22userId%22%3A%22${userId}%22%2C%22count%22%3A${count}%2C%22cursor%22%3A%22${cursor}%22%2C%22includePromotedContent%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22view_counts_public_visibility_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @returns The url for fetching the list of tweets matching the given filter
|
|
66
|
+
* @param query The query to be used for searching tweets
|
|
67
|
+
* @param count The number of tweets to fetch
|
|
68
|
+
* @param cursor The cusor to next batch *
|
|
69
|
+
*/
|
|
70
|
+
export function tweetsUrl(query: string, count: number, cursor: string): string {
|
|
71
|
+
return `https://api.twitter.com/2/search/adaptive.json?include_want_retweets=1&include_quote_count=true&include_reply_count=1&tweet_mode=extended&include_entities=true&include_user_entities=true&simple_quoted_tweet=true&q=${query}&tweet_search_mode=live&count=${count}&query_source=typed_query&cursor=${cursor}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @returns The url for fetching the details of a given tweet
|
|
76
|
+
* @param tweetId The rest id of the target tweet
|
|
77
|
+
*/
|
|
78
|
+
export function tweetDetailsUrl(tweetId: string): string {
|
|
79
|
+
return `https://api.twitter.com/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail?variables=%7B%22focalTweetId%22%3A%22${tweetId}%22%2C%22referrer%22%3A%22profile%22%2C%22with_rux_injections%22%3Afalse%2C%22includePromotedContent%22%3Atrue%2C%22withCommunity%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withBirdwatchNotes%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22view_counts_public_visibility_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_uc_gql_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @returns The url for fetching the list of replies to a given tweet
|
|
84
|
+
* @param tweetId The rest of the target tweet
|
|
85
|
+
* @param cursor The curor to next batch
|
|
86
|
+
*/
|
|
87
|
+
export function tweetRepliesUrl(tweetId: string, cursor: string): string {
|
|
88
|
+
return `https://api.twitter.com/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail?variables=%7B%22focalTweetId%22%3A%22${tweetId}%22%2C%22cursor%22%3A%22${cursor}%22%2C%22referrer%22%3A%22tweet%22%2C%22with_rux_injections%22%3Afalse%2C%22includePromotedContent%22%3Atrue%2C%22withCommunity%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withBirdwatchNotes%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22view_counts_public_visibility_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_uc_gql_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @returns The url for fetching the list of users who liked a given tweet
|
|
93
|
+
* @param tweetId The rest id of the target tweet
|
|
94
|
+
* @param count The batch size of the list of users
|
|
95
|
+
* @param cursor The curor to next batch
|
|
96
|
+
*/
|
|
97
|
+
export function tweetLikesUrl(tweetId: string, count: number, cursor: string): string {
|
|
98
|
+
return `https://api.twitter.com/graphql/56ZwFC3Vui31fF8IYX8EGA/Favoriters?variables=%7B%22tweetId%22%3A%22${tweetId}%22%2C%22count%22%3A${count}%2C%22cursor%22%3A%22${cursor}%22%2C%22includePromotedContent%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22view_counts_public_visibility_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_uc_gql_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @returns The url for fetching the list of user who retweeted the given tweet
|
|
103
|
+
* @param tweetId The rest id of the target tweet
|
|
104
|
+
* @param count The batch size of the list of users
|
|
105
|
+
* @param cursor The curor to next batch
|
|
106
|
+
*/
|
|
107
|
+
export function tweetRetweetUrl(tweetId: string, count: number, cursor: string): string {
|
|
108
|
+
return `https://api.twitter.com/graphql/Wd7DVeLqMj_JQiTL0tjJwQ/Retweeters?variables=%7B%22tweetId%22%3A%22${tweetId}%22%2C%22count%22%3A${count}%2C%22cursor%22%3A%22${cursor}%22%2C%22includePromotedContent%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%7D&features=%7B%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22view_counts_public_visibility_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_uc_gql_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D`;
|
|
109
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary Stores the guest credentials for guest users
|
|
3
|
+
*/
|
|
4
|
+
export interface GuestCredentials {
|
|
5
|
+
authToken: string,
|
|
6
|
+
guestToken: string
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @summary Stores the credentials for authenticated/logged in users
|
|
11
|
+
*/
|
|
12
|
+
export interface AuthCredentials {
|
|
13
|
+
authToken: string,
|
|
14
|
+
csrfToken: string,
|
|
15
|
+
cookie: string
|
|
16
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary Stores all the different type of http requests
|
|
3
|
+
*/
|
|
4
|
+
export enum HttpMethods {
|
|
5
|
+
POST = "POST",
|
|
6
|
+
GET = "GET"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @summary Stores the different types of http status codes
|
|
11
|
+
*/
|
|
12
|
+
export enum HttpStatus {
|
|
13
|
+
BadRequest = 400,
|
|
14
|
+
Unauthorized = 401,
|
|
15
|
+
Forbidden = 403,
|
|
16
|
+
NotFound = 404,
|
|
17
|
+
MethodNotAllowed = 405,
|
|
18
|
+
RequestTimeout = 408,
|
|
19
|
+
TooManyRequests = 429,
|
|
20
|
+
InternalServerError = 500,
|
|
21
|
+
BadGateway = 502,
|
|
22
|
+
ServiceUnavailable = 503
|
|
23
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SERVICES
|
|
2
|
+
import { TweetService } from "../services/data/TweetService";
|
|
3
|
+
import { UserAccountService } from "../services/data/UserAccountService";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @summary Stores the cursor to the batch of data
|
|
7
|
+
*/
|
|
8
|
+
export class Cursor {
|
|
9
|
+
// MEMBER DATA
|
|
10
|
+
value: string; // To store the cursor to next batch of data
|
|
11
|
+
|
|
12
|
+
// MEMBER DATA
|
|
13
|
+
/**
|
|
14
|
+
* @summary Initializes a new cursor from the given cursor string
|
|
15
|
+
* @param cursorStr The string representation of the cursor
|
|
16
|
+
*/
|
|
17
|
+
constructor(cursorStr: string) {
|
|
18
|
+
this.value = cursorStr;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @summary Stores cursored data that is returned by services
|
|
24
|
+
*/
|
|
25
|
+
export interface CursoredData<Type> {
|
|
26
|
+
list: Type[]; // To store the list data
|
|
27
|
+
next: Cursor; // To store the information about cursor to the next batch
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @summary Stores the data context from where data is to be fetched
|
|
32
|
+
*/
|
|
33
|
+
export interface DataContext {
|
|
34
|
+
users: UserAccountService, // To store the source for fetching user account data
|
|
35
|
+
tweets: TweetService // To store the source for fetching tweet data
|
|
36
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// This file contains various objects related to handling of Tweets made by a user
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @summary Stores the filter to be used for fetching tweets from TwitterAPI
|
|
5
|
+
*/
|
|
6
|
+
export interface TweetFilter {
|
|
7
|
+
words?: string[]; // To store the list of words to search
|
|
8
|
+
hashtags?: string[]; // To store the list of hashtags to seach
|
|
9
|
+
fromUsers?: string[]; // To store the list of users who made the tweet
|
|
10
|
+
toUsers?: string[]; // To store the list of users to whom the tweet was meant for
|
|
11
|
+
mentions?: string[]; // To store the list of mentioned users
|
|
12
|
+
startDate?: string; // To store the beginning date to search tweets
|
|
13
|
+
endDate?: string; // To store the ending date to search tweets
|
|
14
|
+
quoted?: string; // To store the id of the tweet which is quoted
|
|
15
|
+
links?: boolean; // To store whether to fetch link tweets or not
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @summary Stores the different types of tweet elements like urls, media, mentions, hashtags, etc
|
|
20
|
+
*/
|
|
21
|
+
export interface TweetEntities {
|
|
22
|
+
hashtags: string[]; // To store a list of hashtags used
|
|
23
|
+
urls: string[]; // To store a list of urls mentioned
|
|
24
|
+
mentionedUsers: string[]; // To store a list of users mentioned
|
|
25
|
+
media: string[]; // To store urls to various media files
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @summary Stores a single tweet
|
|
30
|
+
*/
|
|
31
|
+
export interface Tweet {
|
|
32
|
+
id: string; // To store the conversation id
|
|
33
|
+
tweetBy: string; // To store the rest id of the user who made the tweet
|
|
34
|
+
createdAt: string; // To store the time when the tweet was created
|
|
35
|
+
entities: TweetEntities; // To store additional tweet entities
|
|
36
|
+
quoted: string; // To store the id of the tweet quote (if any)
|
|
37
|
+
fullText: string; // To store the full text in the tweet
|
|
38
|
+
replyTo: string; // To store the id of the tweet to which this was a reply
|
|
39
|
+
lang: string; // To store the language used in the tweet
|
|
40
|
+
quoteCount: number; // To store the number of quotes of the tweet
|
|
41
|
+
replyCount: number; // To store the number of replies to the tweet
|
|
42
|
+
retweetCount: number; // To store the number of retweets
|
|
43
|
+
likeCount: number; // To store the number of likes
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// This file contains various objects for handling data related to User Account
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @summary Stores the complete details of the given user's account
|
|
5
|
+
*/
|
|
6
|
+
export interface User {
|
|
7
|
+
id: string; // To store the internal rest id of user account
|
|
8
|
+
userName: string; // To store the screen name of the user
|
|
9
|
+
fullName: string; // To store the actual name of the user
|
|
10
|
+
createdAt: string; // To store the time when the account was created
|
|
11
|
+
description: string; // To store the account description
|
|
12
|
+
isVerified: boolean ; // To store whether this is a verified account or not
|
|
13
|
+
favouritesCount: number; // To store the number of favourites
|
|
14
|
+
followersCount: number; // To store the number of followers
|
|
15
|
+
followingsCount: number; // To store the number of people followed by this user
|
|
16
|
+
statusesCount: number; // To store the number of status posted by user
|
|
17
|
+
location: string; // To store the user's location
|
|
18
|
+
pinnedTweet: string; // To store the id of tweet that is pinned in the account
|
|
19
|
+
profileBanner: string; // To store the url to the profile's banner
|
|
20
|
+
profileImage: string; // To store the url to the profile's image
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary Collection of different types of validation errors
|
|
3
|
+
*/
|
|
4
|
+
export enum ValidationErrors {
|
|
5
|
+
InvalidTweetFilter = "Atleast one of fromUsers/toUsers/mentions/hashtags/words argument is required",
|
|
6
|
+
NoUserIdentification = "Either userName or id must be given"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @summary Stores all the different type of error messages that are returned by services
|
|
11
|
+
*/
|
|
12
|
+
export enum DataErrors {
|
|
13
|
+
UserNotFound = "An account with given username/id was not found",
|
|
14
|
+
TweetNotFound = "A tweet with the given id was not found",
|
|
15
|
+
NoTweetsFound = "No tweets matching the given criteria found"
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @summary Stores a single raw cookie
|
|
3
|
+
*/
|
|
4
|
+
export default interface Cookie {
|
|
5
|
+
guest_id_marketing: string,
|
|
6
|
+
guest_id_ads: string,
|
|
7
|
+
personalization_id: string,
|
|
8
|
+
guest_id: string,
|
|
9
|
+
gt: string,
|
|
10
|
+
_twitter_sess: string,
|
|
11
|
+
kdt: string,
|
|
12
|
+
auth_token: string,
|
|
13
|
+
ct0: string,
|
|
14
|
+
att: string,
|
|
15
|
+
twid: string
|
|
16
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
export default interface Root {
|
|
2
|
+
data: Data
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface Data {
|
|
6
|
+
favoriters_timeline: FavoritersTimeline
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface FavoritersTimeline {
|
|
10
|
+
timeline: Timeline
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface Timeline {
|
|
14
|
+
instructions: Instruction[]
|
|
15
|
+
responseObjects: ResponseObjects
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Instruction {
|
|
19
|
+
type: string
|
|
20
|
+
entries: Entry[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface Entry {
|
|
24
|
+
entryId: string
|
|
25
|
+
sortIndex: string
|
|
26
|
+
content: Content
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Content {
|
|
30
|
+
entryType: string
|
|
31
|
+
itemContent?: ItemContent
|
|
32
|
+
value?: string
|
|
33
|
+
cursorType?: string
|
|
34
|
+
stopOnEmptyResponse?: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ItemContent {
|
|
38
|
+
itemType: string
|
|
39
|
+
user_results: UserResults
|
|
40
|
+
userDisplayType: string
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface UserResults {
|
|
44
|
+
result: Result
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface Result {
|
|
48
|
+
__typename: string
|
|
49
|
+
id: string
|
|
50
|
+
rest_id: string
|
|
51
|
+
affiliates_highlighted_label: AffiliatesHighlightedLabel
|
|
52
|
+
has_nft_avatar: boolean
|
|
53
|
+
legacy: Legacy
|
|
54
|
+
professional?: Professional
|
|
55
|
+
super_follow_eligible: boolean
|
|
56
|
+
super_followed_by: boolean
|
|
57
|
+
super_following: boolean
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface AffiliatesHighlightedLabel { }
|
|
61
|
+
|
|
62
|
+
export interface Legacy {
|
|
63
|
+
blocked_by: boolean
|
|
64
|
+
blocking: boolean
|
|
65
|
+
can_dm: boolean
|
|
66
|
+
can_media_tag: boolean
|
|
67
|
+
created_at: string
|
|
68
|
+
default_profile: boolean
|
|
69
|
+
default_profile_image: boolean
|
|
70
|
+
description: string
|
|
71
|
+
entities: Entities
|
|
72
|
+
fast_followers_count: number
|
|
73
|
+
favourites_count: number
|
|
74
|
+
follow_request_sent: boolean
|
|
75
|
+
followed_by: boolean
|
|
76
|
+
followers_count: number
|
|
77
|
+
following: boolean
|
|
78
|
+
friends_count: number
|
|
79
|
+
has_custom_timelines: boolean
|
|
80
|
+
is_translator: boolean
|
|
81
|
+
listed_count: number
|
|
82
|
+
location: string
|
|
83
|
+
media_count: number
|
|
84
|
+
muting: boolean
|
|
85
|
+
name: string
|
|
86
|
+
normal_followers_count: number
|
|
87
|
+
notifications: boolean
|
|
88
|
+
pinned_tweet_ids_str: string[]
|
|
89
|
+
possibly_sensitive: boolean
|
|
90
|
+
profile_banner_extensions?: ProfileBannerExtensions
|
|
91
|
+
profile_banner_url?: string
|
|
92
|
+
profile_image_extensions?: ProfileImageExtensions
|
|
93
|
+
profile_image_url_https: string
|
|
94
|
+
profile_interstitial_type: string
|
|
95
|
+
protected: boolean
|
|
96
|
+
screen_name: string
|
|
97
|
+
statuses_count: number
|
|
98
|
+
translator_type: string
|
|
99
|
+
url?: string
|
|
100
|
+
verified: boolean
|
|
101
|
+
want_retweets: boolean
|
|
102
|
+
withheld_in_countries: any[]
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface Entities {
|
|
106
|
+
description: Description
|
|
107
|
+
url?: Url
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface Description {
|
|
111
|
+
urls: any[]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface Url {
|
|
115
|
+
urls: Url2[]
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface Url2 {
|
|
119
|
+
display_url: string
|
|
120
|
+
expanded_url: string
|
|
121
|
+
url: string
|
|
122
|
+
indices: number[]
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface ProfileBannerExtensions {
|
|
126
|
+
mediaColor: MediaColor
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface MediaColor {
|
|
130
|
+
r: R
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface R {
|
|
134
|
+
ok: Ok
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface Ok {
|
|
138
|
+
palette: Palette[]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface Palette {
|
|
142
|
+
percentage: number
|
|
143
|
+
rgb: Rgb
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface Rgb {
|
|
147
|
+
blue: number
|
|
148
|
+
green: number
|
|
149
|
+
red: number
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface ProfileImageExtensions {
|
|
153
|
+
mediaColor: MediaColor2
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface MediaColor2 {
|
|
157
|
+
r: R2
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface R2 {
|
|
161
|
+
ok: Ok2
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface Ok2 {
|
|
165
|
+
palette: Palette2[]
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface Palette2 {
|
|
169
|
+
percentage: number
|
|
170
|
+
rgb: Rgb2
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface Rgb2 {
|
|
174
|
+
blue: number
|
|
175
|
+
green: number
|
|
176
|
+
red: number
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface Professional {
|
|
180
|
+
rest_id: string
|
|
181
|
+
professional_type: string
|
|
182
|
+
category: Category[]
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface Category {
|
|
186
|
+
id: number
|
|
187
|
+
name: string
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface ResponseObjects {
|
|
191
|
+
feedbackActions: any[]
|
|
192
|
+
immediateReactions: any[]
|
|
193
|
+
}
|