rettiwt-api 1.1.8 → 1.3.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/.github/workflows/build-docs.yml +22 -21
- package/.github/workflows/publish-to-npm.yml +29 -0
- package/README.md +52 -40
- package/dist/config/env.d.ts +5 -5
- package/dist/config/env.js +8 -8
- package/dist/enums/Errors.d.ts +21 -20
- package/dist/enums/Errors.js +28 -27
- package/dist/enums/Errors.js.map +1 -1
- package/dist/enums/HTTP.d.ts +17 -17
- package/dist/enums/HTTP.js +22 -22
- package/dist/graphql/enums/Errors.d.ts +21 -21
- package/dist/graphql/enums/Errors.js +28 -28
- package/dist/graphql/queries/RootQuery.d.ts +4 -4
- package/dist/graphql/queries/RootQuery.js +77 -77
- package/dist/graphql/queries/RootQuery.js.map +1 -1
- package/dist/graphql/resolvers/AccountResolver.d.ts +12 -12
- package/dist/graphql/resolvers/AccountResolver.js +83 -83
- package/dist/graphql/resolvers/ResolverBase.d.ts +16 -16
- package/dist/graphql/resolvers/ResolverBase.js +22 -22
- package/dist/graphql/resolvers/TweetResolver.d.ts +46 -46
- package/dist/graphql/resolvers/TweetResolver.js +311 -311
- package/dist/graphql/resolvers/TweetResolver.js.map +1 -1
- package/dist/graphql/resolvers/UserResolver.d.ts +48 -48
- package/dist/graphql/resolvers/UserResolver.js +333 -333
- package/dist/graphql/resolvers/UserResolver.js.map +1 -1
- package/dist/graphql/types/Global.d.ts +4 -4
- package/dist/graphql/types/Global.js +12 -12
- package/dist/graphql/types/TweetTypes.d.ts +4 -4
- package/dist/graphql/types/TweetTypes.js +159 -159
- package/dist/graphql/types/UserTypes.d.ts +3 -3
- package/dist/graphql/types/UserTypes.js +136 -136
- package/dist/graphql/types/UserTypes.js.map +1 -1
- package/dist/index.d.ts +45 -43
- package/dist/index.js +72 -70
- package/dist/index.js.map +1 -1
- package/dist/models/args/TweetListArgs.d.ts +21 -21
- package/dist/models/args/TweetListArgs.js +53 -53
- package/dist/models/args/TweetListArgs.js.map +1 -1
- package/dist/models/args/UserListArgs.d.ts +21 -21
- package/dist/models/args/UserListArgs.js +53 -53
- package/dist/models/args/UserListArgs.js.map +1 -1
- package/dist/models/auth/AuthCookie.d.ts +21 -21
- package/dist/models/auth/AuthCookie.js +32 -32
- package/dist/models/data/CursoredData.d.ts +34 -34
- package/dist/models/data/CursoredData.js +41 -41
- package/dist/models/data/Tweet.d.ts +53 -53
- package/dist/models/data/Tweet.js +103 -103
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +41 -41
- package/dist/models/data/User.js +31 -31
- package/dist/models/data/User.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +75 -75
- package/dist/services/auth/AccountService.d.ts +83 -83
- package/dist/services/auth/AccountService.js +411 -411
- package/dist/services/auth/AuthService.d.ts +31 -31
- package/dist/services/auth/AuthService.js +117 -117
- package/dist/services/data/TweetService.d.ts +60 -74
- package/dist/services/data/TweetService.js +250 -254
- package/dist/services/data/TweetService.js.map +1 -1
- package/dist/services/data/UserService.d.ts +71 -87
- package/dist/services/data/UserService.js +277 -296
- package/dist/services/data/UserService.js.map +1 -1
- package/dist/services/helper/Headers.d.ts +19 -19
- package/dist/services/helper/Headers.js +61 -61
- package/dist/services/helper/Headers.js.map +1 -1
- package/dist/services/helper/Parser.d.ts +22 -28
- package/dist/services/helper/Parser.js +83 -104
- package/dist/services/helper/Parser.js.map +1 -1
- package/dist/services/helper/extractors/Tweets.d.ts +23 -32
- package/dist/services/helper/extractors/Tweets.js +199 -263
- package/dist/services/helper/extractors/Tweets.js.map +1 -1
- package/dist/services/helper/extractors/Users.d.ts +17 -26
- package/dist/services/helper/extractors/Users.js +150 -202
- package/dist/services/helper/extractors/Users.js.map +1 -1
- package/dist/services/helper/payloads/LoginFlows.d.ts +77 -77
- package/dist/services/helper/payloads/LoginFlows.js +91 -91
- package/dist/services/helper/urls/Authentication.d.ts +4 -4
- package/dist/services/helper/urls/Authentication.js +10 -10
- package/dist/services/util/CacheService.d.ts +33 -33
- package/dist/services/util/CacheService.js +95 -95
- package/dist/services/util/FetcherService.d.ts +65 -65
- package/dist/services/util/FetcherService.js +201 -213
- package/dist/services/util/FetcherService.js.map +1 -1
- package/dist/types/Args.d.ts +11 -38
- package/dist/types/Args.js +3 -4
- package/dist/types/Args.js.map +1 -1
- package/dist/types/Authentication.d.ts +55 -55
- package/dist/types/Authentication.js +5 -5
- package/dist/types/Resolvers.d.ts +15 -15
- package/dist/types/Resolvers.js +2 -2
- package/dist/types/Rettiwt.d.ts +16 -16
- package/dist/types/Rettiwt.js +2 -2
- package/dist/types/Service.d.ts +22 -22
- package/dist/types/Service.js +4 -4
- package/dist/types/Tweet.d.ts +46 -46
- package/dist/types/Tweet.js +2 -2
- package/dist/types/User.d.ts +35 -35
- package/dist/types/User.js +2 -2
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +64 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1280 -0
- package/docs/classes/AccountService.html +286 -0
- package/docs/classes/AuthCookie.html +146 -0
- package/docs/classes/AuthService.html +147 -0
- package/docs/classes/CacheService.html +157 -0
- package/docs/classes/Cursor.html +102 -0
- package/docs/classes/CursoredData.html +126 -0
- package/docs/classes/DataValidationError.html +120 -0
- package/docs/classes/FetcherService.html +225 -0
- package/docs/classes/Tweet.html +210 -0
- package/docs/classes/TweetEntities.html +128 -0
- package/docs/classes/TweetFilter.html +223 -0
- package/docs/classes/TweetListArgs.html +118 -0
- package/docs/classes/TweetService.html +319 -0
- package/docs/classes/User.html +230 -0
- package/docs/classes/UserListArgs.html +118 -0
- package/docs/classes/UserService.html +355 -0
- package/docs/enums/HttpMethods.html +74 -0
- package/docs/functions/Rettiwt.html +100 -0
- package/docs/index.html +159 -0
- package/docs/interfaces/IAuthCookie.html +104 -0
- package/docs/interfaces/ICursor.html +77 -0
- package/docs/interfaces/ICursoredData.html +93 -0
- package/docs/interfaces/IDataContext.html +91 -0
- package/docs/interfaces/IDataValidationError.html +109 -0
- package/docs/interfaces/IListArgs.html +87 -0
- package/docs/interfaces/ITweet.html +176 -0
- package/docs/interfaces/ITweetEntities.html +104 -0
- package/docs/interfaces/ITweetFilter.html +158 -0
- package/docs/interfaces/IUser.html +194 -0
- package/docs/modules.html +111 -0
- package/package.json +4 -3
- package/src/enums/Errors.ts +2 -1
- package/src/graphql/queries/RootQuery.ts +1 -1
- package/src/graphql/resolvers/TweetResolver.ts +12 -59
- package/src/graphql/resolvers/UserResolver.ts +4 -4
- package/src/graphql/types/UserTypes.ts +2 -2
- package/src/index.ts +5 -3
- package/src/models/args/TweetListArgs.ts +2 -2
- package/src/models/args/UserListArgs.ts +1 -1
- package/src/models/data/Tweet.ts +3 -3
- package/src/models/data/User.ts +2 -2
- package/src/services/data/TweetService.ts +45 -72
- package/src/services/data/UserService.ts +61 -71
- package/src/services/helper/Headers.ts +34 -34
- package/src/services/helper/Parser.ts +5 -26
- package/src/services/helper/extractors/Tweets.ts +35 -97
- package/src/services/helper/extractors/Users.ts +11 -62
- package/src/services/util/FetcherService.ts +15 -22
- package/src/types/Args.ts +0 -37
- package/Dockerfile +0 -9
- package/dist/Test.d.ts +0 -0
- package/dist/Test.js +0 -2
- package/dist/Test.js.map +0 -1
- package/dist/endpoints/Endpoints.d.ts +0 -14
- package/dist/endpoints/Endpoints.js +0 -20
- package/dist/endpoints/Endpoints.js.map +0 -1
- package/dist/endpoints/Url.d.ts +0 -5
- package/dist/endpoints/Url.js +0 -12
- package/dist/endpoints/Url.js.map +0 -1
- package/dist/enums/Endpoints.d.ts +0 -25
- package/dist/enums/Endpoints.js +0 -31
- package/dist/enums/Endpoints.js.map +0 -1
- package/dist/graphql/types/Errors.d.ts +0 -20
- package/dist/graphql/types/Errors.js +0 -28
- package/dist/graphql/types/Errors.js.map +0 -1
- package/dist/middlewares/Authentication.d.ts +0 -0
- package/dist/middlewares/Authentication.js +0 -2
- package/dist/middlewares/Authentication.js.map +0 -1
- package/dist/models/args/TweetFilter.d.ts +0 -59
- package/dist/models/args/TweetFilter.js +0 -101
- package/dist/models/args/TweetFilter.js.map +0 -1
- package/dist/models/data/DataValidationError.d.ts +0 -18
- package/dist/models/data/DataValidationError.js +0 -21
- package/dist/models/data/DataValidationError.js.map +0 -1
- package/dist/models/data/Errors.d.ts +0 -18
- package/dist/models/data/Errors.js +0 -21
- package/dist/models/data/Errors.js.map +0 -1
- package/dist/models/data/Service.d.ts +0 -33
- package/dist/models/data/Service.js +0 -41
- package/dist/models/data/Service.js.map +0 -1
- package/dist/models/errors/DataValidationError.d.ts +0 -20
- package/dist/models/errors/DataValidationError.js +0 -23
- package/dist/models/errors/DataValidationError.js.map +0 -1
- package/dist/models/graphql/Global.d.ts +0 -4
- package/dist/models/graphql/Global.js +0 -13
- package/dist/models/graphql/Global.js.map +0 -1
- package/dist/models/graphql/TweetTypes.d.ts +0 -6
- package/dist/models/graphql/TweetTypes.js +0 -156
- package/dist/models/graphql/TweetTypes.js.map +0 -1
- package/dist/models/graphql/UserTypes.d.ts +0 -3
- package/dist/models/graphql/UserTypes.js +0 -139
- package/dist/models/graphql/UserTypes.js.map +0 -1
- package/dist/models/query/Variables.d.ts +0 -2
- package/dist/models/query/Variables.js +0 -10
- package/dist/models/query/Variables.js.map +0 -1
- package/dist/queries/RootQuery.d.ts +0 -4
- package/dist/queries/RootQuery.js +0 -70
- package/dist/queries/RootQuery.js.map +0 -1
- package/dist/requests/Url.d.ts +0 -5
- package/dist/requests/Url.js +0 -12
- package/dist/requests/Url.js.map +0 -1
- package/dist/requests/payloads/Variables.d.ts +0 -23
- package/dist/requests/payloads/Variables.js +0 -24
- package/dist/requests/payloads/Variables.js.map +0 -1
- package/dist/resolvers/AccountResolver.d.ts +0 -12
- package/dist/resolvers/AccountResolver.js +0 -84
- package/dist/resolvers/AccountResolver.js.map +0 -1
- package/dist/resolvers/ResolverBase.d.ts +0 -5
- package/dist/resolvers/ResolverBase.js +0 -11
- package/dist/resolvers/ResolverBase.js.map +0 -1
- package/dist/resolvers/TweetResolver.d.ts +0 -54
- package/dist/resolvers/TweetResolver.js +0 -332
- package/dist/resolvers/TweetResolver.js.map +0 -1
- package/dist/resolvers/UserResolver.d.ts +0 -38
- package/dist/resolvers/UserResolver.js +0 -253
- package/dist/resolvers/UserResolver.js.map +0 -1
- package/dist/services/AuthService.d.ts +0 -22
- package/dist/services/AuthService.js +0 -106
- package/dist/services/AuthService.js.map +0 -1
- package/dist/services/CacheService.d.ts +0 -30
- package/dist/services/CacheService.js +0 -93
- package/dist/services/CacheService.js.map +0 -1
- package/dist/services/FetcherService.d.ts +0 -61
- package/dist/services/FetcherService.js +0 -209
- package/dist/services/FetcherService.js.map +0 -1
- package/dist/services/accounts/AccountService.d.ts +0 -65
- package/dist/services/accounts/AccountService.js +0 -336
- package/dist/services/accounts/AccountService.js.map +0 -1
- package/dist/services/accounts/LoginFlows.d.ts +0 -77
- package/dist/services/accounts/LoginFlows.js +0 -92
- package/dist/services/accounts/LoginFlows.js.map +0 -1
- package/dist/services/auth/LoginFlows.d.ts +0 -77
- package/dist/services/auth/LoginFlows.js +0 -92
- package/dist/services/auth/LoginFlows.js.map +0 -1
- package/dist/services/data/TrendService.d.ts +0 -17
- package/dist/services/data/TrendService.js +0 -116
- package/dist/services/data/TrendService.js.map +0 -1
- package/dist/services/data/UserAccountService.d.ts +0 -42
- package/dist/services/data/UserAccountService.js +0 -239
- package/dist/services/data/UserAccountService.js.map +0 -1
- package/dist/services/helper/Deserializers.d.ts +0 -19
- package/dist/services/helper/Deserializers.js +0 -115
- package/dist/services/helper/Deserializers.js.map +0 -1
- package/dist/services/helper/Extractors.d.ts +0 -104
- package/dist/services/helper/Extractors.js +0 -432
- package/dist/services/helper/Extractors.js.map +0 -1
- package/dist/services/helper/Urls.d.ts +0 -85
- package/dist/services/helper/Urls.js +0 -130
- package/dist/services/helper/Urls.js.map +0 -1
- package/dist/services/helper/deserializers/Tweets.d.ts +0 -12
- package/dist/services/helper/deserializers/Tweets.js +0 -92
- package/dist/services/helper/deserializers/Tweets.js.map +0 -1
- package/dist/services/helper/deserializers/Users.d.ts +0 -7
- package/dist/services/helper/deserializers/Users.js +0 -27
- package/dist/services/helper/deserializers/Users.js.map +0 -1
- package/dist/services/helper/extractors/Trends.d.ts +0 -3
- package/dist/services/helper/extractors/Trends.js +0 -51
- package/dist/services/helper/extractors/Trends.js.map +0 -1
- package/dist/services/helper/urls/Trends.d.ts +0 -7
- package/dist/services/helper/urls/Trends.js +0 -13
- package/dist/services/helper/urls/Trends.js.map +0 -1
- package/dist/services/helper/urls/Tweets.d.ts +0 -32
- package/dist/services/helper/urls/Tweets.js +0 -51
- package/dist/services/helper/urls/Tweets.js.map +0 -1
- package/dist/services/helper/urls/Users.d.ts +0 -38
- package/dist/services/helper/urls/Users.js +0 -76
- package/dist/services/helper/urls/Users.js.map +0 -1
- package/dist/types/HTTP.d.ts +0 -17
- package/dist/types/HTTP.js +0 -23
- package/dist/types/HTTP.js.map +0 -1
- package/dist/types/Query.d.ts +0 -80
- package/dist/types/Query.js +0 -3
- package/dist/types/Query.js.map +0 -1
- package/dist/types/Trends.d.ts +0 -50
- package/dist/types/Trends.js +0 -3
- package/dist/types/Trends.js.map +0 -1
- package/dist/types/UserAccount.d.ts +0 -19
- package/dist/types/UserAccount.js +0 -4
- package/dist/types/UserAccount.js.map +0 -1
- package/dist/types/args/TweetFilter.d.ts +0 -54
- package/dist/types/args/TweetFilter.js +0 -96
- package/dist/types/args/TweetFilter.js.map +0 -1
- package/dist/types/args/TweetListArg.d.ts +0 -10
- package/dist/types/args/TweetListArg.js +0 -42
- package/dist/types/args/TweetListArg.js.map +0 -1
- package/dist/types/args/TweetListArgs.d.ts +0 -20
- package/dist/types/args/TweetListArgs.js +0 -52
- package/dist/types/args/TweetListArgs.js.map +0 -1
- package/dist/types/args/UserListArgs.d.ts +0 -16
- package/dist/types/args/UserListArgs.js +0 -48
- package/dist/types/args/UserListArgs.js.map +0 -1
- package/dist/types/data/Errors.d.ts +0 -35
- package/dist/types/data/Errors.js +0 -45
- package/dist/types/data/Errors.js.map +0 -1
- package/dist/types/data/Service.d.ts +0 -43
- package/dist/types/data/Service.js +0 -22
- package/dist/types/data/Service.js.map +0 -1
- package/dist/types/data/Tweet.d.ts +0 -98
- package/dist/types/data/Tweet.js +0 -4
- package/dist/types/data/Tweet.js.map +0 -1
- package/dist/types/data/TweetFilter.d.ts +0 -49
- package/dist/types/data/TweetFilter.js +0 -63
- package/dist/types/data/TweetFilter.js.map +0 -1
- package/dist/types/data/User.d.ts +0 -38
- package/dist/types/data/User.js +0 -3
- package/dist/types/data/User.js.map +0 -1
- package/dist/types/graphql/Errors.d.ts +0 -15
- package/dist/types/graphql/Errors.js +0 -23
- package/dist/types/graphql/Errors.js.map +0 -1
- package/dist/types/interfaces/Args.d.ts +0 -38
- package/dist/types/interfaces/Args.js +0 -5
- package/dist/types/interfaces/Args.js.map +0 -1
- package/dist/types/interfaces/Authentication.d.ts +0 -40
- package/dist/types/interfaces/Authentication.js +0 -5
- package/dist/types/interfaces/Authentication.js.map +0 -1
- package/dist/types/interfaces/Resolvers.d.ts +0 -14
- package/dist/types/interfaces/Resolvers.js +0 -3
- package/dist/types/interfaces/Resolvers.js.map +0 -1
- package/dist/types/interfaces/Rettiwt.d.ts +0 -16
- package/dist/types/interfaces/Rettiwt.js +0 -3
- package/dist/types/interfaces/Rettiwt.js.map +0 -1
- package/dist/types/interfaces/Service.d.ts +0 -13
- package/dist/types/interfaces/Service.js +0 -3
- package/dist/types/interfaces/Service.js.map +0 -1
- package/dist/types/interfaces/Services.d.ts +0 -13
- package/dist/types/interfaces/Services.js +0 -3
- package/dist/types/interfaces/Services.js.map +0 -1
- package/dist/types/interfaces/Tweet.d.ts +0 -46
- package/dist/types/interfaces/Tweet.js +0 -3
- package/dist/types/interfaces/Tweet.js.map +0 -1
- package/dist/types/interfaces/TweetFilter.d.ts +0 -0
- package/dist/types/interfaces/TweetFilter.js +0 -2
- package/dist/types/interfaces/TweetFilter.js.map +0 -1
- package/dist/types/interfaces/User.d.ts +0 -35
- package/dist/types/interfaces/User.js +0 -3
- package/dist/types/interfaces/User.js.map +0 -1
- package/dist/types/raw/auth/Cookie.d.ts +0 -16
- package/dist/types/raw/auth/Cookie.js +0 -3
- package/dist/types/raw/auth/Cookie.js.map +0 -1
- package/dist/types/raw/data/tweet/Favouriters.d.ts +0 -164
- package/dist/types/raw/data/tweet/Favouriters.js +0 -3
- package/dist/types/raw/data/tweet/Favouriters.js.map +0 -1
- package/dist/types/raw/data/tweet/Retweeters.d.ts +0 -171
- package/dist/types/raw/data/tweet/Retweeters.js +0 -3
- package/dist/types/raw/data/tweet/Retweeters.js.map +0 -1
- package/dist/types/raw/data/tweet/Tweet.d.ts +0 -746
- package/dist/types/raw/data/tweet/Tweet.js +0 -3
- package/dist/types/raw/data/tweet/Tweet.js.map +0 -1
- package/dist/types/raw/data/tweet/Tweets.d.ts +0 -386
- package/dist/types/raw/data/tweet/Tweets.js +0 -3
- package/dist/types/raw/data/tweet/Tweets.js.map +0 -1
- package/dist/types/raw/data/user/Followers.d.ts +0 -176
- package/dist/types/raw/data/user/Followers.js +0 -3
- package/dist/types/raw/data/user/Followers.js.map +0 -1
- package/dist/types/raw/data/user/Following.d.ts +0 -176
- package/dist/types/raw/data/user/Following.js +0 -3
- package/dist/types/raw/data/user/Following.js.map +0 -1
- package/dist/types/raw/data/user/Likes.d.ts +0 -1059
- package/dist/types/raw/data/user/Likes.js +0 -3
- package/dist/types/raw/data/user/Likes.js.map +0 -1
- package/dist/types/raw/data/user/User.d.ts +0 -117
- package/dist/types/raw/data/user/User.js +0 -3
- package/dist/types/raw/data/user/User.js.map +0 -1
- package/dist/types/raw/general/Trends.d.ts +0 -324
- package/dist/types/raw/general/Trends.js +0 -3
- package/dist/types/raw/general/Trends.js.map +0 -1
- package/dist/types/raw/query/tweet/Details.d.ts +0 -80
- package/dist/types/raw/query/tweet/Details.js +0 -5
- package/dist/types/raw/query/tweet/Details.js.map +0 -1
- package/dist/types/raw/query/tweet/Engagements.d.ts +0 -29
- package/dist/types/raw/query/tweet/Engagements.js +0 -3
- package/dist/types/raw/query/tweet/Engagements.js.map +0 -1
- package/dist/types/raw/query/tweet/Likes.d.ts +0 -29
- package/dist/types/raw/query/tweet/Likes.js +0 -3
- package/dist/types/raw/query/tweet/Likes.js.map +0 -1
- package/dist/types/raw/query/tweet/Retweets.d.ts +0 -29
- package/dist/types/raw/query/tweet/Retweets.js +0 -3
- package/dist/types/raw/query/tweet/Retweets.js.map +0 -1
- package/dist/types/raw/query/tweet/Search.d.ts +0 -40
- package/dist/types/raw/query/tweet/Search.js +0 -3
- package/dist/types/raw/query/tweet/Search.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetDetails.d.ts +0 -34
- package/dist/types/raw/query/tweet/TweetDetails.js +0 -5
- package/dist/types/raw/query/tweet/TweetDetails.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetLike.d.ts +0 -29
- package/dist/types/raw/query/tweet/TweetLike.js +0 -3
- package/dist/types/raw/query/tweet/TweetLike.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetLikes.d.ts +0 -29
- package/dist/types/raw/query/tweet/TweetLikes.js +0 -3
- package/dist/types/raw/query/tweet/TweetLikes.js.map +0 -1
- package/dist/types/raw/query/tweet/TweetRetweets.d.ts +0 -0
- package/dist/types/raw/query/tweet/TweetRetweets.js +0 -2
- package/dist/types/raw/query/tweet/TweetRetweets.js.map +0 -1
- package/dist/types/raw/query/user/Details.d.ts +0 -34
- package/dist/types/raw/query/user/Details.js +0 -3
- package/dist/types/raw/query/user/Details.js.map +0 -1
- package/dist/types/raw/tweet/Favouriters.d.ts +0 -164
- package/dist/types/raw/tweet/Favouriters.js +0 -3
- package/dist/types/raw/tweet/Favouriters.js.map +0 -1
- package/dist/types/raw/tweet/Retweeters.d.ts +0 -171
- package/dist/types/raw/tweet/Retweeters.js +0 -3
- package/dist/types/raw/tweet/Retweeters.js.map +0 -1
- package/dist/types/raw/tweet/Tweet.d.ts +0 -746
- package/dist/types/raw/tweet/Tweet.js +0 -3
- package/dist/types/raw/tweet/Tweet.js.map +0 -1
- package/dist/types/raw/tweet/Tweets.d.ts +0 -386
- package/dist/types/raw/tweet/Tweets.js +0 -3
- package/dist/types/raw/tweet/Tweets.js.map +0 -1
- package/dist/types/raw/user/Followers.d.ts +0 -176
- package/dist/types/raw/user/Followers.js +0 -3
- package/dist/types/raw/user/Followers.js.map +0 -1
- package/dist/types/raw/user/Following.d.ts +0 -176
- package/dist/types/raw/user/Following.js +0 -3
- package/dist/types/raw/user/Following.js.map +0 -1
- package/dist/types/raw/user/Likes.d.ts +0 -1059
- package/dist/types/raw/user/Likes.js +0 -3
- package/dist/types/raw/user/Likes.js.map +0 -1
- package/dist/types/raw/user/Tweets.d.ts +0 -1512
- package/dist/types/raw/user/Tweets.js +0 -3
- package/dist/types/raw/user/Tweets.js.map +0 -1
- package/dist/types/raw/user/User.d.ts +0 -117
- package/dist/types/raw/user/User.js +0 -3
- package/dist/types/raw/user/User.js.map +0 -1
- package/dist/types/services/args/TweetFilter.d.ts +0 -50
- package/dist/types/services/args/TweetFilter.js +0 -76
- package/dist/types/services/args/TweetFilter.js.map +0 -1
- package/src/models/args/TweetFilter.ts +0 -119
- package/src/models/errors/DataValidationError.ts +0 -29
- package/src/services/helper/urls/Tweets.ts +0 -46
- package/src/services/helper/urls/Users.ts +0 -78
- package/src/types/raw/tweet/Favouriters.ts +0 -193
- package/src/types/raw/tweet/Retweeters.ts +0 -201
- package/src/types/raw/tweet/Tweet.ts +0 -882
- package/src/types/raw/tweet/Tweets.ts +0 -444
- package/src/types/raw/user/Followers.ts +0 -208
- package/src/types/raw/user/Following.ts +0 -208
- package/src/types/raw/user/Likes.ts +0 -1247
- package/src/types/raw/user/Tweets.ts +0 -1747
- package/src/types/raw/user/User.ts +0 -135
|
@@ -8,20 +8,20 @@ import { IGuestCredentials, IAuthCredentials } from '../../types/Authentication'
|
|
|
8
8
|
* @returns The header required for making authorized HTTP requests
|
|
9
9
|
*/
|
|
10
10
|
export function authorizedHeader(authCred: IAuthCredentials): any {
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
return {
|
|
12
|
+
'sec-ch-ua': '"Not_A Brand";v="99", "Microsoft Edge";v="109", "Chromium";v="109"',
|
|
13
|
+
'x-twitter-client-language': 'en',
|
|
14
|
+
'x-csrf-token': authCred.csrfToken,
|
|
15
|
+
'sec-ch-ua-mobile': '?0',
|
|
16
|
+
'authorization': authCred.authToken,
|
|
17
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.61',
|
|
18
|
+
'x-twitter-auth-type': 'OAuth2Session',
|
|
19
|
+
'x-twitter-active-user': 'yes',
|
|
20
|
+
'sec-ch-ua-platform': '"Windows"',
|
|
21
|
+
'Accept': '*/*',
|
|
22
|
+
'host': 'twitter.com',
|
|
23
|
+
'Cookie': authCred.cookie
|
|
24
|
+
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -29,12 +29,12 @@ export function authorizedHeader(authCred: IAuthCredentials): any {
|
|
|
29
29
|
* @returns The header requred for making guest HTTP requests
|
|
30
30
|
*/
|
|
31
31
|
export function guestHeader(guestCred: IGuestCredentials): any {
|
|
32
|
-
return
|
|
33
|
-
'Accept: */*',
|
|
34
|
-
|
|
35
|
-
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.70',
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
return {
|
|
33
|
+
'Accept': '*/*',
|
|
34
|
+
'authorization': guestCred.authToken,
|
|
35
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.70',
|
|
36
|
+
'x-guest-token': guestCred.guestToken
|
|
37
|
+
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
@@ -43,18 +43,18 @@ export function guestHeader(guestCred: IGuestCredentials): any {
|
|
|
43
43
|
* @returns The header for making HTTP request for logging in
|
|
44
44
|
*/
|
|
45
45
|
export function loginHeader(guestCred: IGuestCredentials, cookie: string): any {
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
return {
|
|
47
|
+
'sec-ch-ua': '"Not_A Brand";v="99", "Microsoft Edge";v="109", "Chromium";v="109"',
|
|
48
|
+
'x-twitter-client-language': 'en',
|
|
49
|
+
'sec-ch-ua-mobile': '?0',
|
|
50
|
+
'authorization': guestCred.authToken,
|
|
51
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.78',
|
|
52
|
+
'content-type': 'application/json',
|
|
53
|
+
'x-guest-token': guestCred.guestToken,
|
|
54
|
+
'x-twitter-active-user': 'yes',
|
|
55
|
+
'sec-ch-ua-platform': '"Windows"',
|
|
56
|
+
'Accept': '*/*',
|
|
57
|
+
'host': 'twitter.com',
|
|
58
|
+
'Cookie': cookie
|
|
59
|
+
};
|
|
60
60
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { ITweetFilter } from '
|
|
1
|
+
// PACKAGE
|
|
2
|
+
import { ITweetFilter } from 'rettiwt-core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @returns Whether the given json object is empty or not
|
|
@@ -7,7 +7,7 @@ import { ITweetFilter } from '../../types/Args';
|
|
|
7
7
|
*/
|
|
8
8
|
export function isJSONEmpty(data: any): boolean {
|
|
9
9
|
// If the JSON has any keys, it's not empty
|
|
10
|
-
if(Object.keys(data).length == 0) {
|
|
10
|
+
if (Object.keys(data).length == 0) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
13
|
// Else, it's empty
|
|
@@ -78,33 +78,12 @@ export function dataToList(data: any | any[]): any[] {
|
|
|
78
78
|
*/
|
|
79
79
|
export function normalizeText(text: string): string {
|
|
80
80
|
let normalizedText: string = ''; // To store the normalized text
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
// Removing unnecessary full stops, and other characters
|
|
83
83
|
normalizedText = text.replace(/\n/g, '.').replace(/[.]+[\s+.\s+]+/g, '. ');
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
// Adding full-stop to the end if does not exist already
|
|
86
86
|
normalizedText = normalizedText.endsWith('.') ? normalizedText : (normalizedText + '.');
|
|
87
87
|
|
|
88
88
|
return normalizedText;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @param filter The tweet filter to use for getting filtered tweets
|
|
93
|
-
* @returns The same tweet filter, in a URL query format string
|
|
94
|
-
*/
|
|
95
|
-
export function toQueryString(filter: ITweetFilter): string {
|
|
96
|
-
// Concatenating the input filter arguments to a URL query formatted string
|
|
97
|
-
return [
|
|
98
|
-
filter.words ? filter.words.join(' ') : '',
|
|
99
|
-
filter.hashtags ? `(${filter.hashtags.map(hashtag => '#' + hashtag).join(' OR ')})` : '',
|
|
100
|
-
filter.fromUsers ? `(${filter.fromUsers.map(user => `from:${user}`).join(' OR ')})` : '',
|
|
101
|
-
filter.toUsers ? `(${filter.toUsers.map(user => `to:${user}`).join(' OR ')})` : '',
|
|
102
|
-
filter.mentions ? `(${filter.mentions.map(mention => '@' + mention).join(' OR ')})` : '',
|
|
103
|
-
filter.startDate ? `since:${filter.startDate}` : '',
|
|
104
|
-
filter.endDate ? `until:${filter.endDate}` : '',
|
|
105
|
-
filter.sinceId ? `since_id:${filter.sinceId}` : '',
|
|
106
|
-
filter.quoted ? `quoted_tweet_id:${filter.quoted}` : ''
|
|
107
|
-
]
|
|
108
|
-
.filter(item => item !== '()' && item !== '')
|
|
109
|
-
.join(' ') + (!filter.links ? ' -filter:links' : '');
|
|
110
89
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
// PACKAGE
|
|
2
|
+
import {
|
|
3
|
+
ITweetSearchResponse,
|
|
4
|
+
ITweetDetailsResponse,
|
|
5
|
+
ITweetFavoritersResponse,
|
|
6
|
+
ITweetRetweetersResponse,
|
|
7
|
+
} from 'rettiwt-core';
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
// TYPES
|
|
2
11
|
import { IDataExtract } from '../../../types/Resolvers';
|
|
3
12
|
import { DataErrors } from '../../../enums/Errors';
|
|
4
|
-
import RawTweet from '../../../types/raw/tweet/Tweet';
|
|
5
|
-
import RawTweets from '../../../types/raw/tweet/Tweets';
|
|
6
|
-
import RawRetweeters from '../../../types/raw/tweet/Retweeters';
|
|
7
|
-
import RawLikers from '../../../types/raw/tweet/Favouriters';
|
|
8
13
|
|
|
9
14
|
// PARSERS
|
|
10
15
|
import * as Parsers from '../Parser';
|
|
@@ -13,39 +18,35 @@ import * as Parsers from '../Parser';
|
|
|
13
18
|
* @returns The raw tweets data formatted and sorted into required and additional data
|
|
14
19
|
* @param res The raw response received from TwitterAPI
|
|
15
20
|
*/
|
|
16
|
-
export function extractTweets(res:
|
|
21
|
+
export function extractTweets(res: ITweetSearchResponse): IDataExtract {
|
|
17
22
|
let required: any[] = []; // To store the reqruied raw data
|
|
18
23
|
let cursor: string = ''; // To store the cursor to next batch
|
|
19
24
|
let users: any[] = []; // To store additional user data
|
|
20
25
|
let tweets: any[] = []; // To store additional tweet data
|
|
21
26
|
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
let dataUsers = res.globalObjects.users;
|
|
27
|
-
|
|
28
|
-
// If tweets found
|
|
29
|
-
if (!Parsers.isJSONEmpty(dataTweets)) {
|
|
30
|
-
// Destructuring the list of tweets
|
|
31
|
-
for (let key of Object.keys(dataTweets)) {
|
|
32
|
-
required.push({ rest_id: dataTweets[key].id_str, legacy: dataTweets[key] });
|
|
33
|
-
tweets.push({ rest_id: dataTweets[key].id_str, legacy: dataTweets[key] });
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Destructuring the list of users
|
|
37
|
-
for (let key of Object.keys(dataUsers)) {
|
|
38
|
-
users.push({ rest_id: dataUsers[key].id_str, legacy: dataUsers[key] });
|
|
39
|
-
}
|
|
27
|
+
// If tweet does not exist
|
|
28
|
+
if (Parsers.isJSONEmpty(res.data.search_by_raw_query)) {
|
|
29
|
+
throw new Error(DataErrors.NoMatchingTweetsFound);
|
|
30
|
+
}
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
// If tweets
|
|
33
|
+
if (res.data.search_by_raw_query.search_timeline.timeline.instructions.length) {
|
|
34
|
+
// Destructuring raw list of tweets
|
|
35
|
+
res.data.search_by_raw_query.search_timeline.timeline.instructions.filter(item => item.type === 'TimelineAddEntries')[0].entries?.forEach(entry => {
|
|
36
|
+
// If entry is of type tweet and tweet exists
|
|
37
|
+
if (entry.entryId.includes('tweet') && entry.content.itemContent?.tweet_results.result.__typename === 'Tweet') {
|
|
38
|
+
required.push(entry.content.itemContent.tweet_results.result);
|
|
39
|
+
users.push(entry.content.itemContent.tweet_results.result.core?.user_results.result);
|
|
40
|
+
tweets.push(entry.content.itemContent.tweet_results.result);
|
|
41
|
+
}
|
|
42
|
+
// If entry is of type cursor and cursor exists
|
|
43
|
+
else if (entry.entryId.includes('cursor-bottom')) {
|
|
44
|
+
cursor = entry.content.value ?? '';
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
// If cursor not found in 'TimelineAddEntries', getting cursor from 'TimlineReplaceEntry'
|
|
48
|
+
if (!cursor) {
|
|
49
|
+
cursor = res.data.search_by_raw_query.search_timeline.timeline.instructions.filter(item => item.entry_id_to_replace?.includes('cursor-bottom'))[0].entry?.content.value ?? '';
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -63,7 +64,7 @@ export function extractTweets(res: RawTweets): IDataExtract {
|
|
|
63
64
|
* @param res The raw response received from TwitterAPI
|
|
64
65
|
* @param tweetId The rest id of the tweet to fetch
|
|
65
66
|
*/
|
|
66
|
-
export function extractTweet(res:
|
|
67
|
+
export function extractTweet(res: ITweetDetailsResponse, tweetId: string): IDataExtract {
|
|
67
68
|
let required: any[] = []; // To store the reqruied raw data
|
|
68
69
|
let cursor: string = ''; // To store the cursor to next batch
|
|
69
70
|
let users: any[] = []; // To store additional user data
|
|
@@ -112,7 +113,7 @@ export function extractTweet(res: RawTweet, tweetId: string): IDataExtract {
|
|
|
112
113
|
* @returns The raw tweet likers data formatted and sorted into required and additional data
|
|
113
114
|
* @param res The raw response received from TwitterAPI
|
|
114
115
|
*/
|
|
115
|
-
export function extractTweetLikers(res:
|
|
116
|
+
export function extractTweetLikers(res: ITweetFavoritersResponse): IDataExtract {
|
|
116
117
|
let required: any[] = []; // To store the reqruied raw data
|
|
117
118
|
let cursor: string = ''; // To store the cursor to next batch
|
|
118
119
|
let users: any[] = []; // To store additional user data
|
|
@@ -152,7 +153,7 @@ export function extractTweetLikers(res: RawLikers): IDataExtract {
|
|
|
152
153
|
* @returns The raw tweet retweeters data formatted and sorted into required and additional data
|
|
153
154
|
* @param res The raw response received from TwitterAPI
|
|
154
155
|
*/
|
|
155
|
-
export function extractTweetRetweeters(res:
|
|
156
|
+
export function extractTweetRetweeters(res: ITweetRetweetersResponse): IDataExtract {
|
|
156
157
|
let required: any[] = []; // To store the reqruied raw data
|
|
157
158
|
let cursor: string = ''; // To store the cursor to next batch
|
|
158
159
|
let users: any[] = []; // To store additional user data
|
|
@@ -179,69 +180,6 @@ export function extractTweetRetweeters(res: RawRetweeters): IDataExtract {
|
|
|
179
180
|
});
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
// Returning the data
|
|
183
|
-
return {
|
|
184
|
-
required: required,
|
|
185
|
-
cursor: cursor,
|
|
186
|
-
users: users,
|
|
187
|
-
tweets: tweets
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* @returns The raw tweet replies data formatted and sorted into required and additional data
|
|
193
|
-
* @param res The raw response received from TwitterAPI
|
|
194
|
-
* @param tweetId The id of the tweet whose replies must be extracted
|
|
195
|
-
*/
|
|
196
|
-
export function extractTweetReplies(res: RawTweet, tweetId: string): IDataExtract {
|
|
197
|
-
let required: any[] = []; // To store the reqruied raw data
|
|
198
|
-
let cursor: string = ''; // To store the cursor to next batch
|
|
199
|
-
let users: any[] = []; // To store additional user data
|
|
200
|
-
let tweets: any[] = []; // To store additional tweet data
|
|
201
|
-
|
|
202
|
-
// If tweet does not exist
|
|
203
|
-
if (Parsers.isJSONEmpty(res.data)) {
|
|
204
|
-
throw new Error(DataErrors.TweetNotFound);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Destructuring the received raw data
|
|
208
|
-
res.data.threaded_conversation_with_injections_v2.instructions.filter(item => item.type === 'TimelineAddEntries')[0].entries?.map(entry => {
|
|
209
|
-
// If entry is of type tweet
|
|
210
|
-
if (entry.entryId.indexOf('tweet') != -1) {
|
|
211
|
-
// If tweet exists
|
|
212
|
-
if (entry.content.itemContent?.tweet_results?.result.__typename === 'Tweet') {
|
|
213
|
-
tweets.push(entry.content.itemContent.tweet_results.result);
|
|
214
|
-
users.push(entry.content.itemContent.tweet_results.result.core.user_results.result);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
// If entry if of type conversation/reply
|
|
218
|
-
else if (entry.entryId.indexOf('conversationthread') != -1) {
|
|
219
|
-
// If tweet exists
|
|
220
|
-
if (entry.content.items?.at(0)?.item.itemContent.tweet_results?.result.__typename === 'Tweet') {
|
|
221
|
-
// Adding the 1st entry, which is a reply, to required list
|
|
222
|
-
required.push(entry.content.items[0].item.itemContent.tweet_results?.result);
|
|
223
|
-
tweets.push(entry.content.items[0].item.itemContent.tweet_results?.result);
|
|
224
|
-
users.push(entry.content.items[0].item.itemContent.tweet_results?.result.core.user_results.result);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Iterating over the rest of the conversation
|
|
228
|
-
entry.content.items?.forEach(item => {
|
|
229
|
-
// If item is of type tweet
|
|
230
|
-
if (item.entryId.indexOf('tweet') != -1) {
|
|
231
|
-
// If tweet exists
|
|
232
|
-
if (item.item.itemContent.tweet_results?.result.__typename === 'Tweet') {
|
|
233
|
-
tweets.push(item.item.itemContent.tweet_results.result);
|
|
234
|
-
users.push(item.item.itemContent.tweet_results.result.core.user_results.result);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
// If entry is of type bottom cursor
|
|
240
|
-
else if (entry.entryId.indexOf('cursor-bottom') != -1) {
|
|
241
|
-
cursor = entry.content.itemContent?.value ?? '';
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
|
|
245
183
|
// Returning the data
|
|
246
184
|
return {
|
|
247
185
|
required: required,
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
// PACKAGE
|
|
2
|
+
import {
|
|
3
|
+
IUserDetailsResponse,
|
|
4
|
+
IUserFollowersResponse,
|
|
5
|
+
IUserFollowingResponse,
|
|
6
|
+
IUserLikesResponse
|
|
7
|
+
} from 'rettiwt-core';
|
|
8
|
+
|
|
1
9
|
// TYPES
|
|
2
10
|
import { IDataExtract } from '../../../types/Resolvers'
|
|
3
11
|
import { DataErrors } from '../../../enums/Errors';
|
|
4
|
-
import RawUser from '../../../types/raw/user/User';
|
|
5
|
-
import RawUserTweets from '../../../types/raw/user/Tweets';
|
|
6
|
-
import RawUserFollowers from '../../../types/raw/user/Followers';
|
|
7
|
-
import RawUserFollowing from '../../../types/raw/user/Following';
|
|
8
|
-
import RawUserLikes from '../../../types/raw/user/Likes';
|
|
9
12
|
|
|
10
13
|
// PARSERS
|
|
11
14
|
import * as Parsers from '../Parser';
|
|
@@ -14,7 +17,7 @@ import * as Parsers from '../Parser';
|
|
|
14
17
|
* @returns The raw user account data formatted and sorted into required and additional data
|
|
15
18
|
* @param res The raw response received from Twitter
|
|
16
19
|
*/
|
|
17
|
-
export function extractUserDetails(res:
|
|
20
|
+
export function extractUserDetails(res: IUserDetailsResponse): IDataExtract {
|
|
18
21
|
let required: any[] = []; // To store the reqruied raw data
|
|
19
22
|
let cursor: string = ''; // To store the cursor to next batch
|
|
20
23
|
let users: any[] = []; // To store additional user data
|
|
@@ -38,65 +41,11 @@ export function extractUserDetails(res: RawUser): IDataExtract {
|
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
43
|
|
|
41
|
-
/**
|
|
42
|
-
* @returns The raw user tweet data formatted and sorted into required and additional data
|
|
43
|
-
* @param res The raw response received from Twitter
|
|
44
|
-
*/
|
|
45
|
-
export function extractUserTweets(res: RawUserTweets): IDataExtract {
|
|
46
|
-
let required: any[] = []; // To store the reqruied raw data
|
|
47
|
-
let cursor: string = ''; // To store the cursor to next batch
|
|
48
|
-
let users: any[] = []; // To store additional user data
|
|
49
|
-
let tweets: any[] = []; // To store additional tweet data
|
|
50
|
-
|
|
51
|
-
// If user does not exist
|
|
52
|
-
if (Parsers.isJSONEmpty(res.data.user)) {
|
|
53
|
-
throw new Error(DataErrors.UserNotFound);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Extracting the raw list
|
|
57
|
-
res.data.user.result.timeline_v2.timeline.instructions.forEach(item => {
|
|
58
|
-
if (item.type === 'TimelineAddEntries') {
|
|
59
|
-
// If no tweets found
|
|
60
|
-
if (item.entries?.length == 2) {
|
|
61
|
-
// Returning the data
|
|
62
|
-
return {
|
|
63
|
-
required: required,
|
|
64
|
-
cursor: cursor,
|
|
65
|
-
users: users,
|
|
66
|
-
tweets: tweets
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Destructuring data
|
|
71
|
-
item.entries.forEach(entry => {
|
|
72
|
-
// If entry is of type tweet and tweet exists
|
|
73
|
-
if (entry.entryId.indexOf('tweet') != -1 && entry.content.itemContent?.tweet_results.result.__typename === 'Tweet') {
|
|
74
|
-
required.push(entry.content.itemContent.tweet_results.result);
|
|
75
|
-
users.push(entry.content.itemContent.tweet_results.result.core.user_results.result);
|
|
76
|
-
tweets.push(entry.content.itemContent.tweet_results.result);
|
|
77
|
-
}
|
|
78
|
-
// If entry is of type cursor
|
|
79
|
-
else if (entry.entryId.indexOf('cursor-bottom') != -1) {
|
|
80
|
-
cursor = entry.content.value ?? '';
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// Returning the data
|
|
87
|
-
return {
|
|
88
|
-
required: required,
|
|
89
|
-
cursor: cursor,
|
|
90
|
-
users: users,
|
|
91
|
-
tweets: tweets
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
44
|
/**
|
|
96
45
|
* @returns The raw user following/followers data formatted and sorted into required and additional data
|
|
97
46
|
* @param res The raw response received from TwitterAPI
|
|
98
47
|
*/
|
|
99
|
-
export function extractUserFollow(res:
|
|
48
|
+
export function extractUserFollow(res: IUserFollowersResponse | IUserFollowingResponse): IDataExtract {
|
|
100
49
|
let required: any[] = []; // To store the reqruied raw data
|
|
101
50
|
let cursor: string = ''; // To store the cursor to next batch
|
|
102
51
|
let users: any[] = []; // To store additional user data
|
|
@@ -149,7 +98,7 @@ export function extractUserFollow(res: RawUserFollowers | RawUserFollowing): IDa
|
|
|
149
98
|
* @returns The raw user likes data formatted and sorted into required and additional data
|
|
150
99
|
* @param res The raw response received from TwitterAPI
|
|
151
100
|
*/
|
|
152
|
-
export function extractUserLikes(res:
|
|
101
|
+
export function extractUserLikes(res: IUserLikesResponse): IDataExtract {
|
|
153
102
|
let required: any[] = []; // To store the reqruied raw data
|
|
154
103
|
let cursor: string = ''; // To store the cursor to next batch
|
|
155
104
|
let users: any[] = []; // To store additional user data
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// PACKAGES
|
|
2
|
-
import {
|
|
2
|
+
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
3
|
+
import { ITweet as IRawTweet, IUser as IRawUser } from 'rettiwt-core';
|
|
3
4
|
|
|
4
5
|
// SERVICES
|
|
5
6
|
import { AuthService } from '../auth/AuthService';
|
|
@@ -9,10 +10,6 @@ import { CacheService } from './CacheService';
|
|
|
9
10
|
import { Tweet } from '../../models/data/Tweet';
|
|
10
11
|
import { User } from '../../models/data/User';
|
|
11
12
|
|
|
12
|
-
// TYPES
|
|
13
|
-
import { Result as RawUser } from '../../types/raw/user/User';
|
|
14
|
-
import { Result as RawTweet } from '../../types/raw/tweet/Tweet';
|
|
15
|
-
|
|
16
13
|
// ENUMS
|
|
17
14
|
import { HttpStatus } from "../../enums/HTTP";
|
|
18
15
|
|
|
@@ -37,7 +34,7 @@ export enum HttpMethods {
|
|
|
37
34
|
export class FetcherService {
|
|
38
35
|
// MEMBER DATA
|
|
39
36
|
/** The authentication service instance. */
|
|
40
|
-
|
|
37
|
+
protected auth: AuthService;
|
|
41
38
|
|
|
42
39
|
/** The caching service instance. */
|
|
43
40
|
private cache: CacheService;
|
|
@@ -64,14 +61,14 @@ export class FetcherService {
|
|
|
64
61
|
*
|
|
65
62
|
* @throws {@link HttpStatus} error, if any HTTP error is found.
|
|
66
63
|
*/
|
|
67
|
-
private handleHTTPError(res:
|
|
64
|
+
private handleHTTPError(res: AxiosResponse): AxiosResponse {
|
|
68
65
|
/**
|
|
69
66
|
* If the status code is not 200 => the HTTP request was not successful. hence throwing error
|
|
70
67
|
*/
|
|
71
|
-
if (res.
|
|
72
|
-
throw new Error(HttpStatus[res.
|
|
68
|
+
if (res.status != 200 && res.status in HttpStatus) {
|
|
69
|
+
throw new Error(HttpStatus[res.status])
|
|
73
70
|
}
|
|
74
|
-
|
|
71
|
+
|
|
75
72
|
return res;
|
|
76
73
|
}
|
|
77
74
|
|
|
@@ -86,22 +83,18 @@ export class FetcherService {
|
|
|
86
83
|
* @param method The HTTP method (from {@link HttpMethods}) to use.
|
|
87
84
|
* @param data The data to be sent along with the request (for POST request).
|
|
88
85
|
*
|
|
89
|
-
* @returns The {@link
|
|
86
|
+
* @returns The {@link AxiosResponse} received.
|
|
90
87
|
*/
|
|
91
|
-
protected async request<DataType>(url: string, authenticate: boolean = true, method: HttpMethods = HttpMethods.GET, data?: any): Promise<
|
|
88
|
+
protected async request<DataType>(url: string, authenticate: boolean = true, method: HttpMethods = HttpMethods.GET, data?: any): Promise<AxiosResponse<DataType>> {
|
|
92
89
|
/**
|
|
93
90
|
* Creating the request configuration based on the params
|
|
94
91
|
*/
|
|
95
|
-
let config:
|
|
92
|
+
let config: AxiosRequestConfig = {
|
|
96
93
|
/**
|
|
97
94
|
* If authorization is required, using the authenticated header, using the authentication credentiials.
|
|
98
95
|
* Else, using the guest header, using the guest credentials.
|
|
99
96
|
*/
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Disabling SSL peer verification because verification causes Error 404 (only while fetching tweets), likely because peer verification fails.
|
|
103
|
-
*/
|
|
104
|
-
sslVerifyPeer: false,
|
|
97
|
+
headers: authenticate ? Headers.authorizedHeader(await this.auth.getAuthCredentials()) : Headers.guestHeader(await this.auth.getGuestCredentials()),
|
|
105
98
|
};
|
|
106
99
|
|
|
107
100
|
/**
|
|
@@ -110,11 +103,11 @@ export class FetcherService {
|
|
|
110
103
|
*/
|
|
111
104
|
// If POST request is to be made
|
|
112
105
|
if (method == HttpMethods.POST) {
|
|
113
|
-
return await
|
|
106
|
+
return await axios.post(url, data, config).then(res => this.handleHTTPError(res));
|
|
114
107
|
}
|
|
115
108
|
// If GET request is to be made
|
|
116
109
|
else {
|
|
117
|
-
return await
|
|
110
|
+
return await axios.get(url, config).then(res => this.handleHTTPError(res));
|
|
118
111
|
}
|
|
119
112
|
}
|
|
120
113
|
|
|
@@ -128,8 +121,8 @@ export class FetcherService {
|
|
|
128
121
|
* The extracted data is in raw form.
|
|
129
122
|
* This raw data is deserialized into the respective known types.
|
|
130
123
|
*/
|
|
131
|
-
let users = data.users.map((user:
|
|
132
|
-
let tweets = data.tweets.map((tweet:
|
|
124
|
+
let users = data.users.map((user: IRawUser) => new User(user));
|
|
125
|
+
let tweets = data.tweets.map((tweet: IRawTweet) => new Tweet(tweet));
|
|
133
126
|
|
|
134
127
|
// Caching the data
|
|
135
128
|
this.cache.write(users);
|
package/src/types/Args.ts
CHANGED
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The filter to be used for fetching tweets from Twitter.
|
|
3
|
-
*
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface ITweetFilter {
|
|
7
|
-
/** The list of words to search. */
|
|
8
|
-
words?: string[];
|
|
9
|
-
|
|
10
|
-
/** The list of hashtags to search. */
|
|
11
|
-
hashtags?: string[];
|
|
12
|
-
|
|
13
|
-
/** The list of usernames whose tweets are to be searched. */
|
|
14
|
-
fromUsers?: string[];
|
|
15
|
-
|
|
16
|
-
/** The list of username to whom the tweets to be searched, are adressed. */
|
|
17
|
-
toUsers?: string[];
|
|
18
|
-
|
|
19
|
-
/** The list of username mentioned in the tweets to search. */
|
|
20
|
-
mentions?: string[];
|
|
21
|
-
|
|
22
|
-
/** The date starting from which tweets are to be searched. */
|
|
23
|
-
startDate?: string;
|
|
24
|
-
|
|
25
|
-
/** The date upto which tweets are to be searched. */
|
|
26
|
-
endDate?: string;
|
|
27
|
-
|
|
28
|
-
/** The id of the tweet, after which the tweets are to be searched. */
|
|
29
|
-
sinceId?: string;
|
|
30
|
-
|
|
31
|
-
/** The id of the tweet which is quoted in the tweets to search. */
|
|
32
|
-
quoted?: string;
|
|
33
|
-
|
|
34
|
-
/** Whether to fetch tweets that are links or not. */
|
|
35
|
-
links?: boolean;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
1
|
/**
|
|
39
2
|
* The arguments for fetching cursored list.
|
|
40
3
|
*
|
package/Dockerfile
DELETED
package/dist/Test.d.ts
DELETED
|
File without changes
|
package/dist/Test.js
DELETED
package/dist/Test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Test.js","sourceRoot":"","sources":["../src/Test.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The different endpoints for detching data from Twitter.
|
|
3
|
-
*/
|
|
4
|
-
export declare enum Endpoints {
|
|
5
|
-
TweetDetails = "/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail",
|
|
6
|
-
TweetLikes = "/graphql/56ZwFC3Vui31fF8IYX8EGA/Favoriters",
|
|
7
|
-
TweetRetweets = "/graphql/Wd7DVeLqMj_JQiTL0tjJwQ/Retweeters",
|
|
8
|
-
TweetSearch = "/2/search/adaptive.json",
|
|
9
|
-
UserDetails = "/graphql/hVhfo_TquFTmgL7gYwf91Q/UserByScreenName",
|
|
10
|
-
UserDetailsById = "/graphql/mi_IjXgFyr41N9zkszPz9w/UserByRestId",
|
|
11
|
-
UserFollowing = "/graphql/mSnjZc5CTm2Z5Lu_i4XsPQ/Following",
|
|
12
|
-
UserFollowers = "/graphql/nwlAnaw7oKXcVLi91ehy7Q/Followers",
|
|
13
|
-
UserLikes = "/graphql/gP4ZKghLd4tpILgS6VudAQ/Likes"
|
|
14
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.Endpoints = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* The different endpoints for detching data from Twitter.
|
|
6
|
-
*/
|
|
7
|
-
var Endpoints;
|
|
8
|
-
(function (Endpoints) {
|
|
9
|
-
Endpoints["TweetDetails"] = "/graphql/lXI2kaM2hgmbf7h42kpxuA/TweetDetail";
|
|
10
|
-
Endpoints["TweetLikes"] = "/graphql/56ZwFC3Vui31fF8IYX8EGA/Favoriters";
|
|
11
|
-
Endpoints["TweetRetweets"] = "/graphql/Wd7DVeLqMj_JQiTL0tjJwQ/Retweeters";
|
|
12
|
-
Endpoints["TweetSearch"] = "/2/search/adaptive.json";
|
|
13
|
-
Endpoints["UserDetails"] = "/graphql/hVhfo_TquFTmgL7gYwf91Q/UserByScreenName";
|
|
14
|
-
Endpoints["UserDetailsById"] = "/graphql/mi_IjXgFyr41N9zkszPz9w/UserByRestId";
|
|
15
|
-
Endpoints["UserFollowing"] = "/graphql/mSnjZc5CTm2Z5Lu_i4XsPQ/Following";
|
|
16
|
-
Endpoints["UserFollowers"] = "/graphql/nwlAnaw7oKXcVLi91ehy7Q/Followers";
|
|
17
|
-
Endpoints["UserLikes"] = "/graphql/gP4ZKghLd4tpILgS6VudAQ/Likes";
|
|
18
|
-
})(Endpoints = exports.Endpoints || (exports.Endpoints = {}));
|
|
19
|
-
;
|
|
20
|
-
//# sourceMappingURL=Endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Endpoints.js","sourceRoot":"","sources":["../../src/endpoints/Endpoints.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,SAUX;AAVD,WAAY,SAAS;IACjB,yEAA4D,CAAA;IAC5D,sEAAyD,CAAA;IACzD,yEAA4D,CAAA;IAC5D,oDAAuC,CAAA;IACvC,6EAAgE,CAAA;IAChE,6EAAgE,CAAA;IAChE,wEAA2D,CAAA;IAC3D,wEAA2D,CAAA;IAC3D,gEAAmD,CAAA;AACvD,CAAC,EAVW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAUpB;AAAA,CAAC"}
|
package/dist/endpoints/Url.d.ts
DELETED
package/dist/endpoints/Url.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.Url = void 0;
|
|
4
|
-
var Url = /** @class */ (function () {
|
|
5
|
-
function Url() {
|
|
6
|
-
/** The base Twitter API url. */
|
|
7
|
-
this.base = 'https://api.twitter.com';
|
|
8
|
-
}
|
|
9
|
-
return Url;
|
|
10
|
-
}());
|
|
11
|
-
exports.Url = Url;
|
|
12
|
-
//# sourceMappingURL=Url.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Url.js","sourceRoot":"","sources":["../../src/endpoints/Url.ts"],"names":[],"mappings":";;;AAAA;IAII;QAHA,gCAAgC;QAChC,SAAI,GAAW,yBAAyB,CAAC;IAIzC,CAAC;IACL,UAAC;AAAD,CAAC,AAPD,IAOC;AAPY,kBAAG"}
|