rettiwt-api 5.0.0-alpha.0 → 5.0.0-alpha.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/.eslintrc.js +2 -3
- package/.github/workflows/documentation.yml +1 -1
- package/.github/workflows/publish-alpha.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/.prettierignore +1 -1
- package/.tool-versions +1 -1
- package/README.md +100 -100
- package/dist/Rettiwt.d.ts +1 -1
- package/dist/Rettiwt.js +15 -8
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.js +8 -11
- package/dist/cli.js.map +1 -1
- package/dist/collections/Extractors.d.ts +1 -0
- package/dist/collections/Extractors.js +38 -69
- package/dist/collections/Extractors.js.map +1 -1
- package/dist/collections/Groups.js +2 -1
- package/dist/collections/Groups.js.map +1 -1
- package/dist/collections/Requests.d.ts +3 -3
- package/dist/collections/Requests.js +36 -35
- package/dist/collections/Requests.js.map +1 -1
- package/dist/commands/List.js +21 -78
- package/dist/commands/List.js.map +1 -1
- package/dist/commands/Tweet.js +185 -370
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/commands/User.js +129 -306
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Authentication.d.ts +18 -0
- package/dist/enums/Authentication.js +24 -0
- package/dist/enums/Authentication.js.map +1 -0
- package/dist/enums/Data.d.ts +12 -0
- package/dist/enums/Data.js +14 -1
- package/dist/enums/Data.js.map +1 -1
- package/dist/enums/Resource.d.ts +1 -0
- package/dist/enums/Resource.js +1 -0
- package/dist/enums/Resource.js.map +1 -1
- package/dist/helper/CliUtils.js +1 -2
- package/dist/helper/CliUtils.js.map +1 -1
- package/dist/helper/JsonUtils.js +6 -11
- package/dist/helper/JsonUtils.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +4 -133
- package/dist/models/args/FetchArgs.js +12 -416
- package/dist/models/args/FetchArgs.js.map +1 -1
- package/dist/models/args/PostArgs.d.ts +16 -101
- package/dist/models/args/PostArgs.js +26 -258
- package/dist/models/args/PostArgs.js.map +1 -1
- package/dist/models/auth/AccountCredential.d.ts +13 -0
- package/dist/models/auth/AccountCredential.js +21 -0
- package/dist/models/auth/AccountCredential.js.map +1 -0
- package/dist/models/auth/AuthCookie.d.ts +19 -0
- package/dist/models/auth/AuthCookie.js +53 -0
- package/dist/models/auth/AuthCookie.js.map +1 -0
- package/dist/models/auth/AuthCredential.d.ts +28 -0
- package/dist/models/auth/AuthCredential.js +76 -0
- package/dist/models/auth/AuthCredential.js.map +1 -0
- package/dist/models/data/CursoredData.d.ts +3 -4
- package/dist/models/data/CursoredData.js +19 -19
- package/dist/models/data/CursoredData.js.map +1 -1
- package/dist/models/data/List.d.ts +2 -8
- package/dist/models/data/List.js +10 -4
- package/dist/models/data/List.js.map +1 -1
- package/dist/models/data/Notification.d.ts +5 -21
- package/dist/models/data/Notification.js +24 -33
- package/dist/models/data/Notification.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +6 -23
- package/dist/models/data/Tweet.js +93 -97
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.d.ts +2 -15
- package/dist/models/data/User.js +33 -23
- package/dist/models/data/User.js.map +1 -1
- package/dist/models/errors/ApiError.js +8 -24
- package/dist/models/errors/ApiError.js.map +1 -1
- package/dist/models/errors/HttpError.js +8 -24
- package/dist/models/errors/HttpError.js.map +1 -1
- package/dist/models/errors/RettiwtError.js +5 -23
- package/dist/models/errors/RettiwtError.js.map +1 -1
- package/dist/models/errors/TimeoutError.js +5 -22
- package/dist/models/errors/TimeoutError.js.map +1 -1
- package/dist/services/{public → internal}/AuthService.d.ts +5 -34
- package/dist/services/internal/AuthService.js +109 -0
- package/dist/services/internal/AuthService.js.map +1 -0
- package/dist/services/internal/ErrorService.js +38 -40
- package/dist/services/internal/ErrorService.js.map +1 -1
- package/dist/services/internal/LogService.d.ts +0 -6
- package/dist/services/internal/LogService.js +12 -32
- package/dist/services/internal/LogService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +5 -3
- package/dist/services/public/FetcherService.js +96 -141
- package/dist/services/public/FetcherService.js.map +1 -1
- package/dist/services/public/ListService.js +31 -100
- package/dist/services/public/ListService.js.map +1 -1
- package/dist/services/public/TweetService.d.ts +29 -4
- package/dist/services/public/TweetService.js +208 -386
- package/dist/services/public/TweetService.js.map +1 -1
- package/dist/services/public/UserService.js +186 -385
- package/dist/services/public/UserService.js.map +1 -1
- package/dist/types/RettiwtConfig.d.ts +8 -0
- package/dist/types/args/FetchArgs.d.ts +59 -0
- package/dist/types/args/FetchArgs.js +3 -0
- package/dist/types/args/FetchArgs.js.map +1 -0
- package/dist/types/args/PostArgs.d.ts +56 -0
- package/dist/types/args/PostArgs.js +3 -0
- package/dist/types/args/PostArgs.js.map +1 -0
- package/dist/types/auth/AccountCredential.d.ts +11 -0
- package/dist/types/auth/AccountCredential.js +3 -0
- package/dist/types/auth/AccountCredential.js.map +1 -0
- package/dist/types/auth/AuthCookie.d.ts +13 -0
- package/dist/types/auth/AuthCookie.js +3 -0
- package/dist/types/auth/AuthCookie.js.map +1 -0
- package/dist/types/auth/AuthCredential.d.ts +21 -0
- package/dist/types/auth/AuthCredential.js +3 -0
- package/dist/types/auth/AuthCredential.js.map +1 -0
- package/dist/types/data/CursoredData.d.ts +25 -0
- package/dist/types/data/CursoredData.js +3 -0
- package/dist/types/data/CursoredData.js.map +1 -0
- package/dist/types/data/List.d.ts +21 -0
- package/dist/types/data/List.js +3 -0
- package/dist/types/data/List.js.map +1 -0
- package/dist/types/data/Notification.d.ts +20 -0
- package/dist/types/data/Notification.js +3 -0
- package/dist/types/data/Notification.js.map +1 -0
- package/dist/types/data/Tweet.d.ts +71 -0
- package/dist/types/data/Tweet.js +3 -0
- package/dist/types/data/Tweet.js.map +1 -0
- package/dist/types/data/User.d.ts +35 -0
- package/dist/types/data/User.js +3 -0
- package/dist/types/data/User.js.map +1 -0
- package/eslint.config.mjs +17 -0
- package/package.json +22 -19
- package/src/Rettiwt.ts +1 -1
- package/src/cli.ts +0 -2
- package/src/collections/Extractors.ts +2 -0
- package/src/collections/Groups.ts +1 -0
- package/src/collections/Requests.ts +37 -36
- package/src/enums/Authentication.ts +19 -0
- package/src/enums/Data.ts +13 -0
- package/src/enums/Resource.ts +1 -0
- package/src/helper/JsonUtils.ts +1 -1
- package/src/index.ts +1 -2
- package/src/models/args/FetchArgs.ts +4 -470
- package/src/models/args/PostArgs.ts +20 -285
- package/src/models/auth/AccountCredential.ts +19 -0
- package/src/models/auth/AuthCookie.ts +56 -0
- package/src/models/auth/AuthCredential.ts +83 -0
- package/src/models/data/CursoredData.ts +12 -9
- package/src/models/data/List.ts +3 -14
- package/src/models/data/Notification.ts +6 -28
- package/src/models/data/Tweet.ts +28 -70
- package/src/models/data/User.ts +5 -31
- package/src/services/{public → internal}/AuthService.ts +28 -55
- package/src/services/internal/LogService.ts +4 -19
- package/src/services/public/FetcherService.ts +18 -8
- package/src/services/public/TweetService.ts +44 -4
- package/src/services/public/UserService.ts +2 -2
- package/src/types/RettiwtConfig.ts +7 -0
- package/src/types/args/FetchArgs.ts +64 -0
- package/src/types/args/PostArgs.ts +62 -0
- package/src/types/auth/AccountCredential.ts +13 -0
- package/src/types/auth/AuthCookie.ts +20 -0
- package/src/types/auth/AuthCredential.ts +26 -0
- package/src/types/data/CursoredData.ts +28 -0
- package/src/types/data/List.ts +27 -0
- package/src/types/data/Notification.ts +26 -0
- package/src/types/data/Tweet.ts +96 -0
- package/src/types/data/User.ts +48 -0
- package/tsconfig.json +7 -5
- package/.eslintignore +0 -3
- package/dist/commands/Auth.d.ts +0 -10
- package/dist/commands/Auth.js +0 -101
- package/dist/commands/Auth.js.map +0 -1
- package/dist/models/errors/DataValidationError.d.ts +0 -30
- package/dist/models/errors/DataValidationError.js +0 -34
- package/dist/models/errors/DataValidationError.js.map +0 -1
- package/dist/services/public/AuthService.js +0 -205
- package/dist/services/public/AuthService.js.map +0 -1
- package/src/commands/Auth.ts +0 -46
- package/src/models/errors/DataValidationError.ts +0 -44
|
@@ -1,31 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TweetMedia = exports.TweetEntities = exports.Tweet = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const rettiwt_core_1 = require("rettiwt-core");
|
|
5
|
+
const Logging_1 = require("../../enums/Logging");
|
|
6
|
+
const JsonUtils_1 = require("../../helper/JsonUtils");
|
|
7
|
+
const LogService_1 = require("../../services/internal/LogService");
|
|
8
|
+
const User_1 = require("./User");
|
|
9
9
|
/**
|
|
10
10
|
* The details of a single tweet.
|
|
11
11
|
*
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
class Tweet {
|
|
15
|
+
bookmarkCount;
|
|
16
|
+
conversationId;
|
|
17
|
+
createdAt;
|
|
18
|
+
entities;
|
|
19
|
+
fullText;
|
|
20
|
+
id;
|
|
21
|
+
lang;
|
|
22
|
+
likeCount;
|
|
23
|
+
media;
|
|
24
|
+
quoteCount;
|
|
25
|
+
quoted;
|
|
26
|
+
replyCount;
|
|
27
|
+
replyTo;
|
|
28
|
+
retweetCount;
|
|
29
|
+
retweetedTweet;
|
|
30
|
+
tweetBy;
|
|
31
|
+
url;
|
|
32
|
+
viewCount;
|
|
15
33
|
/**
|
|
16
34
|
* @param tweet - The raw tweet details.
|
|
17
|
-
* @param response - The raw response
|
|
18
35
|
*/
|
|
19
|
-
|
|
20
|
-
var _a, _b;
|
|
36
|
+
constructor(tweet) {
|
|
21
37
|
this.id = tweet.rest_id;
|
|
38
|
+
this.conversationId = tweet.legacy.conversation_id_str;
|
|
22
39
|
this.createdAt = tweet.legacy.created_at;
|
|
23
40
|
this.tweetBy = new User_1.User(tweet.core.user_results.result);
|
|
24
41
|
this.entities = new TweetEntities(tweet.legacy.entities);
|
|
25
|
-
this.media =
|
|
26
|
-
this.quoted = this.getQuotedTweet(tweet
|
|
42
|
+
this.media = tweet.legacy.extended_entities?.media?.map((media) => new TweetMedia(media));
|
|
43
|
+
this.quoted = this.getQuotedTweet(tweet);
|
|
27
44
|
this.fullText = tweet.note_tweet ? tweet.note_tweet.note_tweet_results.result.text : tweet.legacy.full_text;
|
|
28
|
-
this.replyTo =
|
|
45
|
+
this.replyTo = tweet.legacy.in_reply_to_status_id_str;
|
|
29
46
|
this.lang = tweet.legacy.lang;
|
|
30
47
|
this.quoteCount = tweet.legacy.quote_count;
|
|
31
48
|
this.replyCount = tweet.legacy.reply_count;
|
|
@@ -33,69 +50,55 @@ var Tweet = /** @class */ (function () {
|
|
|
33
50
|
this.likeCount = tweet.legacy.favorite_count;
|
|
34
51
|
this.viewCount = tweet.views.count ? parseInt(tweet.views.count) : 0;
|
|
35
52
|
this.bookmarkCount = tweet.legacy.bookmark_count;
|
|
36
|
-
this.retweetedTweet = this.getRetweetedTweet(tweet
|
|
53
|
+
this.retweetedTweet = this.getRetweetedTweet(tweet);
|
|
54
|
+
this.url = `https://x.com/${this.tweetBy.userName}/status/${this.id}`;
|
|
37
55
|
}
|
|
38
|
-
Tweet.prototype.getParentTweet = function (tweet, response) {
|
|
39
|
-
var _a, _b;
|
|
40
|
-
// Getting parent tweet ID, if any
|
|
41
|
-
var parentTweetId = (_b = (_a = tweet.legacy) === null || _a === void 0 ? void 0 : _a.in_reply_to_status_id_str) !== null && _b !== void 0 ? _b : '';
|
|
42
|
-
// If no parent tweet
|
|
43
|
-
if (parentTweetId.length == 0) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
// Getting the details of parent tweet
|
|
47
|
-
return Tweet.single(response, parentTweetId);
|
|
48
|
-
};
|
|
49
56
|
/**
|
|
50
57
|
* Extract and deserialize the original quoted tweet from the given raw tweet.
|
|
51
58
|
*
|
|
52
59
|
* @param tweet - The raw tweet.
|
|
53
|
-
* @param response - The raw response
|
|
54
60
|
*
|
|
55
61
|
* @returns - The deserialized original quoted tweet.
|
|
56
62
|
*/
|
|
57
|
-
|
|
58
|
-
var _a, _b, _c, _d, _e, _f;
|
|
63
|
+
getQuotedTweet(tweet) {
|
|
59
64
|
// If tweet with limited visibility
|
|
60
65
|
if (tweet.quoted_status_result &&
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return new Tweet(tweet.quoted_status_result.result.tweet
|
|
66
|
+
tweet.quoted_status_result?.result?.__typename == 'TweetWithVisibilityResults' &&
|
|
67
|
+
tweet.quoted_status_result.result?.tweet?.legacy) {
|
|
68
|
+
return new Tweet(tweet.quoted_status_result.result.tweet);
|
|
64
69
|
}
|
|
65
70
|
// If normal tweet
|
|
66
|
-
else if (
|
|
67
|
-
return new Tweet(tweet.quoted_status_result.result
|
|
71
|
+
else if (tweet.quoted_status_result?.result?.rest_id) {
|
|
72
|
+
return new Tweet(tweet.quoted_status_result.result);
|
|
68
73
|
}
|
|
69
74
|
// Else, skip
|
|
70
75
|
else {
|
|
71
76
|
return undefined;
|
|
72
77
|
}
|
|
73
|
-
}
|
|
78
|
+
}
|
|
74
79
|
/**
|
|
75
80
|
* Extract and deserialize the original retweeted tweet from the given raw tweet.
|
|
76
81
|
*
|
|
77
82
|
* @param tweet - The raw tweet.
|
|
78
|
-
* @param response - The raw response
|
|
79
83
|
*
|
|
80
84
|
* @returns - The deserialized original retweeted tweet.
|
|
81
85
|
*/
|
|
82
|
-
|
|
83
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
86
|
+
getRetweetedTweet(tweet) {
|
|
84
87
|
// If retweet with limited visibility
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return new Tweet(tweet.legacy.retweeted_status_result.result.tweet
|
|
88
|
+
if (tweet.legacy?.retweeted_status_result &&
|
|
89
|
+
tweet.legacy?.retweeted_status_result?.result?.__typename == 'TweetWithVisibilityResults' &&
|
|
90
|
+
tweet.legacy?.retweeted_status_result?.result?.tweet?.legacy) {
|
|
91
|
+
return new Tweet(tweet.legacy.retweeted_status_result.result.tweet);
|
|
89
92
|
}
|
|
90
93
|
// If normal tweet
|
|
91
|
-
else if (
|
|
92
|
-
return new Tweet(tweet.legacy.retweeted_status_result.result
|
|
94
|
+
else if (tweet.legacy?.retweeted_status_result?.result?.rest_id) {
|
|
95
|
+
return new Tweet(tweet.legacy.retweeted_status_result.result);
|
|
93
96
|
}
|
|
94
97
|
// Else, skip
|
|
95
98
|
else {
|
|
96
99
|
return undefined;
|
|
97
100
|
}
|
|
98
|
-
}
|
|
101
|
+
}
|
|
99
102
|
/**
|
|
100
103
|
* Extracts and deserializes the list of tweets from the given raw response data.
|
|
101
104
|
*
|
|
@@ -105,37 +108,35 @@ var Tweet = /** @class */ (function () {
|
|
|
105
108
|
*
|
|
106
109
|
* @internal
|
|
107
110
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
var tweets = [];
|
|
111
|
+
static list(response) {
|
|
112
|
+
const tweets = [];
|
|
111
113
|
// Extracting the matching data
|
|
112
|
-
|
|
114
|
+
const extract = (0, JsonUtils_1.findByFilter)(response, '__typename', 'TimelineTweet');
|
|
113
115
|
// Deserializing valid data
|
|
114
|
-
for (
|
|
115
|
-
var item = extract_1[_i];
|
|
116
|
+
for (const item of extract) {
|
|
116
117
|
// If tweet with limited visibility
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
tweets.push(new Tweet(item.tweet_results.result.tweet
|
|
118
|
+
if (item.tweet_results?.result &&
|
|
119
|
+
item.tweet_results?.result?.__typename == 'TweetWithVisibilityResults' &&
|
|
120
|
+
item.tweet_results?.result?.tweet?.legacy) {
|
|
121
|
+
tweets.push(new Tweet(item.tweet_results.result.tweet));
|
|
121
122
|
}
|
|
122
123
|
// If normal tweet
|
|
123
|
-
else if (
|
|
124
|
+
else if (item.tweet_results?.result?.legacy) {
|
|
124
125
|
// Logging
|
|
125
126
|
LogService_1.LogService.log(Logging_1.ELogActions.DESERIALIZE, { id: item.tweet_results.result.rest_id });
|
|
126
|
-
tweets.push(new Tweet(item.tweet_results.result
|
|
127
|
+
tweets.push(new Tweet(item.tweet_results.result));
|
|
127
128
|
}
|
|
128
129
|
// If invalid/unrecognized tweet
|
|
129
130
|
else {
|
|
130
131
|
// Logging
|
|
131
132
|
LogService_1.LogService.log(Logging_1.ELogActions.WARNING, {
|
|
132
133
|
action: Logging_1.ELogActions.DESERIALIZE,
|
|
133
|
-
message:
|
|
134
|
+
message: `Tweet not found, skipping`,
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
return tweets;
|
|
138
|
-
}
|
|
139
|
+
}
|
|
139
140
|
/**
|
|
140
141
|
* Extracts and deserializes a single target tweet from the given raw response data.
|
|
141
142
|
*
|
|
@@ -146,86 +147,82 @@ var Tweet = /** @class */ (function () {
|
|
|
146
147
|
*
|
|
147
148
|
* @internal
|
|
148
149
|
*/
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
static single(response, id) {
|
|
151
|
+
const tweets = [];
|
|
151
152
|
// Extracting the matching data
|
|
152
|
-
|
|
153
|
+
const extract = (0, JsonUtils_1.findByFilter)(response, 'rest_id', id);
|
|
153
154
|
// Deserializing valid data
|
|
154
|
-
for (
|
|
155
|
-
var item = extract_2[_i];
|
|
155
|
+
for (const item of extract) {
|
|
156
156
|
if (item.legacy) {
|
|
157
157
|
// Logging
|
|
158
158
|
LogService_1.LogService.log(Logging_1.ELogActions.DESERIALIZE, { id: item.rest_id });
|
|
159
|
-
tweets.push(new Tweet(item
|
|
159
|
+
tweets.push(new Tweet(item));
|
|
160
160
|
}
|
|
161
161
|
else {
|
|
162
162
|
// Logging
|
|
163
163
|
LogService_1.LogService.log(Logging_1.ELogActions.WARNING, {
|
|
164
164
|
action: Logging_1.ELogActions.DESERIALIZE,
|
|
165
|
-
message:
|
|
165
|
+
message: `Tweet not found, skipping`,
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
return tweets.length ? tweets[0] : undefined;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
}());
|
|
170
|
+
}
|
|
171
|
+
}
|
|
173
172
|
exports.Tweet = Tweet;
|
|
174
173
|
/**
|
|
175
174
|
* The different types parsed entities like urls, media, mentions, hashtags, etc.
|
|
176
175
|
*
|
|
177
176
|
* @public
|
|
178
177
|
*/
|
|
179
|
-
|
|
178
|
+
class TweetEntities {
|
|
179
|
+
/** The list of hashtags mentioned in the tweet. */
|
|
180
|
+
hashtags = [];
|
|
181
|
+
/** The list of IDs of users mentioned in the tweet. */
|
|
182
|
+
mentionedUsers = [];
|
|
183
|
+
/** The list of urls mentioned in the tweet. */
|
|
184
|
+
urls = [];
|
|
180
185
|
/**
|
|
181
186
|
* @param entities - The raw tweet entities.
|
|
182
187
|
*/
|
|
183
|
-
|
|
184
|
-
/** The list of hashtags mentioned in the tweet. */
|
|
185
|
-
this.hashtags = [];
|
|
186
|
-
/** The list of IDs of users mentioned in the tweet. */
|
|
187
|
-
this.mentionedUsers = [];
|
|
188
|
-
/** The list of urls mentioned in the tweet. */
|
|
189
|
-
this.urls = [];
|
|
188
|
+
constructor(entities) {
|
|
190
189
|
// Extracting user mentions
|
|
191
190
|
if (entities.user_mentions) {
|
|
192
|
-
for (
|
|
193
|
-
var user = _a[_i];
|
|
191
|
+
for (const user of entities.user_mentions) {
|
|
194
192
|
this.mentionedUsers.push(user.screen_name);
|
|
195
193
|
}
|
|
196
194
|
}
|
|
197
195
|
// Extracting urls
|
|
198
196
|
if (entities.urls) {
|
|
199
|
-
for (
|
|
200
|
-
var url = _c[_b];
|
|
197
|
+
for (const url of entities.urls) {
|
|
201
198
|
this.urls.push(url.expanded_url);
|
|
202
199
|
}
|
|
203
200
|
}
|
|
204
201
|
// Extracting hashtags
|
|
205
202
|
if (entities.hashtags) {
|
|
206
|
-
for (
|
|
207
|
-
var hashtag = _e[_d];
|
|
203
|
+
for (const hashtag of entities.hashtags) {
|
|
208
204
|
this.hashtags.push(hashtag.text);
|
|
209
205
|
}
|
|
210
206
|
}
|
|
211
207
|
}
|
|
212
|
-
|
|
213
|
-
}());
|
|
208
|
+
}
|
|
214
209
|
exports.TweetEntities = TweetEntities;
|
|
215
210
|
/**
|
|
216
211
|
* The details of a single media content included in a tweet.
|
|
217
212
|
*
|
|
218
213
|
* @public
|
|
219
214
|
*/
|
|
220
|
-
|
|
215
|
+
class TweetMedia {
|
|
216
|
+
/** The thumbnail URL for the video content of the tweet. */
|
|
217
|
+
thumbnailUrl;
|
|
218
|
+
/** The type of media. */
|
|
219
|
+
type;
|
|
220
|
+
/** The direct URL to the media. */
|
|
221
|
+
url = '';
|
|
221
222
|
/**
|
|
222
223
|
* @param media - The raw media details.
|
|
223
224
|
*/
|
|
224
|
-
|
|
225
|
-
var _this = this;
|
|
226
|
-
var _a, _b;
|
|
227
|
-
/** The direct URL to the media. */
|
|
228
|
-
this.url = '';
|
|
225
|
+
constructor(media) {
|
|
229
226
|
this.type = media.type;
|
|
230
227
|
// If the media is a photo
|
|
231
228
|
if (media.type == rettiwt_core_1.EMediaType.PHOTO) {
|
|
@@ -233,25 +230,24 @@ var TweetMedia = /** @class */ (function () {
|
|
|
233
230
|
}
|
|
234
231
|
// If the media is a gif
|
|
235
232
|
else if (media.type == rettiwt_core_1.EMediaType.GIF) {
|
|
236
|
-
this.url =
|
|
233
|
+
this.url = media.video_info?.variants[0].url;
|
|
237
234
|
}
|
|
238
235
|
// If the media is a video
|
|
239
236
|
else {
|
|
240
237
|
this.thumbnailUrl = media.media_url_https;
|
|
241
238
|
/** The highest bitrate of all variants. */
|
|
242
|
-
|
|
239
|
+
let highestRate = 0;
|
|
243
240
|
/**
|
|
244
241
|
* Selecting the URL of the video variant with the highest bitrate.
|
|
245
242
|
*/
|
|
246
|
-
|
|
247
|
-
if (variant.bitrate >
|
|
248
|
-
|
|
249
|
-
|
|
243
|
+
media.video_info?.variants.forEach((variant) => {
|
|
244
|
+
if (variant.bitrate > highestRate) {
|
|
245
|
+
highestRate = variant.bitrate;
|
|
246
|
+
this.url = variant.url;
|
|
250
247
|
}
|
|
251
248
|
});
|
|
252
249
|
}
|
|
253
250
|
}
|
|
254
|
-
|
|
255
|
-
}());
|
|
251
|
+
}
|
|
256
252
|
exports.TweetMedia = TweetMedia;
|
|
257
253
|
//# sourceMappingURL=Tweet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tweet.js","sourceRoot":"","sources":["../../../src/models/data/Tweet.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"Tweet.js","sourceRoot":"","sources":["../../../src/models/data/Tweet.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AAEtB,iDAAkD;AAClD,sDAAsD;AAEtD,mEAAgE;AAIhE,iCAA8B;AAE9B;;;;GAIG;AACH,MAAa,KAAK;IACV,aAAa,CAAS;IACtB,cAAc,CAAS;IACvB,SAAS,CAAS;IAClB,QAAQ,CAAgB;IACxB,QAAQ,CAAS;IACjB,EAAE,CAAS;IACX,IAAI,CAAS;IACb,SAAS,CAAS;IAClB,KAAK,CAAgB;IACrB,UAAU,CAAS;IACnB,MAAM,CAAS;IACf,UAAU,CAAS;IACnB,OAAO,CAAU;IACjB,YAAY,CAAS;IACrB,cAAc,CAAS;IACvB,OAAO,CAAO;IACd,GAAG,CAAS;IACZ,SAAS,CAAS;IAEzB;;OAEG;IACH,YAAmB,KAAgB;QAClC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC;QACvD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,IAAI,WAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACxD,IAA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AC,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC9C,IAAI,OAAO,CAAC,OAAO,GAAG,WAAW,EAAE,CAAC;oBACnC,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;oBAC9B,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;gBACxB,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;CACD;AA1CD,gCA0CC"}
|
|
@@ -1,37 +1,24 @@
|
|
|
1
1
|
import { IUser as IRawUser } from 'rettiwt-core';
|
|
2
|
+
import { IUser } from '../../types/data/User';
|
|
2
3
|
/**
|
|
3
4
|
* The details of a single user.
|
|
4
5
|
*
|
|
5
6
|
* @public
|
|
6
7
|
*/
|
|
7
|
-
export declare class User {
|
|
8
|
-
/** The creation date of user's account. */
|
|
8
|
+
export declare class User implements IUser {
|
|
9
9
|
createdAt: string;
|
|
10
|
-
/** The user's description. */
|
|
11
10
|
description?: string;
|
|
12
|
-
/** The number of followers of the user. */
|
|
13
11
|
followersCount: number;
|
|
14
|
-
/** The number of following of the user. */
|
|
15
12
|
followingsCount: number;
|
|
16
|
-
/** The full name of the user. */
|
|
17
13
|
fullName: string;
|
|
18
|
-
/** The rest id of the user. */
|
|
19
14
|
id: string;
|
|
20
|
-
/** Whether the account is verified or not. */
|
|
21
15
|
isVerified: boolean;
|
|
22
|
-
/** The number of tweets liked by the user. */
|
|
23
16
|
likeCount: number;
|
|
24
|
-
/** The location of user as provided by user. */
|
|
25
17
|
location?: string;
|
|
26
|
-
/** The rest id of the tweet pinned in the user's profile. */
|
|
27
18
|
pinnedTweet?: string;
|
|
28
|
-
/** The url of the profile banner image. */
|
|
29
19
|
profileBanner?: string;
|
|
30
|
-
/** The url of the profile image. */
|
|
31
20
|
profileImage: string;
|
|
32
|
-
/** The number of tweets made by the user. */
|
|
33
21
|
statusesCount: number;
|
|
34
|
-
/** The username/screenname of the user. */
|
|
35
22
|
userName: string;
|
|
36
23
|
/**
|
|
37
24
|
* @param user - The raw user details.
|
package/dist/models/data/User.js
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.User = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const Logging_1 = require("../../enums/Logging");
|
|
5
|
+
const JsonUtils_1 = require("../../helper/JsonUtils");
|
|
6
|
+
const LogService_1 = require("../../services/internal/LogService");
|
|
7
7
|
/**
|
|
8
8
|
* The details of a single user.
|
|
9
9
|
*
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
class User {
|
|
13
|
+
createdAt;
|
|
14
|
+
description;
|
|
15
|
+
followersCount;
|
|
16
|
+
followingsCount;
|
|
17
|
+
fullName;
|
|
18
|
+
id;
|
|
19
|
+
isVerified;
|
|
20
|
+
likeCount;
|
|
21
|
+
location;
|
|
22
|
+
pinnedTweet;
|
|
23
|
+
profileBanner;
|
|
24
|
+
profileImage;
|
|
25
|
+
statusesCount;
|
|
26
|
+
userName;
|
|
13
27
|
/**
|
|
14
28
|
* @param user - The raw user details.
|
|
15
29
|
*/
|
|
16
|
-
|
|
30
|
+
constructor(user) {
|
|
17
31
|
this.id = user.rest_id;
|
|
18
32
|
this.userName = user.legacy.screen_name;
|
|
19
33
|
this.fullName = user.legacy.name;
|
|
@@ -38,15 +52,13 @@ var User = /** @class */ (function () {
|
|
|
38
52
|
*
|
|
39
53
|
* @internal
|
|
40
54
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var users = [];
|
|
55
|
+
static list(response) {
|
|
56
|
+
const users = [];
|
|
44
57
|
// Extracting the matching data
|
|
45
|
-
|
|
58
|
+
const extract = (0, JsonUtils_1.findByFilter)(response, '__typename', 'TimelineUser');
|
|
46
59
|
// Deserializing valid data
|
|
47
|
-
for (
|
|
48
|
-
|
|
49
|
-
if ((_b = (_a = item.user_results) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.legacy) {
|
|
60
|
+
for (const item of extract) {
|
|
61
|
+
if (item.user_results?.result?.legacy) {
|
|
50
62
|
// Logging
|
|
51
63
|
LogService_1.LogService.log(Logging_1.ELogActions.DESERIALIZE, { id: item.user_results.result.rest_id });
|
|
52
64
|
users.push(new User(item.user_results.result));
|
|
@@ -55,12 +67,12 @@ var User = /** @class */ (function () {
|
|
|
55
67
|
// Logging
|
|
56
68
|
LogService_1.LogService.log(Logging_1.ELogActions.WARNING, {
|
|
57
69
|
action: Logging_1.ELogActions.DESERIALIZE,
|
|
58
|
-
message:
|
|
70
|
+
message: `User not found, skipping`,
|
|
59
71
|
});
|
|
60
72
|
}
|
|
61
73
|
}
|
|
62
74
|
return users;
|
|
63
|
-
}
|
|
75
|
+
}
|
|
64
76
|
/**
|
|
65
77
|
* Extracts and deserializes a single target user from the given raw response data.
|
|
66
78
|
*
|
|
@@ -70,13 +82,12 @@ var User = /** @class */ (function () {
|
|
|
70
82
|
*
|
|
71
83
|
* @internal
|
|
72
84
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
static single(response) {
|
|
86
|
+
const users = [];
|
|
75
87
|
// Extracting the matching data
|
|
76
|
-
|
|
88
|
+
const extract = (0, JsonUtils_1.findByFilter)(response, '__typename', 'User');
|
|
77
89
|
// Deserializing valid data
|
|
78
|
-
for (
|
|
79
|
-
var item = extract_2[_i];
|
|
90
|
+
for (const item of extract) {
|
|
80
91
|
if (item.legacy && item.legacy.created_at) {
|
|
81
92
|
// Logging
|
|
82
93
|
LogService_1.LogService.log(Logging_1.ELogActions.DESERIALIZE, { id: item.rest_id });
|
|
@@ -86,13 +97,12 @@ var User = /** @class */ (function () {
|
|
|
86
97
|
// Logging
|
|
87
98
|
LogService_1.LogService.log(Logging_1.ELogActions.WARNING, {
|
|
88
99
|
action: Logging_1.ELogActions.DESERIALIZE,
|
|
89
|
-
message:
|
|
100
|
+
message: `User not found, skipping`,
|
|
90
101
|
});
|
|
91
102
|
}
|
|
92
103
|
}
|
|
93
104
|
return users.length ? users[0] : undefined;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
}());
|
|
105
|
+
}
|
|
106
|
+
}
|
|
97
107
|
exports.User = User;
|
|
98
108
|
//# sourceMappingURL=User.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/models/data/User.ts"],"names":[],"mappings":";;;AAEA
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/models/data/User.ts"],"names":[],"mappings":";;;AAEA,iDAAkD;AAClD,sDAAsD;AACtD,mEAAgE;AAGhE;;;;GAIG;AACH,MAAa,IAAI;IACT,SAAS,CAAS;IAClB,WAAW,CAAU;IACrB,cAAc,CAAS;IACvB,eAAe,CAAS;IACxB,QAAQ,CAAS;IACjB,EAAE,CAAS;IACX,UAAU,CAAU;IACpB,SAAS,CAAS;IAClB,QAAQ,CAAU;IAClB,WAAW,CAAU;IACrB,aAAa,CAAU;IACvB,YAAY,CAAS;IACrB,aAAa,CAAS;IACtB,QAAQ,CAAS;IAExB;;OAEG;IACH,YAAmB,IAAc;QAChC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QACxF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC;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
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.ApiError = void 0;
|
|
19
|
-
|
|
4
|
+
const RettiwtError_1 = require("./RettiwtError");
|
|
20
5
|
/**
|
|
21
6
|
* Represents an error that is thrown by Twitter API.
|
|
22
7
|
*
|
|
23
8
|
* @public
|
|
24
9
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
class ApiError extends RettiwtError_1.RettiwtError {
|
|
11
|
+
/** The error code thrown by Twitter API. */
|
|
12
|
+
code;
|
|
27
13
|
/**
|
|
28
14
|
* @param errorCode - The error code thrown by Twitter API.
|
|
29
15
|
* @param message - Any additional error message.
|
|
30
16
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return _this;
|
|
17
|
+
constructor(errorCode, message) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.code = errorCode;
|
|
35
20
|
}
|
|
36
|
-
|
|
37
|
-
}(RettiwtError_1.RettiwtError));
|
|
21
|
+
}
|
|
38
22
|
exports.ApiError = ApiError;
|
|
39
23
|
//# sourceMappingURL=ApiError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiError.js","sourceRoot":"","sources":["../../../src/models/errors/ApiError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiError.js","sourceRoot":"","sources":["../../../src/models/errors/ApiError.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAE9C;;;;GAIG;AACH,MAAa,QAAS,SAAQ,2BAAY;IACzC,4CAA4C;IACrC,IAAI,CAAS;IAEpB;;;OAGG;IACH,YAAmB,SAAiB,EAAE,OAAgB;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACvB,CAAC;CACD;AAbD,4BAaC"}
|